I would like to remove some NAT POSTROUTING rules in an automated fashion based on the source or destination IP address.
I know the source and destination IP but I don't necessarily know which policies are already there.
For example, I may have this:
-A POSTROUTING -s 10.10.10.10/32 -p tcp -m tcp --dport 80 -j SNAT --to-source 1.2.3.4
-A POSTROUTING -s 10.10.10.10/32 -p tcp -m tcp --dport 443 -j SNAT --to-source 1.2.3.4
-A POSTROUTING -s 10.10.10.10/32 -j ACCEPT
or I may just have this:
-A POSTROUTING -s 10.10.10.10/32 -j SNAT --to-source 1.2.3.4
I want to unassign that NAT address from the old computer and assign it to a new computer. This is all automated so I can't manually look for it.
What's the best way to remove the old polices for just that IP? Could I use a list + grep command? I normally hang out in the Windows world so I'm not sure the best way to handle this here.