Sunday, October 2, 2016

reload network script on ubuntu yakkety 16.10

1- when you update the network configuration  on file /etc/network/interfaces such as address, subnet mask, or gateway, dns

-sample below
$ cat /etc/network/interfaces
auto ens33
iface ens33 inet static
address 192.168.202.243
netmask 255.255.255.0
gateway 192.168.202.1
dns-nameservers 8.8.8.8



we can use restart the networking to reload the network script like the command below

$ sudo /etc/init.d/networking restart

2- but when we update the address the old addresses will remain map to the address, and we can see them only with the following command
$ ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:25:98:66 brd ff:ff:ff:ff:ff:ff
    inet 192.168.202.241/24 brd 192.168.202.255 scope global ens33
       valid_lft forever preferred_lft forever
    inet 192.168.202.244/24 brd 192.168.202.255 scope global secondary ens33
       valid_lft forever preferred_lft forever
    inet 192.168.202.243/24 brd 192.168.202.255 scope global secondary ens33
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe25:9866/64 scope link
       valid_lft forever preferred_lft forever


3- so if you want to reuse the ip address for other pc or server you can use the following command to delete them'
$ sudo ip add del 192.168.202.243/24 dev ens33
$ ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:25:98:66 brd ff:ff:ff:ff:ff:ff
    inet 192.168.202.241/24 brd 192.168.202.255 scope global ens33
       valid_lft forever preferred_lft forever
    inet 192.168.202.244/24 brd 192.168.202.255 scope global secondary ens33
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe25:9866/64 scope link
       valid_lft forever preferred_lft forever

No comments:

Post a Comment