Score:0

Iptables does NOT forward my servers packets

lt flag

I'm having troubles using iptables with my Debian 11 VMs. So, I got two Debian 11 servers and I want "Server1" to allow Internet connection through it so "Server2" can have Internet as well. Server1 has two network adapters one on bridge and another one on internal network so it can communicate with LAN to Server2. Server2 only have one and it's internal network.

Server1 and Server2 can see and ping each other. Server1 can ping exterior. Server2 can't even if I configure Server1 as the gateway.

I activated the bit of forwarding as well as I made the change in sysctl.conf and tried this iptable rule: iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE

"enp0s3" is the interface that connects to internet.

Nikita Kipriyanov avatar
za flag
You need to actually permit forwarded packets to pass (selectively or all), in addition to setting up NAT (which you did with the MASQUERADE command which sets up a SNAT-type rule) and enabling forwarding in the kernel. To debug we need to see your *complete* firewall, not just a single command; please, attach `iptables-save` output [to the question](https://serverfault.com/posts/1125976/edit). // And, to clarify: **iptables is a packet filter, it doesn't forward anything**, it only can drop or change packets.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.