iptables pocket reference
iptables -L lists all rules
iptables -S [chain] shows the commands that build the rules of the chain.
iptables -D [rule index or rule details] deletes a particular chain.
NAT
iptables -L -t nat lists all NAT rules.
Replace source private IP to a public one, then when reply comes back, replace the associated destination public IP back to the private one.
iptables -t nat -A POSTROUTING -s 192.168.128.4 -j SNAT --to-source 10.247.65.43
iptables -t nat -A PREROUTNG -d 10.247.65.43/32 -j DNAT --to-destination 192.168.128.4
Replacing rules
iptables -R INPUT 1 -p tcp -s 192.168.0.0/24 --dport 80 -j ACCEPT
Save modified iptables
service iptables save
Reference
Reference 2
iptables -S [chain] shows the commands that build the rules of the chain.
iptables -D [rule index or rule details] deletes a particular chain.
NAT
iptables -L -t nat lists all NAT rules.
Replace source private IP to a public one, then when reply comes back, replace the associated destination public IP back to the private one.
iptables -t nat -A POSTROUTING -s 192.168.128.4 -j SNAT --to-source 10.247.65.43
iptables -t nat -A PREROUTNG -d 10.247.65.43/32 -j DNAT --to-destination 192.168.128.4
Replacing rules
iptables -R INPUT 1 -p tcp -s 192.168.0.0/24 --dport 80 -j ACCEPT
Save modified iptables
service iptables save
Reference
Reference 2
Comments
Post a Comment