ip 命令 和ifconfig 命令 刪除IP

使用ifconfig命令添加一個VIP後,若是須要將這個VIP刪除,能夠使用ifconfig VIP down命令。緩存

可是,若是操做順序不當,VIP會仍然留在系統緩存中,這時,使用ifconfig是看不到這個VIP的,可是,使用IP命令可以看到。ide

查看ipspa

ip -o -f inet addr showorm

刪除ip 
ip -f inet addr delete 10.0.64.102/32  dev tunl0ip

 

ip 與ifconfig 具體比較以下:it

1 ifconfig tunl0 10.0.64.102 netmask 255.255.255.255 up
2 此時會有再運行 ifconfig 會看到以下
tunl0     Link encap:IPIP Tunnel  HWaddr   
          inet addr:10.0.64.102  Mask:255.255.255.255
          UP RUNNING NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
3 ifconfig tunl0 down
4 此時會有再運行 ifconfig 會看到以下
    沒有tunl0設備了
5 可是使用ip -o -f inet addr show
  tunl0    inet 10.0.64.102/32 scope global tunl0
  依然還有這個ip,說明在tunl0配置ip的時候使用ifconfig tunl0 down 是不能刪除這個ip的,可是使用ifconfig確查看不到io

--------------------以下步驟----------------------------------------
1 ifconfig tunl0 up
2 ifconfig tunl0:0 10.0.64.102 netmask 255.255.255.255 up
3 ifconfig tunl0:0 down
4 ifconfig tunl0 down
此時使用ip -o -f inet addr show 或者 ifconfig 都看不到ip 10.0.64.102class


----------------------以下步驟---------------------------------------------------
1 ifconfig tunl0 up
2 ifconfig tunl0:0 10.0.64.102 netmask 255.255.255.255 up
3 ifconfig tunl0:1 10.0.64.103 netmask 255.255.255.255 up
4 ifconfig tunl0 down
此時使用ifconfig看不到任何ip
可是使用ip -o -f inet addr show,以下:
  5: tunl0    inet 10.0.64.102/32 scope global tunl0:0
  5: tunl0    inet 10.0.64.103/32 scope global tunl0:1
 說明ip並無刪除配置

----------------------以下步驟---------------------------------------------------
1 ifconfig tunl0 up
2 ifconfig tunl0:0 10.0.64.102 netmask 255.255.255.255 up
3 ifconfig tunl0:1 10.0.64.103 netmask 255.255.255.255 up
4 ifconfig tunl0:0 down
5 ifconfig tunl0:1 down
6 ifconfig tunl0 downqueue

此時使用ip -o -f inet addr show或者ifconfig看不到任何ip說明 ip被刪除了

相關文章
相關標籤/搜索