Wednesday, April 11, 2018

To add/delete a NAT rule


# To add a rule

// you are listening on a server @ and want to expose to ouside.
// you can add a rule as below.
// now anyone accessing YOUR_NODE_IP_ADDRESS:8443 will be redirected to
iptables -t nat -A PREROUTING -p tcp --dport 8443 -j DNAT --to-destination

# To delete a RULE

// This will list according to groups like PREROUTING , INPUT, OUTPUT, POSTROUTING , etc.,
iptables -t nat -L --line-numbers

// to delete a specific rule
iptables -t nat -D PREROUTING <number>

// For example, here to delete third rule
iptables -t nat -D PREROUTING 3


No comments:

Post a Comment