This one has got me confused:
I have a pfSense firewall (let's call it pfs
) and behind it several servers.
I NAT several services from my public IP to different servers on the LAN without any issues.
On one of the servers (let's call it s1
) I'm running a vagrant
(with libvirt
) VM (let's call it v1
) with a public network configured, which gets IP 192.168.1.159
via pfs
s DHCP server.
Now I configure a simple NAT on pfs
to access s1
's SSH, say <wan>:6622 -> s1:22
and access it on mydomain.com:6622
. No problem.
I can also access v1:22
(or the equivalent 192.168.1.159:22
) with a valid ssh user from within the LAN without issue.
Now I add a simple NAT on pfs
, say <wan>:6722 -> v1:22
. Now trying to access mydomain.com:6722
does not work?!
The objective is to add even "another layer": running containers with public ports, e.g. --publish 9980:80
on v1
and access them as e.g. v1:9980
and from mydomain.com:9980
with the corresponding NAT on pfs
like <wan>:9980 -> v1:9980
. From the LAN this is also working as expected (i.e. I can access v1:9980
from the LAN), but a NAT via pfs
is not.
I have similar setups working within the same network on different machines without problems. I even have another (non-vagrant, but also libvirt
) VM on s1
to which I can ssh over NAT via my public IP perfectly fine. But somehow the above doesn't work with the vagrant
machine, and I'm really at a loss what might be causing this issue. (FWIW I have net.ipv4.forward
enabled on v1
).
EDIT:
I got one step closer: if I nuke the first existing NIC of the vagrant
VM using virt-manager
, and set the second VM to rtl8139
instead of virtio
(and then restart), I lose vagrant ssh
capability but NAT then works. So the question then becomes: how to configure via vagrant
provisioning such that we have a similar config, I suppose that means that the public network must be on the default interface then?