如何删除link-local(169.255.0.0) 路由表项

route -n 时你总能看到这样一条路由
Destination Gateway Genmask Flags Metric Ref Use Iface
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
由RFC3330 可知 169.254.0.0/16 为本地链路地址
“169.254.0.0/16 – This is the “link local” block. It is allocated for
communication between hosts on a single link. Hosts obtain these
addresses by auto-configuration, such as when a DHCP server may not
be found.”
当系统配置为使用动态地址,而找不到DHCP服务器时,系统会为本机设置一个169.254.X.X的地址。
这个路由表项是有zeroconf 协议Daemon 程序添加的,我们一般是用不到的
只是注释掉/etc/networks 里面的link-local 项是无法去掉该路由表项的,/etc/networks 与/etc/hosts
文件的作用差不多,是用来关联网络号(数字格式)和网络名(字符格式)的,注释掉该条目后,只是169.254.0.0
无法解析为网络名link-local了.
可以用以下命令来删除zeroconf 相关的程序包
sudo apt-get remove avahi-autoipd –purge
下次启动机器后这条路由就不会自动出现了.

CentOS删除 link-local
转自:http://www.xiaoyinzei.com/?p=1000
关于zeroconf的作用看APIPA(自动专用IP寻址)
1. 如果需要全局关闭
1
2
sed -i ‘$a NOZEROCONF=yes' /etc/sysconfig/network
/etc/init.d/network restart
2. 需要单个网卡关闭
1
2
sed -i '$a NOZEROCONF=yes' /etc/sysconfig/network-scripts/ifcfg-网卡编号

/etc/init.d/network restart

posted on 2017-07-13 14:24  JasonKwok  阅读(2217)  评论(0编辑  收藏  举报

导航