Last active
February 16, 2020 03:23
-
-
Save qskwood/32e86389e31f70be7285c288b6634237 to your computer and use it in GitHub Desktop.
These scripts add and remove IPv4 forwarding and NAT from a Linux bridge while still allowing it to be managed by Proxmox.
This file contains 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
Place each file in /etc/network/if-up.d/ or /etc/network/if-down.d/ as appropriate, mark as executable, and name whatever you want. |
This file contains 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 -e | |
# /etc/network/if-down.d/vmbr1 | |
if [[ $IFACE == "vmbr1" ]]; then | |
echo 0 > /proc/sys/net/ipv4/ip_forward | |
iptables -t nat -D POSTROUTING -s '10.0.0.0/8' -o vmbr0 -j MASQUERADE | |
fi |
This file contains 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 -e | |
# /etc/network/if-up.d/vmbr1 | |
if [[ $IFACE == "vmbr1" ]]; then | |
echo 1 > /proc/sys/net/ipv4/ip_forward | |
iptables -t nat -A POSTROUTING -s '10.0.0.0/8' -o vmbr0 -j MASQUERADE | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment