iptables,  Linux

IPTables tips

Some tips for iptables

 

  • Listing nat rules
iptables -t nat -v -L POSTROUTING -n --line-number
  • Delete a certain rule

iptables -t nat -D POSTROUTING

(from https://www.cyberciti.biz/faq/how-to-iptables-delete-postrouting-rule/ )

  • Create a rule to redirect outgoing packets for a certain IP/port
iptables -t nat -A PREROUTING -p tcp -d OLD_IP --dport 80 -j NETMAP --to NEW_IP

(from https://linux-tips.com/t/rewriting-destination-ip-address/221)