我有一个 16.04 的虚拟服务器,分配了两个 64 IPv6 子网。
我正在尝试获取带有 SLAAC 的随机 IPv6 地址,以便与外部服务器进行通信。
这是我的/etc/network/interfaces
auto ens3
iface ens3 inet dhcp
iface ens3 inet6 auto
但是我没有得到 IPv6 地址。这是 ip a 的输出ip -6 a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1
inet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 fe80::5054:a1ff:fe87:f16f/64 scope link valid_lft forever preferred_lft forever
我可以使用以下方法手动添加 IPv6 地址
sudo ip -6 addr add [NEW_ADDRESS]/64 dev ens3
这给了我以下输出ip -6
和一个有效的 IPv6 地址
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1
inet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 [NEW_ADDRESS]/64 scope global valid_lft forever preferred_lft forever
inet6 fe80::5054:a1ff:fe87:f16f/64 scope link valid_lft forever preferred_lft forever
这是输出sudo sysctl -a | grep net.ipv6.conf | grep -i ens3
:
net.ipv6.conf.ens3.accept_dad = 1
net.ipv6.conf.ens3.accept_ra = 2
net.ipv6.conf.ens3.accept_ra_defrtr = 1
net.ipv6.conf.ens3.accept_ra_from_local = 0
net.ipv6.conf.ens3.accept_ra_min_hop_limit = 1
net.ipv6.conf.ens3.accept_ra_mtu = 1
net.ipv6.conf.ens3.accept_ra_pinfo = 1
net.ipv6.conf.ens3.accept_ra_rt_info_max_plen = 0
net.ipv6.conf.ens3.accept_ra_rtr_pref = 1
net.ipv6.conf.ens3.accept_redirects = 1
net.ipv6.conf.ens3.accept_source_route = 0
net.ipv6.conf.ens3.autoconf = 1
net.ipv6.conf.ens3.dad_transmits = 1
net.ipv6.conf.ens3.disable_ipv6 = 0
net.ipv6.conf.ens3.force_mld_version = 0
net.ipv6.conf.ens3.force_tllao = 0
net.ipv6.conf.ens3.forwarding = 0
net.ipv6.conf.ens3.hop_limit = 64
net.ipv6.conf.ens3.ignore_routes_with_linkdown = 0
net.ipv6.conf.ens3.max_addresses = 16
net.ipv6.conf.ens3.max_desync_factor = 600
net.ipv6.conf.ens3.mc_forwarding = 0
net.ipv6.conf.ens3.mldv1_unsolicited_report_interval = 10000
net.ipv6.conf.ens3.mldv2_unsolicited_report_interval = 1000
net.ipv6.conf.ens3.mtu = 1500
net.ipv6.conf.ens3.ndisc_notify = 0
net.ipv6.conf.ens3.proxy_ndp = 0
net.ipv6.conf.ens3.regen_max_retry = 3
net.ipv6.conf.ens3.router_probe_interval = 60
net.ipv6.conf.ens3.router_solicitation_delay = 1
net.ipv6.conf.ens3.router_solicitation_interval = 4
net.ipv6.conf.ens3.router_solicitations = 3
net.ipv6.conf.ens3.suppress_frag_ndisc = 1
net.ipv6.conf.ens3.temp_prefered_lft = 86400
net.ipv6.conf.ens3.temp_valid_lft = 604800
net.ipv6.conf.ens3.use_oif_addrs_only = 0
net.ipv6.conf.ens3.use_tempaddr = 0