Answer the question
In order to leave comments, you need to log in
How to change iptables rule?
Colleagues, please help me change the rule
SNAT all -- 10.8.0.0/24 !10.8.0.0/24 to:XXXX
to
SNAT all -- 10.8.0.0/24 !10.8.0.0/24 to:YYYY
# iptables --table nat --list
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
SNAT all -- 10.8.0.0/24 !10.8.0.0/24 to:X.X.X.X
MASQUERADE all -- 192.168.2.0/24 anywhere
Answer the question
In order to leave comments, you need to log in
iptables -t nat -D POSTROUTING 1
iptables -t nat -I POSTROUTING -p all -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to-source Y.Y.Y.Y
iptables-save -f rules.v4
vi rules.v4
iptables-restore rules.v4
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question