Search code examples
network-programmingtcpipv6p2pnat

TCP over IPv6 to overcome NAT issues


When using TCP/IP Sockets (IPv4) for sending data from one to another device I can only access devices over their private IP address within my own WiFi. I can not send TCPs to public IP addresses because the NAT (Network Address Translation) rejects them or struggles translating into private IPs.

But with IPv6 every device gets it's own public IP. I suppose there are no private IPs then, are there? So there should not be problems with the NAT such as symmetric NAT because there will be no need of NAT.

Assuming both devices support IPv6 and know their IPv6 addresses: can I send data directly from one to the other device?


Solution

  • But with IPv6 every device gets it's own public IP. I suppose there are no private IPs then, are there?

    Not all IPv6 addresses are public. There are loopback addresses, link-local addresses, local addresses ... - see IPv6 - Special Addresses. Devices usually have multiple IPv6 addresses (i.e. loopback, link-local, ...), but there is no guarantee that they have a global IPv6 address. This depends a lot on the network setup.

    can I send data directly from one to the other device?

    If both devices have a public IP, you can send data from one to the other. Only, it might not be received by the other device since firewalls deny such traffic. It is actually pretty common that a SoHo router, at least by default, doesn't allow initiating IPv6 connections from outside. Corporate firewalls also usually deny this. There might be firewalls on the device itself, too. And so on.