How to add static route on Ubuntu via command line
To add static route
[email protected]:~$
[email protected]:~$ sudo route add -net 10.252.242.0 netmask 255.255.255.0 gw 172.16.221.1
[email protected]:~$
[email protected]:~$ ping 10.252.242.163PING 10.252.242.163 (10.252.242.163) 56(84) bytes of data.
64 bytes from 10.252.242.163: icmp_seq=1 ttl=63 time=1.58 ms
64 bytes from 10.252.242.163: icmp_seq=2 ttl=63 time=1.70 ms
To add static route based on interface
[email protected]:~$
[email protected]:~$ sudo route add -net 10.252.242.0 netmask 255.255.255.0 dev tun0
[email protected]:~$
[email protected]:~$ ping 10.252.242.163PING 10.252.242.163 (10.252.242.163) 56(84) bytes of data.
64 bytes from 10.252.242.163: icmp_seq=1 ttl=63 time=1.58 ms
64 bytes from 10.252.242.163: icmp_seq=2 ttl=63 time=1.70 ms
To delete static route
[email protected]:~$ sudo route delete -net 10.252.242.0 netmask 255.255.255.0 gw 172.16.221.1
[email protected]:~$
To delete static route based on dev
[email protected]:~$ sudo route delete -net 10.252.242.0 netmask 255.255.255.0 dev wlp2s0
[email protected]:~$
Tidak ada komentar :
Posting Komentar