ubuntu 16.04 IP修改靜態後,舊IP依然生效問題
阿新 • • 發佈:2019-01-08
把原來的靜態IP從150改成151後,執行/etc/init.d/networking restart 後,150和151同時生效了。如下ens33,151IP變成secondary
[email protected]:~$ ip addr
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:c7:d7:62 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.150/24 brd 192.168.2.255 scope global ens33
valid_lft forever preferred_lft forever
inet 192.168.2.151/24 brd 192.168.2.255 scope global secondary ens33
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fec7:d762/64 scope link
valid_lft forever preferred_lft forever
一種方法是重啟系統
另一種方法
ip addr flush dev ens33 ifdown ens33 ifup ens33