NAT translation confusion.. (VyOS specifically)

Associate
Joined
14 May 2006
Posts
1,310
Hey, I'm not going to claim to be the most clued up on things when they start to get a bit more in-depth (partially why I've started to try and do things a little more manually in my homelab) but I've got a bit of a weird situation that I can't fully figure out. So in my homelab, I've got:

Proxmox hypervisor with 2x NICs on the same logical network (LACP bonded)
\/
Virtualised vyos router with eth0 = connected to bridge to bonded network, eth1 = bridge to vm internal network
\/
sample web server with eth0, eth1 setup same as vyos (to be able to proxy for both parts of my network) (was previously an nginx proxy setup but rolled this back to a simple port 80 listener for the moment)

The VyOS box is setup with both interfaces working perfectly, regular VM hosts get addresses on the internal network from this box acting as a DHCP and as a DNS forwarder to the main network (outbound internet works fine). I have setup a NAT destination rule to take incoming traffic on a port, take 80 for example, and forward through to the web server. If that web server only has the one interface bound to the vm network, this works fine and I can access the web server from the main network via the IP of VyOS. As soon as I provision a second adapter to the web server onto the main network, this VyOS NAT destination rule stops working for outside traffic. I can still curl the response back from the web server on the internal vm network (on the vyos box for example) so it is still serving on that adapter (bound to 0.0.0.0) but the traffic from outside is no longer handled properly. I have a NAT source rule which is defined to translation masquerade out on the main network adapter for any internal traffic, I don't think I know enough to know whether this is what is causing the issue. Any thoughts or advice? I've paired down the setup to barebones to try and get the core of it working.

Thanks in advance!
 
Last edited:
Ah when you're right, you're right! I was so focused on having screwed something up with the NAT rules with the 'new to me' VyOS, I hadn't really considered that the packets were routing back via the direct route from the destination server! Thanks very much, I'll have a think about whether I want to add some ip rules to route back via the original interface for traffic on that interface or just rethink my setup (I originally was preventing it from hitting the main network directly but might get it to proxy for both main and VM networks, just be some DNS fun then)
 
Back
Top Bottom