0

How use firewalld-cmd use iptables rule?

iptables:

iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
Bence Kaulics
  • 7,066
  • 7
  • 33
  • 63
user2930390
  • 159
  • 1
  • 1
  • 8

2 Answers2

1

firewall-cmd --permanent --direct --add-rule ipv4 filter POSTROUTING 0 -t nat -s 10.8.0.0/24 -o eth0 -j MASQUERADE

POSTROUTING 0 means high priority whthout --permanent it just works before reboot

Varint
  • 11
  • 3
0

The Varint's command after the firewalld reload will cause a syntax issue. This command worked for me: firewall-cmd --permanent --direct --add-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 -o eth0 -j MASQUERADE

  • 1
    The question is not on-topic for Stack Overflow as defined in the [help]. Please don't answer such questions; instead, you should flag them for attention and they will be closed or migrated appropriately. – Toby Speight Feb 12 '20 at 18:11