azure linux 没有默认 ipv6 路由

azure linux 没有默认 ipv6 路由

环境

  • 虚拟机:Linux Debian 10.10
  • 具有 ipv4 和 ipv6 地址空间和子网的虚拟网络
  • 公共 ipv4 地址和公共 ipv6 地址(标准 SKU)
  • VM NIC 关联公共 ipv4 和公共 ipv6 地址
  • VM NIC 分配了私有 ipv4 和 ipv6 地址(使用 检查ip address

网络安全组:

在此处输入图片描述

网络网卡 有效路由

在此处输入图片描述

问题

无法连接http://ipv6.google.com

# curl -v http://ipv6.google.com
*   Trying 2404:6800:4005:812::200e...
* TCP_NODELAY set
* Immediate connect fail for 2404:6800:4005:812::200e: Network is unreachable
* Closing connection 0
curl: (7) Couldn't connect to server

没有 ipv6 默认路由

# ip -6 r
::1 dev lo proto kernel metric 256 pref medium
fd00::/80 dev docker0 metric 1024 linkdown pref medium
fd00:4244:7016::4 dev eth0 proto kernel metric 256 pref medium
fe80::/64 dev docker0 proto kernel metric 256 linkdown pref medium
fe80::/64 dev br-a3568bc4adc5 proto kernel metric 256 pref medium
fe80::/64 dev veth907e563 proto kernel metric 256 pref medium
fe80::/64 dev vethdf50b7b proto kernel metric 256 pref medium
fe80::/64 dev veth1322b71 proto kernel metric 256 pref medium
fe80::/64 dev veth6d1b4d6 proto kernel metric 256 pref medium
fe80::/64 dev vethca17875 proto kernel metric 256 pref medium
fe80::/64 dev eth0 proto kernel metric 256 pref medium

IPv6 路由器通告中没有默认路由

路由器通告仅包含前缀长度

# tcpdump -i eth0 -vv icmp6
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
00:51:28.053407 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 56) fe80::1234:5678:9abc > ip6-allnodes: [icmp6 sum ok] ICMP6, router advertisement, length 56
        hop limit 0, Flags [managed, other stateful], pref medium, router lifetime 9000s, reachable time 0ms, retrans timer 0ms
          source link-address option (1), length 8 (1): 12:34:56:78:9a:bc
            0x0000:  1234 5678 9abc
          prefix info option (3), length 32 (4): fd00:4244:7016::/64, Flags [onlink], valid time infinity, pref. time infinity
            0x0000:  4080 ffff ffff ffff ffff 0000 0000 fd00
            0x0010:  4244 7016 0000 0000 0000 0000 0000

IPV6 地址

# ip -6 address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 fd00:4244:7016::4/128 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::20d:3aff:fe82:b7d3/64 scope link
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 state DOWN
    inet6 fe80::1/64 scope link tentative
       valid_lft forever preferred_lft forever
4: br-a3568bc4adc5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP
    inet6 fe80::42:5bff:fe7d:1e0d/64 scope link
       valid_lft forever preferred_lft forever
16: veth907e563@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP
    inet6 fe80::44da:baff:fef3:c54d/64 scope link
       valid_lft forever preferred_lft forever
18: vethdf50b7b@if17: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP
    inet6 fe80::5c5d:93ff:fead:8190/64 scope link
       valid_lft forever preferred_lft forever
20: veth1322b71@if19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP
    inet6 fe80::f4a1:ceff:fe3e:55f4/64 scope link
       valid_lft forever preferred_lft forever
22: veth6d1b4d6@if21: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP
    inet6 fe80::60de:73ff:fe59:74ec/64 scope link
       valid_lft forever preferred_lft forever
24: vethca17875@if23: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP
    inet6 fe80::f47a:a6ff:febf:a444/64 scope link
       valid_lft forever preferred_lft forever

答案1

我修复了这个问题。ipv6 转发默认启用,并accept_ra设置为 1,忽略路由器通告。添加以下内容/etc/sysctl.conf以关闭 ipv6 转发:

net.ipv6.conf.all.forwarding=0

更新

ipv6 转发通过以下方式启用:docker ipv6 功能accept_ra=2. 因此设置启用 ipv6 的 docker接口。

相关内容