Rob*_*zu. 8 networking ipv6 netcat
我正在尝试使用 netcat(或者更确切地说是 nc6)设置一个仅基本 IPv6 的回显服务器。客户端和服务器都在同一个本地网络中。但是,客户端立即退出:
IPv6-服务器:
$ nc6 -6 -vv --continuous --exec cat -l -p 5555
nc6: listening on :: 5555 ...
Run Code Online (Sandbox Code Playgroud)
IPv6-客户端:
$ nc6 -6 -vv fe80::213:33ff:feab:ff5d 5555
nc6: fe80::213:33ff:feab:ff5d (fe80::213:33ff:feab:ff5d) 5555 [5555] open
nc6: using stream socket
nc6: using buffer size of 8192
nc6: error reading from remote: Transport endpoint is not connected
nc6: connection closed (sent 0, rcvd 0)
nc6: readwrite returned -1
nc6: closed local
nc6: closed remote
$
Run Code Online (Sandbox Code Playgroud)
有什么问题?
我应该将服务器配置为仅在其接口之一上侦听传入连接吗?(如何?)
IPv4 版本工作正常:
IPv4-服务器:
nc6 -vv --continuous --exec cat -l -p 5555
nc6: listening on :: 5555 ...
nc6: listening on 0.0.0.0 5555 ...
nc6: connect to 192.168.1.35 5555 from xyrobert.local (192.168.1.35) 37928 [37928]
nc6: using stream socket
nc6[7502]: executing 'cat'
nc6[7502]: using buffer size of 8192
nc6[7502]: read 4 bytes from remote
nc6[7502]: wrote 4 bytes to local
nc6[7502]: read 4 bytes from local
nc6[7502]: wrote 4 bytes to remote
Run Code Online (Sandbox Code Playgroud)
IPv4-客户端:
nc6 -vv 192.168.1.35 5555
nc6: kearney.local (192.168.1.35) 5555 [5555] open
nc6: using stream socket
nc6: using buffer size of 8192
Hi!
nc6: read 4 bytes from local
nc6: wrote 4 bytes to remote
nc6: read 4 bytes from remote
Hi!
nc6: wrote 4 bytes to local
Run Code Online (Sandbox Code Playgroud)
小智 10
当连接到 IPv6 链接本地地址时,您需要指定通过哪个链接到达它,如从客户端系统看到的那样。每个链接都使用相同的链接本地地址,因此需要明确告知客户端要使用哪个链接(接口)。因此,如果您要访问的系统是通过eth0
客户端系统连接的,则需要连接到fe80::213:33ff:feab:ff5d%eth0
.
使用可路由的 IPv6 地址要容易得多,因为本地路由表将用于确定通过哪个接口发送数据包。