reload static IP ubuntu 16
I am using Ubuntu server 16.04 and setting up some network interfaces, I wish to reload a static IP after changing its address at /etc/network/interfaces without reboot:
auto ens6
iface ens6 inet static
address 192.168.0.41
netmask 255.255.255.0
broadcast 192.168.0.255
I tried the following:
sudo systemctl restart networking
sudo ifconfig ens6 down (and afterwards up)
sudo ifdown ens6 (and afterwards up)
and tried some combinations of these commands,
Yet if i change my 'address' at the /etc/network/interfaces it will get updated (at ifconfig) only after i reboot my machine
What is the correct way to do this action without a reboot?
EDIT - tried this also due to comments
sudo /etc/init.d/networking restart
If the ifdown+ifup approach isn't working, try:
sudo ifdown <network interface> && sudo ip addr flush <network interface> && sudo ifup <network interface>
ip addr flush enp0s3 && systemctl restart networking.service
Where enp0s3
is your netcard name.