Last active
September 3, 2021 14:55
-
-
Save LQ80/7318c725623914bcfb32ac898fb6111f to your computer and use it in GitHub Desktop.
iptables forward
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
echo 1 > /proc/sys/net/ipv4/ip_forward | |
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/24 -j MASQUERADE | |
iptables -t nat -A PREROUTING -i eth0 -d 192.168.1.36 -p tcp --dport 8080 -j DNAT --to-destination 192.168.0.36:80 | |
Other Commands: | |
=============== | |
iptables -F | |
iptables -F -t nat | |
iptables -S | |
iptables -L | |
iptables -L -t nat | |
https://wiki.alpinelinux.org/wiki/Configure_Networking#Install_iptables.2Fip6tables | |
==================================================================================================== | |
==================================================================================================== | |
==================================================================================================== | |
echo 0 > /proc/sys/net/ipv4/ip_forward | |
iptables -P INPUT ACCEPT | |
iptables -P OUTPUT ACCEPT | |
iptables -P FORWARD DROP | |
iptables -A FORWARD -i eth1 -o eth0 -s 192.168.0.0/24 -j ACCEPT | |
iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 80 -j ACCEPT | |
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination 192.168.0.36 | |
echo 1 > /proc/sys/net/ipv4/ip_forward | |
rc-update add iptables | |
/etc/init.d/iptables save | |
/etc/init.d/networking restart | |
http://linux-training.be/networking/ch14.html | |
https://wiki.alpinelinux.org/wiki/Configure_Networking |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment