Linux NAT's small talk

I have two machine, machine A and machine B. I require machine B's packet forwarded by machine A. So, It's NAT.

First time, we need to enable ip forward of machine A, setting iptables that allow
to masquerade the packets from inner NIC to external NIC then.
iptables -t nat -A POSTROUTING -s ethx -o ethy -j MASQUERADE
It's had a problem at this time. The error message told me "host/network ethx not found". I change the command that remove parameter -s.
iptables -t nat -A POSTROUTING -o ethy -j MASQUERADE
It's mean all the packets from all NICs will masquerade to ethy. Finally, it's work.

留言

熱門文章