Created
February 17, 2021 14:27
-
-
Save Xachman/5689d13cdbf0a686b08917778b78900c to your computer and use it in GitHub Desktop.
Create a simple nat using interfaces created by services like Nebula or Zerotier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
INTERFACE=ens5 | |
NINTERFACE=nebula1 | |
sudo iptables -t nat -A POSTROUTING -o $INTERFACE -j MASQUERADE | |
sudo iptables -A FORWARD -i $INTERFACE -o $NINTERFACE -m state --state RELATED,ESTABLISHED -j ACCEPT | |
sudo iptables -A FORWARD -i $NINTERFACE -o $INTERFACE -j ACCEPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use this when it is necessary to gain access to an interface and subnet behind a node on Nebula or Zerotier. This needs to be used in combination with
net.ipv4.ip_forward = 1
on linux systems.