Jay
Jay

Reputation: 87

IPV6 socket's local address not on interface

When creating a TCP6 socket and connecting to a server, the local address choosen for the socket is not on any of the host's interfaces. Why the difference?

In the example below, the host's eth0 IPV6 address is fe80::10ff:36ff:fef5:611d. Since the client is connecting from fe80::10ff:36ff:fef5:611d%eth0 I would expect the socket's local address to be the same. However netstat shows it is 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

Upvotes: 0

Views: 342

Answers (1)

Tom
Tom

Reputation: 890

The address is truncated. Try using netstat with -l

Upvotes: 1

Related Questions