Ipv6
IPv6 - 沒有到主機的路由 (113)
我正在嘗試通過路由器在 IPv6 中連接兩個模組(客戶端和伺服器)。它適用於 IPv4,但不適用於 IPv6。
路由器配置如下:
$ ifconfig eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.40.56.26 netmask 255.255.255.0 broadcast 10.40.56.255 inet6 fe80::47dc:3b02:90de:2030 prefixlen 64 scopeid 0x20<link> ether 18:31:bf:e0:2c:4f txqueuelen 1000 (Ethernet) RX packets 28116 bytes 3152995 (3.0 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 5440 bytes 3745444 (3.5 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 16 memory 0xa1300000-a1320000 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 14900 bytes 1346088 (1.2 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 14900 bytes 1346088 (1.2 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 inet 192.168.2.1 netmask 255.255.255.0 destination 192.168.2.1 inet6 fe80::4fe5:b420:b2db:cdab prefixlen 64 scopeid 0x20<link> unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) RX packets 7 bytes 308 (308.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 27 bytes 1412 (1.3 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 tun1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 inet6 2001:468:3000:1:: prefixlen 48 scopeid 0x0<global> inet6 fe80::476b:d7be:189f:c9ee prefixlen 64 scopeid 0x20<link> unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) RX packets 15 bytes 960 (960.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 14 bytes 672 (672.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 tun2: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 inet 192.168.4.1 netmask 255.255.255.0 destination 192.168.4.1 inet6 2001:468:3000:1:: prefixlen 48 scopeid 0x0<global> inet6 fe80::7d63:28af:13a7:6813 prefixlen 64 scopeid 0x20<link> unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) RX packets 33 bytes 2364 (2.3 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 14 bytes 672 (672.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 tun3: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 inet 192.168.5.1 netmask 255.255.255.0 destination 192.168.5.1 inet6 fe80::1a60:3195:6e42:c469 prefixlen 64 scopeid 0x20<link> inet6 2001:468:4000:1:: prefixlen 48 scopeid 0x0<global> unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 14 bytes 672 (672.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 tun4: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 inet 192.168.2.1 netmask 255.255.255.0 destination 192.168.2.1 inet6 fe80::fca3:d3a9:2352:e365 prefixlen 64 scopeid 0x20<link> unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 14 bytes 672 (672.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.124.1 netmask 255.255.255.0 broadcast 192.168.124.255 ether 52:54:00:cb:49:e5 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
這是路由命令輸出:
$ route -n -6 Kernel IPv6 routing table Destination Next Hop Flag Met Ref Use If 2001:468:3000::/48 :: U 256 5 15 tun1 2001:468:3000::/48 :: U 256 5 33 tun2 2001:468:3000::/48 :: U 1024 1 0 tun1 2001:468:4000::/48 :: U 256 1 0 tun3 2001:468:4000::/48 :: U 1024 1 0 tun3 fc00::40:56:0/112 :: U 100 1 0 eno1 fe80::223:ebff:fea6:4c7f/128 :: U 100 1 0 eno1 fe80::/64 :: U 256 1 0 eno1 fe80::/64 :: U 256 1 0 tun0 fe80::/64 :: U 256 1 0 tun1 fe80::/64 :: U 256 1 0 tun2 fe80::/64 :: U 256 1 0 tun3 fe80::/64 :: U 256 1 0 tun4 ::/0 fe80::223:ebff:fea6:4c7f UG 100 13 401 eno1 ::/0 :: !n -1 1 498 lo ::1/128 :: Un 0 5 8 lo 2001:468:3000:1::/128 :: Un 0 2 0 lo 2001:468:3000:1::/128 :: Un 0 2 0 lo 2001:468:4000:1::/128 :: Un 0 2 0 lo fe80::1a60:3195:6e42:c469/128 :: Un 0 2 0 lo fe80::476b:d7be:189f:c9ee/128 :: Un 0 2 0 lo fe80::47dc:3b02:90de:2030/128 :: Un 0 3 50 lo fe80::4fe5:b420:b2db:cdab/128 :: Un 0 2 0 lo fe80::7d63:28af:13a7:6813/128 :: Un 0 2 0 lo fe80::fca3:d3a9:2352:e365/128 :: Un 0 2 0 lo ff00::/8 :: U 256 4 429 eno1 ff00::/8 :: U 256 1 0 tun0 ff00::/8 :: U 256 1 0 tun1 ff00::/8 :: U 256 1 0 tun2 ff00::/8 :: U 256 1 0 tun3 ff00::/8 :: U 256 1 0 tun4 ::/0 :: !n -1 1 498 lo
客戶端嘗試連接到伺服器套接字時連接失敗。控制台輸出正在列印
error 113 No route to host on connect()
。客戶端設備正在獲取以下地址:
2001:468:3000:2:5851:F42D:40B1:8CCF
當伺服器正在獲取時:
2001:468:3000:1:5851:F42D:40B1:8CCF
請注意,當我在同一設備上配置客戶端和伺服器時,它正在工作。獲取以下地址的客戶端/伺服器設備:
2001:468:3000:1:5851:F42D:40B1:8CCF
我的路由器上沒有為 IPV6 啟動 IP 轉發。以下命令臨時啟動它:
sysctl -w net.ipv6.conf.all.forwarding=1
要永久啟動,請在文件 /etc/sysctl.conf 中添加以下行:
net.ipv6.conf.all.forwarding=1
然後,應用更改重新載入文件:
sysctl -p /etc/sysctl.conf