Last active
February 27, 2022 17:23
-
-
Save SanariSan/ed2126bc29a170f595da927df9be856d 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
https://wiki.merionet.ru/servernye-resheniya/14/pogruzhenie-v-iptables-teoriya-i-nastrojka/ | |
https://losst.ru/nastrojka-iptables-dlya-chajnikov | |
https://linuxconfig.org/how-to-turn-on-off-ip-forwarding-in-linux | |
https://help.ubuntu.com/community/IptablesHowTo | |
# for rerouting | |
cat /proc/sys/net/ipv4/ip_forward | |
echo 1 >/proc/sys/net/ipv4/ip_forward | |
sudo sysctl -w net.ipv4.ip_forward=1 | |
# list | |
iptables -L -v | |
iptables -nLv INPUT/OUTPUT/FORWARD -t filter/nat/ | |
# Reject all incoming tcp requests | |
iptables -t filter -A INPUT -p tcp --dport 0:9999 -j DROP | |
# Reroute all incoming requests on port 80 to internal lan ip:port | |
iptables -t nat -A PREROUTING -i enp0s3 -p tcp --dport 80 -j DNAT --to 192.168.2.19:80 | |
# Reroute all outcoming requests from port 80 to internal lan ip:port | |
iptables -t nat -A POSTROUTING -i enp0s3 -p tcp --dport 80 -j SNAT --to 192.168.2.19:80 | |
UFW | |
ufw allow 80 | |
ufw deny 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment