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被删除了

相关文章
相关标签/搜索