LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   iptablies questions (https://www.linuxquestions.org/questions/linux-newbie-8/iptablies-questions-506642/)

cashton2k 12-01-2006 02:49 PM

iptablies questions
 
hi, could someone check that im understanding these iptables commands properly?

(eth0 external interface)

firstly

iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j DNAT --to-destination 192.168.100.1

is this a form of port address translation which will send all incoming packets on port 80 to machine 192.168.100.1?

secondly


whats the diff between these 2 commands? i dont totally get masquerade

iptables -A POSTROUTING -t nat -s 192.168.0.0/16 -o eth0 -j SNAT --to-source 192.168.0.254


iptables -A POSTROUTING -t nat -s 192.168.0.0/16 -o eth0 -j MASQUERADE

cheers for any help

acid_kewpie 12-01-2006 02:57 PM

yeah your first command looks fine, and as for the difference, it's more a convenience really. masquarading just means to forward the packet on addressed from that interface, rather than having to specify an actual ip address. if you change the ip of the box, the address the masq entry uses will implictly change too. there are many scenarios you'd want to nat to a certain ip address, but it's a lot simpler to just say "snat it to me" whoever you actually are.

cashton2k 12-01-2006 03:39 PM

cheers for the help, i understand it more now cheers,

just one final quick question, whats the differance between port address translation and port forwarding?

cheers

acid_kewpie 12-02-2006 02:50 AM

forwarding sends a request to another box, port translation changes the port being connected to (and potentially forwarding too)

cashton2k 12-02-2006 11:25 AM

ah cool i get it now, cheers for the help again

ta


All times are GMT -5. The time now is 10:21 AM.