Created
September 26, 2021 17:54
-
-
Save geoangelotti/8ca77d0d45aa31ae2f3cbd5af0fb7864 to your computer and use it in GitHub Desktop.
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 | |
echo "Enabling ipv4 forwarding (cleaning old rules)" | |
# flushing old rules -- USE WITH CARE | |
iptables --flush | |
iptables --table nat --flush | |
# MASQUERADE each request form the inside to the outer world | |
iptables -t nat -A POSTROUTING -j MASQUERADE | |
# enable IPv4 packet forwarding in the kernel | |
echo 1 > /proc/sys/net/ipv4/ip_forward | |
echo "Master is not operating as router" |
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 | |
ENDPOINT_INTERFACE=$(cat /etc/hosts | grep master | awk '{print $1}') | |
route add default gw $ENDPOINT_INTERFACE | |
echo "Gateway now points to $ENDPOINT_INTERFACE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment