Saturday, July 20, 2019

Ubuntu route configuration

Clear route table: sudo ip route flush table main
Add default route: sudo route add default gw 192.168.1.1
Add route to certain subnet: sudo ip route add 0.0.0.0/0 dev ens33

Add route according to route table: sudo route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1
Add route via: sudo ip route add 192.168.1.0/24 via 192.168.1.1


Delete certain route:
sudo route del -net 192.168.1.0 gw 0.0.0.0 netmask 255.255.255.0
sudo route del -net 192.168.1.0 gw 0.0.0.0 netmask 255.255.255.0 dev ens33


Restart network service:  systemctl restart networking
Restart network manager: sudo service network-manager




Wednesday, July 3, 2019

To make /etc/network/interfaces effective after changing the file

When changing the file /etc/network/interfaces, there will be no immediate effect except reboot the system. You can run following commands to take effect.


sudo ifconfig ath0 down
sudo /etc/init.d/networking restart
sudo ifconfig ath0 up