IPV6 套接字的本地地址不在接口上
IPV6 socket's local address not on interface
创建 TCP6 套接字并连接到服务器时,为套接字选择的本地地址不在主机的任何接口上。为什么不同?
在下面的示例中,主机的 eth0 IPV6 地址是 fe80::10ff:36ff:fef5:611d。由于客户端是从 fe80::10ff:36ff:fef5:611d%eth0 连接的,我希望套接字的本地地址是相同的。但是 netstat 显示它是 fe80::10ff:36ff:f.
$ nc -l6v :: 10023
Listening on :: 10023
Connection received on fe80::10ff:36ff:fef5:611d%eth0 37402
$ nc -v fe80::10ff:36ff:fef5:611d%eth0 10023
Connection to fe80::10ff:36ff:fef5:611d%eth0 10023 port [tcp/*] succeeded!
$ netstat -6tn
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp6 0 0 fe80::10ff:36ff:f:37402 fe80::10ff:36ff:f:10023 ESTABLISHED
tcp6 0 0 fe80::10ff:36ff:f:10023 fe80::10ff:36ff:f:37402 ESTABLISHED
地址被截断。尝试将 netstat 与 -l
一起使用
创建 TCP6 套接字并连接到服务器时,为套接字选择的本地地址不在主机的任何接口上。为什么不同?
在下面的示例中,主机的 eth0 IPV6 地址是 fe80::10ff:36ff:fef5:611d。由于客户端是从 fe80::10ff:36ff:fef5:611d%eth0 连接的,我希望套接字的本地地址是相同的。但是 netstat 显示它是 fe80::10ff:36ff:f.
$ nc -l6v :: 10023
Listening on :: 10023
Connection received on fe80::10ff:36ff:fef5:611d%eth0 37402
$ nc -v fe80::10ff:36ff:fef5:611d%eth0 10023
Connection to fe80::10ff:36ff:fef5:611d%eth0 10023 port [tcp/*] succeeded!
$ netstat -6tn
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp6 0 0 fe80::10ff:36ff:f:37402 fe80::10ff:36ff:f:10023 ESTABLISHED
tcp6 0 0 fe80::10ff:36ff:f:10023 fe80::10ff:36ff:f:37402 ESTABLISHED
地址被截断。尝试将 netstat 与 -l
一起使用