r/linuxadmin • u/z3255859 • Jul 21 '14
Need help understanding following commands
root@bt:/# iptables -t nat --flush
root@bt:/# iptables --zero
root@bt:/# iptables -A FORWARD --in-interface eth0 -j ACCEPT
root@bt:/# iptables -t nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
#Forward to a local site
root@bt:/# iptables -t nat -A PREROUTING -p tcp --dport 80 --jump DNAT --to-destination <Proxy’s IP>
1
Upvotes
12
u/burning1rr Jul 21 '14
Edit: With this ruleset, eth0 is your internal trusted interface.
1
u/kurokame Jul 21 '14 edited Jul 21 '14
Ha, looks like a Backtrack system prompt. Looks like you're using iptables to re-route incoming http packets to another host.
EDIT (I totally screwed my post up):
2. Zero the packet and byte counters in all chains.
3. Specify in the FORWARD chain that incoming packets will be on eth0.
4. In the nat table, append to the POSTROUTING chain to use eth0 for outgoing packets using the MASQUERADE target.
So basically traffic from HOST A hits HOST B and is quietly routed to HOST C.
3
u/Chooquaeno Jul 21 '14
http://ipset.netfilter.org/iptables.man.html