Linux/Ubuntu: Changing gateway address and flush/restart network interface

PHOTO EMBED

Sun Aug 28 2022 02:01:23 GMT+0000 (UTC)

Saved by @marcopinero #bash

sudo route ip route add <ip range> gw <gateway ip address> dev <interface>
sudo ip addr flush dev <interface>
sudo /etc/init.d/networking restart

#Ex:

route ip route add 192.168.32.0/24 gw 192.168.32.1 dev eth0
sudo ip addr flush dev eth0
sudo /etc/init.d/networking restart
content_copyCOPY

Changing gateway address and flush/restart network interface