I have a container which has an incoming VPN. A connection into that container will be assigned the 192.168.10.10
IP. The virtual NIC of the container has an IP of 10.10.10.1
and a gateway (on the host bridge) of 10.10.10.254
.
When directly logged into the container, a packet will leave with 10.10.10.1
as the source and will know how to come back (via the bridge).
When VPNed-in, the packet leaves with 192.168.10.10
as the source and would not come back as 192.168.10.x
is not advertized in the network (there is no route to that network).
There are two solutions to this:
- either masquerade in the container so that the packet leaves with
10.10.10.1
- or advertize the
192.168.10.x
route on the network
I would like (for various reasons) avoid going for either of these solutions and was wondering if it is possible to do the masquerading in the bridge itself, on the host side?
In other words a packet would be leaving the container with a source of 192.168.10.10
, which would then be rewritten "by the bridge" to a known 10.10.10.1
IP (and then rewritten again when the reply comes back to the container)
Note: how to do it in shorewall
would be awesome but any information will be great.