Senin, 24 September 2018

How to add static route on Ubuntu via command line

  Tidak ada komentar
To add static route
maswachid@Lenovo-G470:~$ 
maswachid@Lenovo-G470:~$ sudo route add -net 10.252.242.0 netmask 255.255.255.0 gw 172.16.221.1
maswachid@Lenovo-G470:~$ 
maswachid@Lenovo-G470:~$ 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
maswachid@Lenovo-G470:~$ 
maswachid@Lenovo-G470:~$ sudo route add -net 10.252.242.0 netmask 255.255.255.0 dev tun0
maswachid@Lenovo-G470:~$ 
maswachid@Lenovo-G470:~$ 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
maswachid@Lenovo-G470:~$ sudo route delete -net 10.252.242.0 netmask 255.255.255.0 gw 172.16.221.1
maswachid@Lenovo-G470:~$ 

To delete static route based on dev
maswachid@Lenovo-G470:~$ sudo route delete -net 10.252.242.0 netmask 255.255.255.0 dev wlp2s0
maswachid@Lenovo-G470:~$ 


Tidak ada komentar :

Posting Komentar