Skip to content

Instantly share code, notes, and snippets.

@andikurnia
Created June 3, 2025 08:02
Show Gist options
  • Select an option

  • Save andikurnia/cc0257d33d442c8688186879bf323dff to your computer and use it in GitHub Desktop.

Select an option

Save andikurnia/cc0257d33d442c8688186879bf323dff to your computer and use it in GitHub Desktop.
Linux iptables configuration for communicate two interfaces
#!/bin/bash
iptables -t nat -A POSTROUTING -o <iface1> -j MASQUERADE
iptables -A FORWARD -i <iface1> -o <iface2> -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i <iface2> -o <iface1> -j ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment