Linux command: route

From RHS Wiki
Revision as of 12:38, 21 November 2017 by Rafahsolis (talk | contribs)
Jump to navigation Jump to search

Show routing table:

route -n

Delete route:

route del -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.1.254 eth0

Add route:

route add -net 15.17.160.0/20 gw 15.17.160.1 metric 10 eth0

Add permanent route

nano /etc/network/interfaces:
auto eth0
iface eth0 inet static
      address 192.168.1.2
      netmask 255.255.255.0
      up route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1
      up route add -net 172.16.0.0 netmask 255.240.0.0 gw 192.168.1.1