I set up a virtual ethernet (veth) pair between default namespace and another namespace named RoutableNS as follow:
-------------- --------------
- veth0 - -------------- veth1 -
- 10.5.1.1 - - 10.5.1.2 -
-------------- --------------
default NS RoutableNS
I can ping outside world in namespace RoutableNS through interface veth1
but It turns out when I SNAT (or MASQUERADE) incoming traffic to 10.5.1.1 (or 10.5.1.2) nothing will come to veth interface.
I tried same thing with tun
devices and I saw It's not possible to MASQUERADE to tun device when It's IP is not routable to outside world (in default namespace).
So I have two questions:
- Is this behaviour of SNAT (MASQUERADE) documented somewhere? I mean the behaviour that new source IPs should be routable to outside world in current namespace.
- Is there a networking options (sysctls) letting me do this?