Skip to content

Configure static routes in Debian or Red Hat Linux systems

  1. # Use of ip command
  2. ip route add 192.168.55.0/24 via 192.168.1.254 dev eth1
  3. route add -net 192.168.55.0 netmask 255.255.255.0 gw 192.168.1.254 dev eth1
  4. #———————————————-
  5. # Red Hat/Fedora Linux Static route file
  6. #———————————————-
  7. cat /etc/sysconfig/network-scripts/route-eth0
  8. GATEWAY0=192.168.1.254
  9. NETMASK0=255.255.255.0
  10. ADDRESS0=192.168.55.0
  11. GATEWAY1=10.164.234.112
  12. NETMASK1= 255.255.255.240
  13. ADDRESS1=10.164.234.132
  14. #————————————
  15. # Debian Linux static routes file
  16. #————————————
  17. cat /etc/network/interface
  18. auto eth0
  19. iface eth0 inet static
  20. address 192.168.1.2
  21. netmask 255.255.255.0
  22. gateway 192.168.1.254
  23. up route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.2.1
  24. down route del -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.2.1