Difference between revisions of "Linux command: route"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) |
Rafahsolis (talk | contribs) |
||
| Line 6: | Line 6: | ||
Add route: | Add route: | ||
route add -net 15.17.160.0/20 gw 15.17.160.1 metric 10 eth0 | route add -net 15.17.160.0/20 gw 15.17.160.1 metric 10 eth0 | ||
| + | |||
| + | Add permanent route | ||
| + | |||
| + | nano /etc/network/interfaces: | ||
| + | |||
| + | <nowiki>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</nowiki> | ||
Revision as of 12:38, 21 November 2017
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