作者:张格伦坊
如果在使用ifconfig命令添加VIP后需要删除该VIP,请使用ifconfig VIP down命令。
但是,如果操作顺序不正确,VIP将保留在系统缓存中。 此时,ifconfig无法看到此VIP,但可以通过IP命令看到。
查看ip
ip -o -f inet addr show
删除ip
IP-finetaddrdelete 10.0.64.102/32 dev tunl 0
ip和ifconfig的具体比较如下。
1 ifconfig tunl 010.0.64.102 net mask 255.255.255.255 up
2此时重新运行ifconfig,如下所示
tunl0link encap : ipip tunnel hwaddr
inetaddr 336010.0.64.102 mask :255.255.255
uprunningnoarpmtu :1480公制:1
rx包:0 errors :0 dropped :0 over runs :0 frame :0
tx packets :0 errors :0 dropped :0 over runs :0 carrier :0
collisions :0 txqueuelen :0
rx bytes :0 (0.0b tx bytes :0 (0.0b ) )。
3 ifconfig tunl0 down
4此时重新运行ifconfig,如下所示
没有tunl0设备
5但是,使用ip -o -f inet addr show
tunl0inet 10.0.64.102/32 scopeglobaltunl 0
此ip表示在tunl0上配置ip时,如果使用ifconfig tunl0 down,则无法删除此ip,但如果使用ifconfig,则无法确认
-------------下一步--------------------------------------------------------- -。
1 ifconfig tunl0 up
2 ifconfig tunl 0:010.0.64.102 net mask 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.102
------------下一步-----------如
1 ifconfig tunl0 up
2 ifconfig tunl 0:010.0.64.102 net mask 255.255.255.255 up
3 ifconfig tunl 0:110.0.64.103 net mask 255.255.255.255 up
4 ifconfig tunl0 down
此时,即使使用ifconfig也看不到任何ip
但是,使用ip -o -f inet addr show时,情况如下。
53360 tunl0inet 10.0.64.102/32 scopeglobaltunl 0:0
53360 tunl0inet 10.0.64.103/32 scopeglobaltunl 0:1
表示未删除ip
------------下一步-----------如
1 ifconfig tunl0 up
2 ifconfig tunl 0:010.0.64.102 net mask 255.255.255.255 up
3 ifconfig tunl 0:110.0.64.103 net mask 255.255.255.255 up
4 ifconfig tunl0:0 down
5 ifconfig tunl0:1 down
6 ifconfig tunl0 down
在这种情况下,使用ip -o -f inet addr show或ifconfig不会显示ip
说明ip已删除