Skip to content

Node full cone NAT traversal support for OpenVPN #652

@zolia

Description

@zolia

In order to have a basic NAT support, we should begin somewhere.
Modification of full cone NAT (port restricted full cone NAT) is default on Linux iptables. Since linux installations comprises majority of router setups we probably should start here. IPtables itself can be configured in other NAT types too, but this one looks to be the main one.

Attaching high level concept of how such NAT traversal could work.

IMG_20190103_112444.jpg

There might be many issues with such implementation (such as IP gets blacklisted by FW if it gets traffic from an unknown IP). This can be addressed later, delaying initial CONNECT. For now we solve simple case, that should be most common.

Adapting NAT traversal to our node is a bit more complex, since we do not implement our own transport protocol, but try to use existing plain security protocols (WG, OpenVPN). We cannot and do not want to use any intermitting transport proxies. For best performance we should have plain p2p connections.

Since there is specifics how services are being launched in our node NAT traversal implementation may vary a bit. We cannot have OpenVPN started before datagram tunnel is not set up in a NAT. According diagram above, flow should be like this:

  1. Send { Port: 1194, External IP } to node service
  2. Client initiates connection ( Dst Port 1194, Src Port: Local Port 1194)
  3. Node starts NAT pinger on Local Port 1194 and sends packet to peer { Port 1194, External IP }
    • When NAT pinger receives CONNECT from peer it shutdowns itself.
  4. Node service is started on 1194, next CONNECT from peer should reach node service and connection should proceed as normal.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions