无论我怎么尝试,我的 Ubuntu Server 计算机(裸机)都不会接受路由器广告。我可以从 DHCP 中提取 IPv6 地址,从另一台计算机 ping 该地址,但尝试 ping 回去却不起作用。DNS over IPv6 也不行(可能是因为它不接受路由器广告)。
有什么想法吗?我已经用尽了我对 networkd、netplan 和一般网络的知识。
据我所知,这是因为内核标志net.ipv6.conf.enp4s0.accept_ra = 0
。
- 如果我手动将标志设置为 1,它什么也不做
- 如果我设置标志并重新启动,它将恢复为 0
- 如果我设置标志并运行
netplan apply
,它会恢复为 0 - 如果我设置标志并运行
networkctl reload
,它会停留在 1 但不执行任何操作 - 如果我设置标志并运行
networkctl reconfigure enp4s0
,它会恢复为 0 - 如果我设置标志
/etc/sysctl.conf
并重新启动,或者sysctl -p
它停留在或恢复为 0 - 如果我设置 netplan
accept-ra: true
并运行,netplan apply
它会停留在 0 或恢复为 0
这是我的配置
- 网络计划
ethernets:
enp4s0:
dhcp4: true
dhcp6: true
accept-ra: true
version: 2
- /运行/systemd/network/10-netplan-enp4s0.network
[Match]
Name=enp4s0
[Network]
DHCP=yes
LinkLocalAddressing=ipv6
IPv6AcceptRA=yes
[DHCP]
RouteMetric=100
UseMTU=true
- /etc/sysctl.conf
net.ipv6.conf.enp4s0.accept_ra = 1
- 系统控制
net.ipv6.conf.enp4s0.accept_dad = 1
net.ipv6.conf.enp4s0.accept_ra = 0
net.ipv6.conf.enp4s0.accept_ra_defrtr = 1
net.ipv6.conf.enp4s0.accept_ra_from_local = 0
net.ipv6.conf.enp4s0.accept_ra_min_hop_limit = 1
net.ipv6.conf.enp4s0.accept_ra_mtu = 1
net.ipv6.conf.enp4s0.accept_ra_pinfo = 1
net.ipv6.conf.enp4s0.accept_ra_rt_info_max_plen = 0
net.ipv6.conf.enp4s0.accept_ra_rt_info_min_plen = 0
net.ipv6.conf.enp4s0.accept_ra_rtr_pref = 1
net.ipv6.conf.enp4s0.accept_redirects = 1
net.ipv6.conf.enp4s0.accept_source_route = 0
net.ipv6.conf.enp4s0.addr_gen_mode = 0
net.ipv6.conf.enp4s0.autoconf = 1
net.ipv6.conf.enp4s0.dad_transmits = 1
net.ipv6.conf.enp4s0.disable_ipv6 = 0
net.ipv6.conf.enp4s0.disable_policy = 0
net.ipv6.conf.enp4s0.drop_unicast_in_l2_multicast = 0
net.ipv6.conf.enp4s0.drop_unsolicited_na = 0
net.ipv6.conf.enp4s0.enhanced_dad = 1
net.ipv6.conf.enp4s0.force_mld_version = 0
net.ipv6.conf.enp4s0.force_tllao = 0
net.ipv6.conf.enp4s0.forwarding = 0
net.ipv6.conf.enp4s0.hop_limit = 64
net.ipv6.conf.enp4s0.ignore_routes_with_linkdown = 0
net.ipv6.conf.enp4s0.keep_addr_on_down = 0
net.ipv6.conf.enp4s0.max_addresses = 16
net.ipv6.conf.enp4s0.max_desync_factor = 600
net.ipv6.conf.enp4s0.mc_forwarding = 0
net.ipv6.conf.enp4s0.mldv1_unsolicited_report_interval = 10000
net.ipv6.conf.enp4s0.mldv2_unsolicited_report_interval = 1000
net.ipv6.conf.enp4s0.mtu = 1500
net.ipv6.conf.enp4s0.ndisc_notify = 0
net.ipv6.conf.enp4s0.ndisc_tclass = 0
net.ipv6.conf.enp4s0.proxy_ndp = 0
net.ipv6.conf.enp4s0.regen_max_retry = 3
net.ipv6.conf.enp4s0.router_probe_interval = 60
net.ipv6.conf.enp4s0.router_solicitation_delay = 1
net.ipv6.conf.enp4s0.router_solicitation_interval = 4
net.ipv6.conf.enp4s0.router_solicitation_max_interval = 3600
net.ipv6.conf.enp4s0.router_solicitations = -1
net.ipv6.conf.enp4s0.seg6_enabled = 0
net.ipv6.conf.enp4s0.seg6_require_hmac = 0
net.ipv6.conf.enp4s0.suppress_frag_ndisc = 1
net.ipv6.conf.enp4s0.temp_prefered_lft = 86400
net.ipv6.conf.enp4s0.temp_valid_lft = 604800
net.ipv6.conf.enp4s0.use_oif_addrs_only = 0
net.ipv6.conf.enp4s0.use_tempaddr = 0
答案1
我知道我来晚了,但实际上我必须感谢你让我走上了正确的netplan
IPv6 使用之路,因为直到一小时前我还是一个典型的/network/interfaces
选择。 netplan
迫不得已。无论如何,以下是对我有用的方法:
sysctl -w net.ipv6.conf.enp4s0.accept_ra=1
以及netplan
:
network:
version: 2
renderer: networkd
ethernets:
enp4s0:
addresses:
- 192.168.46.210/24
nameservers:
addresses: [192.168.46.217]
routes:
- to: default
via: 192.168.46.213
wakeonlan: true
accept-ra: true
似乎只需要最后一行;我不需要设置dhcp6
标志