Linux

dhcpcd ipv6 日誌中過多的添加/刪除路由

  • August 13, 2017

這與路由器廣告相關。現在,我ipv6rs從配置中刪除並手動添加了路線。有沒有更好的方法來消除過多的日誌?

Apr 22 16:53:39 prince dhcpcd[2358]: eth1: adding default route via fe80::201:5cff:fe63:c046
Apr 22 16:53:39 prince dhcpcd[2358]: eth1: removing default route via fe80::201:5cff:fe63:c046
Apr 22 16:53:42 prince dhcpcd[2358]: eth1: adding default route via fe80::201:5cff:fe63:c046
Apr 22 16:53:42 prince dhcpcd[2358]: eth1: removing default route via fe80::201:5cff:fe63:c046
Apr 22 16:53:45 prince dhcpcd[2358]: eth1: adding default route via fe80::201:5cff:fe63:c046
Apr 22 16:53:45 prince dhcpcd[2358]: eth1: removing default route via fe80::201:5cff:fe63:c046
Apr 22 16:53:49 prince dhcpcd[2358]: eth1: adding default route via fe80::201:5cff:fe63:c046
Apr 22 16:53:49 prince dhcpcd[2358]: eth1: removing default route via fe80::201:5cff:fe63:c046
Apr 22 16:53:53 prince dhcpcd[2358]: eth1: adding default route via fe80::201:5cff:fe63:c046
Apr 22 16:53:53 prince dhcpcd[2358]: eth1: removing default route via fe80::201:5cff:fe63:c046
Apr 22 16:53:56 prince dhcpcd[2358]: eth1: adding default route via fe80::201:5cff:fe63:c046
Apr 22 16:53:56 prince dhcpcd[2358]: eth1: removing default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:00 prince dhcpcd[2358]: eth1: adding default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:00 prince dhcpcd[2358]: eth1: removing default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:04 prince dhcpcd[2358]: eth1: adding default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:04 prince dhcpcd[2358]: eth1: removing default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:07 prince dhcpcd[2358]: eth1: adding default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:07 prince dhcpcd[2358]: eth1: removing default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:10 prince dhcpcd[2358]: eth1: adding default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:10 prince dhcpcd[2358]: eth1: removing default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:13 prince dhcpcd[2358]: eth1: adding default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:13 prince dhcpcd[2358]: eth1: removing default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:16 prince dhcpcd[2358]: eth1: adding default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:16 prince dhcpcd[2358]: eth1: removing default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:20 prince dhcpcd[2358]: eth1: adding default route via fe80::201:5cff:fe63:c046
Apr 22 16:54:20 prince dhcpcd[2358]: eth1: removing default route via fe80::201:5cff:fe63:c046

這是目前的配置:

hostname
duid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
slaac private
nohook lookup-hostname
noipv6rs
interface eth1
#  ipv6rs
#  ipv6ra_own_default
 iaid 1
 ia_pd 1/::/64 eth2/0/64

當 dhcpcd 停止時,它不會像預期的那樣清除自己添加的路由。但是,一旦重新啟動dhcpcd並獲取了dhcp,它會再次嘗試添加路由,並會因為重複而刪除自己的路由,但仍將路由標記為未添加。

在修復此行為之前,解決方案是監視日誌以進行添加/刪除,然後刪除它嘗試添加的路由。在上述情況下:

sudo ip -6 route del default via fe80::201:5cff:fe63:c046 dev eth1

完成後,dhcpcd 將添加路由並保持安靜。

引用自:https://serverfault.com/questions/846019