0

I am trying to write a series of integration tests to validate that the built-in port-prediction+NAT traversal of my software works. Since I don't want to use physical infrastructure to test this in Github actions, I want to use docker containers to do this efficiently. Here is the network:

1 server, S, behind a NAT, N0, with NAT behaviour K0

1 Client, A, behind a NAT, N1, with NAT behaviour K1

1 Client, B, behind a NAT, N2, with NAT behaviour K2

K0 will be a fixed/constant setup for a NAT whereby the IP and port are not translated. Nothing fancy here. Both client A and B should be able to reach S directly without any hassle.

K1 and K2 can be something like a full-cone NAT, port-restricted NAT, address-restricted NAT, or a Symmetric NAT.

I want to be able to change the NAT settings using a shell script ran inside the Dockerfile using the answer below to create a unique shell script for each desired NAT type for test. See this link for using iptables for emulating NAT behaviours: How to simulate different NAT behaviours

How might this work using docker-compose, Dockerfiles, and entrypoint.sh files?

Thomas Braun
  • 505
  • 3
  • 14

0 Answers0