# Generated by iptables-save v1.8.7 on Sat Jul 15 15:40:55 2023
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [1:136]
:bad_packets - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A INPUT -j bad_packets
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m state --state INVALID -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -i eth2 -p tcp -m tcp --dport 1565 -j ACCEPT
-A INPUT -i eth2 -p udp -m udp --dport 500 -j ACCEPT
-A INPUT -i eth2 -p udp -m udp --dport 4500 -j ACCEPT
-A INPUT -p udp -m udp --dport 500 -j ACCEPT
-A INPUT -p esp -j ACCEPT
-A INPUT -p ah -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i eth1 -p udp -m udp --dport 53 -j ACCEPT
-A FORWARD -d 10.0.0.4/32 -i eth2 -o eth1 -p tcp -m tcp --dport 9889 -j ACCEPT
-A FORWARD -d 10.0.0.5/32 -i eth2 -o eth1 -p tcp -m tcp --dport 80 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 8448 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 443 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 80 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 1567 -j ACCEPT
-A FORWARD -d 10.0.0.2/32 -i eth2 -o eth1 -p tcp -m tcp --dport 1566 -j ACCEPT
-A FORWARD -s 10.0.0.0/24 -d 20.0.0.0/24 -j ACCEPT
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -j bad_packets
-A FORWARD -i eth2 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -m state --state INVALID -j DROP
-A FORWARD -i eth1 -o eth2 -j ACCEPT
-A FORWARD -s 10.0.0.0/24 -d 20.0.0.0/24 -j ACCEPT
-A FORWARD -s 20.0.0.0/24 -d 10.0.0.0/24 -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o eth1 -j ACCEPT
-A OUTPUT -j bad_packets
-A OUTPUT -o eth2 -j ACCEPT
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A bad_packets -s 172.16.0.0/12 -i eth2 -j DROP
-A bad_packets -s 192.160.0.0/12 -i eth2 -j DROP
-A bad_packets -s 127.0.0.0/8 -i eth2 -j DROP
-A bad_packets -s 0.0.0.0/8 -i eth2 -j DROP
-A bad_packets -s 169.254.0.0/16 -i eth2 -j DROP
-A bad_packets -s 192.0.2.0/24 -i eth2 -j DROP
-A bad_packets -s 204.152.64.0/23 -i eth2 -j DROP
-A bad_packets -s 224.0.0.0/3 -i eth2 -j DROP
-A bad_packets -s 240.0.0.0/5 -i eth2 -j DROP
COMMIT
# Completed on Sat Jul 15 15:40:55 2023
# Generated by iptables-save v1.8.7 on Sat Jul 15 15:40:55 2023
*nat
:PREROUTING ACCEPT [1856:127192]
:INPUT ACCEPT [657:38053]
:OUTPUT ACCEPT [332:26041]
:POSTROUTING ACCEPT [870:52681]
-A PREROUTING -d 5.61.15.44/32 -i eth2 -j ACCEPT
-A PREROUTING -d 10.0.0.0/24 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3129
-A PREROUTING -d 10.0.0.0/24 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 3130
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 6651 -j DNAT --to-destination 10.0.0.2:1566
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 7651 -j DNAT --to-destination 10.0.0.3:1567
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.0.0.3:80
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 443 -j DNAT --to-destination 10.0.0.3:443
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 8448 -j DNAT --to-destination 10.0.0.3:8448
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 8888 -j DNAT --to-destination 10.0.0.5:80
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 9889 -j DNAT --to-destination 10.0.0.4:9889
-A POSTROUTING -s 195.209.130.9/32 -o eth2 -j SNAT --to-source 10.0.0.10
-A POSTROUTING -s 10.0.0.0/24 ! -d 20.0.0.0/24 -o eth2 -j MASQUERADE
-A POSTROUTING -d 10.0.0.2/32 -p tcp -m tcp --sport 1566 -j SNAT --to-source 1.1.1.1:6651
-A POSTROUTING -d 10.0.0.3/32 -p tcp -m tcp --sport 1567 -j SNAT --to-source 1.1.1.1:6651
-A POSTROUTING -d 10.0.0.3/32 -p tcp -m tcp --sport 80 -j SNAT --to-source 1.1.1.1:80
-A POSTROUTING -d 10.0.0.3/32 -p tcp -m tcp --sport 443 -j SNAT --to-source 1.1.1.1:443
-A POSTROUTING -d 10.0.0.3/32 -p tcp -m tcp --sport 8448 -j SNAT --to-source 1.1.1.1:8448
-A POSTROUTING -d 10.0.0.5/32 -p tcp -m tcp --sport 80 -j SNAT --to-source 1.1.1.1:8888
-A POSTROUTING -d 10.0.0.4/32 -p tcp -m tcp --sport 9889 -j SNAT --to-source 1.1.1.1:9889
COMMIT
# Completed on Sat Jul 15 15:40:55 2023
# Generated by iptables-save v1.8.9 (nf_tables) on Sat Jul 15 15:40:52 2023
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [1:136]
:bad_packets - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A INPUT -j bad_packets
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m state --state INVALID -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -i eth0 -p tcp -m tcp --dport 1565 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 500 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 4500 -j ACCEPT
-A INPUT -p udp -m udp --dport 500 -j ACCEPT
-A INPUT -p esp -j ACCEPT
-A INPUT -p ah -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i eth1 -p udp -m udp --dport 53 -j ACCEPT
-A FORWARD -s 20.0.0.0/24 -d 10.0.0.0/24 -j ACCEPT
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -j bad_packets
-A FORWARD -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -m state --state INVALID -j DROP
-A FORWARD -i eth1 -o eth0 -j ACCEPT
-A FORWARD -s 20.0.0.0/24 -d 10.0.0.0/24 -j ACCEPT
-A FORWARD -s 10.0.0.0/24 -d 20.0.0.0/24 -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o eth1 -j ACCEPT
-A OUTPUT -j bad_packets
-A OUTPUT -o eth0 -j ACCEPT
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A bad_packets -s 172.16.0.0/12 -i eth0 -j DROP
-A bad_packets -s 192.160.0.0/12 -i eth0 -j DROP
-A bad_packets -s 127.0.0.0/8 -i eth0 -j DROP
-A bad_packets -s 0.0.0.0/8 -i eth0 -j DROP
-A bad_packets -s 169.254.0.0/16 -i eth0 -j DROP
-A bad_packets -s 192.0.2.0/24 -i eth0 -j DROP
-A bad_packets -s 204.152.64.0/23 -i eth0 -j DROP
-A bad_packets -s 224.0.0.0/3 -i eth0 -j DROP
-A bad_packets -s 240.0.0.0/5 -i eth0 -j DROP
COMMIT
# Completed on Sat Jul 15 15:40:52 2023
# Generated by iptables-save v1.8.9 (nf_tables) on Sat Jul 15 15:40:52 2023
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -d 5.61.15.44/32 -i eth0 -j ACCEPT
-A PREROUTING -d 20.0.0.0/24 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3129
-A PREROUTING -d 20.0.0.0/24 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 3130
-A POSTROUTING -s 20.0.0.0/24 ! -d 10.0.0.0/24 -o eth0 -j MASQUERADE
COMMIT
# Completed on Sat Jul 15 15:40:52 2023
# Generated by iptables-save v1.8.7 on Sat Jul 15 14:04:25 2023
*filter
:INPUT DROP [1:40]
:FORWARD DROP [85:5848]
:OUTPUT DROP [1:136]
:bad_packets - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A INPUT -j bad_packets
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m state --state INVALID -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -i eth2 -p tcp -m tcp --dport 1565 -j ACCEPT
-A INPUT -p udp -m udp --dport 500 -j ACCEPT
-A INPUT -p esp -j ACCEPT
-A INPUT -p ah -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i eth1 -p udp -m udp --dport 53 -j ACCEPT
-A FORWARD -d 10.0.0.4/32 -i eth2 -o eth1 -p tcp -m tcp --dport 9889 -j ACCEPT
-A FORWARD -d 10.0.0.5/32 -i eth2 -o eth1 -p tcp -m tcp --dport 80 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 8448 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 443 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 80 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 1567 -j ACCEPT
-A FORWARD -d 10.0.0.2/32 -i eth2 -o eth1 -p tcp -m tcp --dport 1566 -j ACCEPT
-A FORWARD -s 10.0.0.0/24 -d 20.0.0.0/24 -j ACCEPT
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -j bad_packets
-A FORWARD -i eth2 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -m state --state INVALID -j DROP
-A FORWARD -i eth1 -o eth2 -j ACCEPT
-A FORWARD -s 10.0.0.0/24 -d 20.0.0.0/24 -j ACCEPT
-A FORWARD -s 20.0.0.0/24 -d 10.0.0.0/24 -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o eth1 -j ACCEPT
-A OUTPUT -j bad_packets
-A OUTPUT -o eth2 -j ACCEPT
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A bad_packets -s 172.16.0.0/12 -i eth2 -j DROP
-A bad_packets -s 192.160.0.0/12 -i eth2 -j DROP
-A bad_packets -s 127.0.0.0/8 -i eth2 -j DROP
-A bad_packets -s 0.0.0.0/8 -i eth2 -j DROP
-A bad_packets -s 169.254.0.0/16 -i eth2 -j DROP
-A bad_packets -s 192.0.2.0/24 -i eth2 -j DROP
-A bad_packets -s 204.152.64.0/23 -i eth2 -j DROP
-A bad_packets -s 224.0.0.0/3 -i eth2 -j DROP
-A bad_packets -s 240.0.0.0/5 -i eth2 -j DROP
COMMIT
# Completed on Sat Jul 15 14:04:25 2023
# Generated by iptables-save v1.8.7 on Sat Jul 15 14:04:25 2023
*nat
:PREROUTING ACCEPT [272945:21897800]
:INPUT ACCEPT [104781:6000567]
:OUTPUT ACCEPT [47658:3788460]
:POSTROUTING ACCEPT [132954:8007024]
-A PREROUTING -d 5.61.15.44/32 -i eth2 -j ACCEPT
-A PREROUTING -d 10.0.0.0/24 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3129
-A PREROUTING -d 10.0.0.0/24 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 3130
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 6651 -j DNAT --to-destination 10.0.0.2:1566
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 7651 -j DNAT --to-destination 10.0.0.3:1567
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.0.0.3:80
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 443 -j DNAT --to-destination 10.0.0.3:443
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 8448 -j DNAT --to-destination 10.0.0.3:8448
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 8888 -j DNAT --to-destination 10.0.0.5:80
-A PREROUTING -d 1.1.1.1/32 -p tcp -m tcp --dport 9889 -j DNAT --to-destination 10.0.0.4:9889
-A POSTROUTING -s 195.209.130.9/32 -o eth2 -j SNAT --to-source 10.0.0.10
-A POSTROUTING -s 10.0.0.0/24 ! -d 20.0.0.0/24 -o eth2 -j MASQUERADE
-A POSTROUTING -d 10.0.0.2/32 -p tcp -m tcp --sport 1566 -j SNAT --to-source 1.1.1.1:6651
-A POSTROUTING -d 10.0.0.3/32 -p tcp -m tcp --sport 1567 -j SNAT --to-source 1.1.1.1:6651
-A POSTROUTING -d 10.0.0.3/32 -p tcp -m tcp --sport 80 -j SNAT --to-source 1.1.1.1:80
-A POSTROUTING -d 10.0.0.3/32 -p tcp -m tcp --sport 443 -j SNAT --to-source 1.1.1.1:443
-A POSTROUTING -d 10.0.0.3/32 -p tcp -m tcp --sport 8448 -j SNAT --to-source 1.1.1.1:8448
-A POSTROUTING -d 10.0.0.5/32 -p tcp -m tcp --sport 80 -j SNAT --to-source 1.1.1.1:8888
-A POSTROUTING -d 10.0.0.4/32 -p tcp -m tcp --sport 9889 -j SNAT --to-source 1.1.1.1:9889
COMMIT
# Completed on Sat Jul 15 14:04:25 2023
gateway-bm:/etc# ping 10.0.0.12
PING 10.0.0.12 (10.0.0.12) 56(84) bytes of data.
# Generated by iptables-save v1.8.9 (nf_tables) on Sat Jul 15 14:04:21 2023
*filter
:INPUT DROP [1:152]
:FORWARD DROP [128:10752]
:OUTPUT DROP [1:136]
:bad_packets - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A INPUT -j bad_packets
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m state --state INVALID -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -i eth0 -p tcp -m tcp --dport 1565 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 500 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 4500 -j ACCEPT
-A INPUT -p udp -m udp --dport 500 -j ACCEPT
-A INPUT -p esp -j ACCEPT
-A INPUT -p ah -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i eth1 -p udp -m udp --dport 53 -j ACCEPT
-A FORWARD -s 20.0.0.0/24 -d 10.0.0.0/24 -j ACCEPT
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -j bad_packets
-A FORWARD -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -m state --state INVALID -j DROP
-A FORWARD -i eth1 -o eth0 -j ACCEPT
-A FORWARD -s 20.0.0.0/24 -d 10.0.0.0/24 -j ACCEPT
-A FORWARD -s 10.0.0.0/24 -d 20.0.0.0/24 -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o eth1 -j ACCEPT
-A OUTPUT -j bad_packets
-A OUTPUT -o eth0 -j ACCEPT
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A bad_packets -s 172.16.0.0/12 -i eth0 -j DROP
-A bad_packets -s 192.160.0.0/12 -i eth0 -j DROP
-A bad_packets -s 127.0.0.0/8 -i eth0 -j DROP
-A bad_packets -s 0.0.0.0/8 -i eth0 -j DROP
-A bad_packets -s 169.254.0.0/16 -i eth0 -j DROP
-A bad_packets -s 192.0.2.0/24 -i eth0 -j DROP
-A bad_packets -s 204.152.64.0/23 -i eth0 -j DROP
-A bad_packets -s 224.0.0.0/3 -i eth0 -j DROP
-A bad_packets -s 240.0.0.0/5 -i eth0 -j DROP
COMMIT
# Completed on Sat Jul 15 14:04:21 2023
# Generated by iptables-save v1.8.9 (nf_tables) on Sat Jul 15 14:04:21 2023
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -d 5.61.15.44/32 -i eth0 -j ACCEPT
-A PREROUTING -d 20.0.0.0/24 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3129
-A PREROUTING -d 20.0.0.0/24 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 3130
COMMIT
# Completed on Sat Jul 15 14:04:21 2023
ping 20.0.0.10
PING 20.0.0.10 (20.0.0.10) 56(84) bytes of data.
From 20.0.0.1 icmp_seq=511 Destination Host Unreachable
From 20.0.0.1 icmp_seq=512 Destination Host Unreachable
From 20.0.0.1 icmp_seq=513 Destination Host Unreachable
#!/bin/bash
# allow forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward
#echo "1" > /proc/sys/net/ipv4/ip_dynaddr
modprobe iptable_nat
export IPT="iptables"
# Внешний интерфейс
export WAN=eth2
export WAN_IP=1.1.1.1
# Локальная сеть
export LAN=eth1
export LAN_IP_RANGE=10.0.0.0/24
export LAN_BUM_RANGE=20.0.0.0/24
# Очищаем правила
$IPT -F
$IPT -F -t nat
$IPT -F -t mangle
$IPT -X
$IPT -t nat -X
$IPT -t mangle -X
# Разрешаем localhost и локалку
$IPT -A INPUT -i lo -j ACCEPT
$IPT -A INPUT -i $LAN -j ACCEPT
$IPT -A OUTPUT -o lo -j ACCEPT
$IPT -A OUTPUT -o $LAN -j ACCEPT
# Запрещаем все, что не разрешено
$IPT -P INPUT DROP
$IPT -P OUTPUT DROP
$IPT -P FORWARD DROP
# PROTECT FIREWALL
# Мы защищаем наш сервер от атак, когда из внешней сети пытаются "прикинуться" внутренними адресами
$IPT -N bad_packets
$IPT -P bad_packets ACCEPT
$IPT -A bad_packets -i $WAN -s 10.0.0.0/8 -j DROP
$IPT -A bad_packets -i $WAN -s 172.16.0.0/12 -j DROP
$IPT -A bad_packets -i $WAN -s 192.168.0.0/12 -j DROP
$IPT -A bad_packets -i $WAN -s 127.0.0.0/8 -j DROP
$IPT -A bad_packets -i $WAN -s 0.0.0.0/8 -j DROP
$IPT -A bad_packets -i $WAN -s 169.254.0.0/16 -j DROP
$IPT -A bad_packets -i $WAN -s 192.0.2.0/24 -j DROP
$IPT -A bad_packets -i $WAN -s 204.152.64.0/23 -j DROP
$IPT -A bad_packets -i $WAN -s 224.0.0.0/3 -j DROP
$IPT -A bad_packets -i $WAN -s 240.0.0.0/5 -j DROP
$IPT -A INPUT -j bad_packets
$IPT -A OUTPUT -j bad_packets
$IPT -A FORWARD -j bad_packets
# Рзрешаем пинги
$IPT -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT
$IPT -A INPUT -p icmp --icmp-type destination-unreachable -j ACCEPT
$IPT -A INPUT -p icmp --icmp-type time-exceeded -j ACCEPT
$IPT -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
# Разрешаем все исходящие подключения сервера
$IPT -A OUTPUT -o $WAN -j ACCEPT
# Разрешаем все входящие подключения сервера
#$IPT -A INPUT -i $WAN -j ACCEPT
# разрешаем установленные соединения
$IPT -A INPUT -p all -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A OUTPUT -p all -m state --state ESTABLISHED,RELATED -j ACCEPT
#$IPT -A FORWARD -p all -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A FORWARD -i $WAN -p all -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A FORWARD -i $LAN -p all -j ACCEPT
# Включаем фрагментацию пакетов. Необходимо из за разных значений MTU
$IPT -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
# Отбрасываем неопознанные пакеты
$IPT -A INPUT -m state --state INVALID -j DROP
$IPT -A FORWARD -m state --state INVALID -j DROP
# Отбрасываем нулевые пакеты
$IPT -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
# Закрываемся от syn-flood атак
$IPT -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
$IPT -A OUTPUT -p tcp ! --syn -m state --state NEW -j DROP
#Разрешаем посещать Кодекс в обход SQUID
$IPT -t nat -I PREROUTING -d 5.61.15.44 -i $WAN -j ACCEPT
$IPT -t nat -A POSTROUTING -o $WAN -s 195.209.130.9 -j SNAT --to 10.0.0.10
# Разрешаем доступ из локалки наружу
$IPT -A FORWARD -i $LAN -o $WAN -j ACCEPT
#$IPT -I FORWARD -s 46.32.72.84 -j ACCEPT
# Закрываем доступ снаружи в локалку
$IPT -A FORWARD -i $WAN -o $LAN -j REJECT
#IPSec <-----
$IPT -t nat -A POSTROUTING -s $LAN_IP_RANGE ! -d $LAN_BUM_RANGE -o $WAN -j MASQUERADE
#-----> IPSec
# Разрешаем порты
#SSH
$IPT -A INPUT -i $WAN -p tcp --dport 1565 -j ACCEPT
#IPSec <-----
$IPT -A INPUT -p udp -m udp --dport 500 -j ACCEPT
$IPT -A INPUT -p esp -j ACCEPT
$IPT -A INPUT -p ah -j ACCEPT
$IPT -I FORWARD -s $LAN_IP_RANGE -d $LAN_BUM_RANGE -j ACCEPT
#-----> IPSec
$IPT -A INPUT -i $LAN -p tcp --dport 67 -j ACCEPT
$IPT -A INPUT -i $LAN -p tcp --dport 53 -j ACCEPT
$IPT -A INPUT -i $LAN -p udp --dport 53 -j ACCEPT
$IPT -A INPUT -i $WLAN -p tcp --dport 53 -j ACCEPT
$IPT -A INPUT -i $WLAN -p udp --dport 53 -j ACCEPT
#SQUID
$IPT -t nat -A PREROUTING -p tcp -d $LAN_IP_RANGE --dport 80 -j REDIRECT --to-port 3129
$IPT -t nat -A PREROUTING -p tcp -d $LAN_IP_RANGE --dport 443 -j REDIRECT --to-port 3130
#SAMBA-сервер (6651 - фейковый порт от 1566)
$IPT -t nat -A PREROUTING -p tcp -d $WAN_IP --dport 6651 -j DNAT --to-destination $SAMBASRV:1566
$IPT -I FORWARD 1 -i $WAN -o $LAN -d $SAMBASRV -p tcp -m tcp --dport 1566 -j ACCEPT
$IPT -t nat -A POSTROUTING -p tcp --sport 1566 --dst $SAMBASRV -j SNAT --to-source $WAN_IP:6651
# Сохраняем правила
/sbin/iptables-save > /etc/iptables.rules
route -n
$IPT -L
$IPT -L -v -n
$IPT -L -v -n -t nat--
#!/bin/bash
# allow forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward
#echo "1" > /proc/sys/net/ipv4/ip_dynaddr
modprobe iptable_nat
export IPT="iptables"
# Внешний интерфейс
export WAN=eth0
export WAN_IP=2.2.2.2
# Локальная сеть
export LAN=eth1
export LAN_IP_RANGE=20.0.0.0/24
export LAN_PT_RANGE=10.0.0.0/24
# Очищаем правила
$IPT -F
$IPT -F -t nat
$IPT -F -t mangle
$IPT -X
$IPT -t nat -X
$IPT -t mangle -X
# Разрешаем localhost и локалку
$IPT -A INPUT -i lo -j ACCEPT
$IPT -A INPUT -i $LAN -j ACCEPT
$IPT -A OUTPUT -o lo -j ACCEPT
$IPT -A OUTPUT -o $LAN -j ACCEPT
# Запрещаем все, что не разрешено
$IPT -P INPUT DROP
$IPT -P OUTPUT DROP
$IPT -P FORWARD DROP
# PROTECT FIREWALL
# Мы защищаем наш сервер от атак, когда из внешней сети пытаются "прикинуться" внутренними адресами
$IPT -N bad_packets
$IPT -P bad_packets ACCEPT
$IPT -A bad_packets -i $WAN -s 20.0.0.0/8 -j DROP
$IPT -A bad_packets -i $WAN -s 172.16.0.0/12 -j DROP
$IPT -A bad_packets -i $WAN -s 192.168.0.0/12 -j DROP
$IPT -A bad_packets -i $WAN -s 127.0.0.0/8 -j DROP
$IPT -A bad_packets -i $WAN -s 0.0.0.0/8 -j DROP
$IPT -A bad_packets -i $WAN -s 169.254.0.0/16 -j DROP
$IPT -A bad_packets -i $WAN -s 192.0.2.0/24 -j DROP
$IPT -A bad_packets -i $WAN -s 204.152.64.0/23 -j DROP
$IPT -A bad_packets -i $WAN -s 224.0.0.0/3 -j DROP
$IPT -A bad_packets -i $WAN -s 240.0.0.0/5 -j DROP
$IPT -A INPUT -j bad_packets
$IPT -A OUTPUT -j bad_packets
$IPT -A FORWARD -j bad_packets
# Рзрешаем пинги
$IPT -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT
$IPT -A INPUT -p icmp --icmp-type destination-unreachable -j ACCEPT
$IPT -A INPUT -p icmp --icmp-type time-exceeded -j ACCEPT
$IPT -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
# Разрешаем все исходящие подключения сервера
$IPT -A OUTPUT -o $WAN -j ACCEPT
# Разрешаем все входящие подключения сервера
#$IPT -A INPUT -i $WAN -j ACCEPT
# разрешаем установленные соединения
$IPT -A INPUT -p all -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A OUTPUT -p all -m state --state ESTABLISHED,RELATED -j ACCEPT
#$IPT -A FORWARD -p all -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A FORWARD -i $WAN -p all -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A FORWARD -i $LAN -p all -j ACCEPT
# Включаем фрагментацию пакетов. Необходимо из за разных значений MTU
$IPT -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
# Отбрасываем неопознанные пакеты
$IPT -A INPUT -m state --state INVALID -j DROP
$IPT -A FORWARD -m state --state INVALID -j DROP
# Отбрасываем нулевые пакеты
$IPT -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
# Закрываемся от syn-flood атак
$IPT -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
$IPT -A OUTPUT -p tcp ! --syn -m state --state NEW -j DROP
#Разрешаем посещать Кодекс в обход SQUID
$IPT -t nat -I PREROUTING -d 5.61.15.44 -i $WAN -j ACCEPT
# Разрешаем доступ из локалки наружу
$IPT -A FORWARD -i $LAN -o $WAN -j ACCEPT
#$IPT -I FORWARD -s 77.244.20.253 -j ACCEPT
# Закрываем доступ снаружи в локалку
$IPT -A FORWARD -i $WAN -o $LAN -j REJECT
#IPSec <-----
$IPT -A POSTROUTING -s $LAN_IP_RANGE ! -d $LAN_PT_RANGE -o $WAN -j MASQUERADE
#-----> IPSec
# Разрешаем порты
#SSH
$IPT -A INPUT -i $WAN -p tcp --dport 1565 -j ACCEPT
$IPT -A INPUT -i $WAN -p udp --dport 500 -j ACCEPT
$IPT -A INPUT -i $WAN -p udp --dport 4500 -j ACCEPT
#IPSec <-----
$IPT -A INPUT -p udp -m udp --dport 500 -j ACCEPT
$IPT -A INPUT -p esp -j ACCEPT
$IPT -A INPUT -p ah -j ACCEPT
$IPT -I FORWARD -s $LAN_IP_RANGE -d $LAN_PT_RANGE -j ACCEPT
#-----> IPSec
$IPT -A INPUT -i $LAN -p tcp --dport 67 -j ACCEPT
$IPT -A INPUT -i $LAN -p tcp --dport 53 -j ACCEPT
$IPT -A INPUT -i $LAN -p udp --dport 53 -j ACCEPT
$IPT -A INPUT -i $WLAN -p tcp --dport 53 -j ACCEPT
$IPT -A INPUT -i $WLAN -p udp --dport 53 -j ACCEPT
#SQUID
$IPT -t nat -A PREROUTING -p tcp -d $LAN_IP_RANGE --dport 80 -j REDIRECT --to-port 3129
$IPT -t nat -A PREROUTING -p tcp -d $LAN_IP_RANGE --dport 443 -j REDIRECT --to-port 3130
# Сохраняем правила
/sbin/iptables-save > /etc/iptables.rules
route -n
$IPT -L
$IPT -L -v -n
$IPT -L -v -n -t nat--
# Generated by iptables-save v1.8.7 on Fri Jul 14 17:39:06 2023
*filter
:INPUT DROP [1:40]
:FORWARD DROP [0:0]
:OUTPUT DROP [1:136]
:bad_packets - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A INPUT -j bad_packets
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m state --state INVALID -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -i eth2 -p tcp -m tcp --dport 1565 -j ACCEPT
-A INPUT -p udp -m udp --dport 500 -j ACCEPT
-A INPUT -p esp -j ACCEPT
-A INPUT -p ah -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i eth1 -p udp -m udp --dport 53 -j ACCEPT
-A FORWARD -d 10.0.0.4/32 -i eth2 -o eth1 -p tcp -m tcp --dport 9889 -j ACCEPT
-A FORWARD -d 10.0.0.5/32 -i eth2 -o eth1 -p tcp -m tcp --dport 80 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 8448 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 443 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 80 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 1567 -j ACCEPT
-A FORWARD -d 10.0.0.2/32 -i eth2 -o eth1 -p tcp -m tcp --dport 1566 -j ACCEPT
-A FORWARD -s 10.0.0.0/24 -d 20.0.0.0/24 -j ACCEPT
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -j bad_packets
-A FORWARD -i eth2 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -m state --state INVALID -j DROP
-A FORWARD -i eth1 -o eth2 -j ACCEPT
-A FORWARD -i eth2 -o eth1 -j REJECT --reject-with icmp-port-unreachable
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o eth1 -j ACCEPT
-A OUTPUT -j bad_packets
-A OUTPUT -o eth2 -j ACCEPT
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A bad_packets -s 10.0.0.0/8 -i eth2 -j DROP
-A bad_packets -s 172.16.0.0/12 -i eth2 -j DROP
-A bad_packets -s 192.160.0.0/12 -i eth2 -j DROP
-A bad_packets -s 127.0.0.0/8 -i eth2 -j DROP
-A bad_packets -s 0.0.0.0/8 -i eth2 -j DROP
-A bad_packets -s 169.254.0.0/16 -i eth2 -j DROP
-A bad_packets -s 192.0.2.0/24 -i eth2 -j DROP
-A bad_packets -s 204.152.64.0/23 -i eth2 -j DROP
-A bad_packets -s 224.0.0.0/3 -i eth2 -j DROP
-A bad_packets -s 240.0.0.0/5 -i eth2 -j DROP
COMMIT
# Completed on Fri Jul 14 17:39:06 2023
# Generated by iptables-save v1.8.7 on Fri Jul 14 17:39:06 2023
*nat
:PREROUTING ACCEPT [199553:16415974]
:INPUT ACCEPT [70793:4025175]
:OUTPUT ACCEPT [39682:3178821]
:POSTROUTING ACCEPT [100866:6214429]
-A PREROUTING -d 5.61.15.44/32 -i eth2 -j ACCEPT
-A PREROUTING -d 10.0.0.0/24 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3129
-A PREROUTING -d 10.0.0.0/24 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 3130
-A POSTROUTING -s 195.209.130.9/32 -o eth2 -j SNAT --to-source 10.0.0.10
-A POSTROUTING -s 10.0.0.0/24 ! -d 20.0.0.0/24 -o eth2 -j MASQUERADE
COMMIT
# Completed on Fri Jul 14 17:39:06 2023
# Generated by iptables-save v1.8.9 (nf_tables) on Fri Jul 14 17:42:49 2023
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [3:376]
:bad_packets - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A INPUT -j bad_packets
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m state --state INVALID -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -i eth0 -p tcp -m tcp --dport 1565 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 500 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 4500 -j ACCEPT
-A INPUT -p udp -m udp --dport 500 -j ACCEPT
-A INPUT -p esp -j ACCEPT
-A INPUT -p ah -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i eth1 -p udp -m udp --dport 53 -j ACCEPT
-A FORWARD -s 20.0.0.0/24 -d 10.0.0.0/24 -j ACCEPT
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -j bad_packets
-A FORWARD -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -m state --state INVALID -j DROP
-A FORWARD -i eth1 -o eth0 -j ACCEPT
-A FORWARD -i eth0 -o eth1 -j REJECT --reject-with icmp-port-unreachable
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o eth1 -j ACCEPT
-A OUTPUT -j bad_packets
-A OUTPUT -o eth0 -j ACCEPT
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A bad_packets -s 20.0.0.0/8 -i eth0 -j DROP
-A bad_packets -s 172.16.0.0/12 -i eth0 -j DROP
-A bad_packets -s 192.160.0.0/12 -i eth0 -j DROP
-A bad_packets -s 127.0.0.0/8 -i eth0 -j DROP
-A bad_packets -s 0.0.0.0/8 -i eth0 -j DROP
-A bad_packets -s 169.254.0.0/16 -i eth0 -j DROP
-A bad_packets -s 192.0.2.0/24 -i eth0 -j DROP
-A bad_packets -s 204.152.64.0/23 -i eth0 -j DROP
-A bad_packets -s 224.0.0.0/3 -i eth0 -j DROP
-A bad_packets -s 240.0.0.0/5 -i eth0 -j DROP
COMMIT
# Completed on Fri Jul 14 17:42:49 2023
# Generated by iptables-save v1.8.9 (nf_tables) on Fri Jul 14 17:42:49 2023
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -d 5.61.15.44/32 -i eth0 -j ACCEPT
-A PREROUTING -d 20.0.0.0/24 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3129
-A PREROUTING -d 20.0.0.0/24 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 3130
COMMIT
# Completed on Fri Jul 14 17:42:49 2023
# Generated by iptables-save v1.8.7 on Thu Jul 13 12:14:29 2023
*filter
:INPUT DROP [1:40]
:FORWARD DROP [1:41]
:OUTPUT DROP [1:136]
:bad_packets - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A INPUT -j bad_packets
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m state --state INVALID -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -i eth2 -p tcp -m tcp --dport 1565 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i eth1 -p udp -m udp --dport 53 -j ACCEPT
-A FORWARD -d 10.0.0.4/32 -i eth2 -o eth1 -p tcp -m tcp --dport 9889 -j ACCEPT
-A FORWARD -d 10.0.0.5/32 -i eth2 -o eth1 -p tcp -m tcp --dport 80 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 8448 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 443 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 80 -j ACCEPT
-A FORWARD -d 10.0.0.3/32 -i eth2 -o eth1 -p tcp -m tcp --dport 1567 -j ACCEPT
-A FORWARD -d 10.0.0.2/32 -i eth2 -o eth1 -p tcp -m tcp --dport 1566 -j ACCEPT
-A FORWARD -s 1.1.1.1/32 -j ACCEPT
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -j bad_packets
-A FORWARD -i eth2 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -m state --state INVALID -j DROP
-A FORWARD -i eth1 -o eth2 -j ACCEPT
-A FORWARD -i eth2 -o eth1 -j REJECT --reject-with icmp-port-unreachable
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o eth1 -j ACCEPT
-A OUTPUT -j bad_packets
-A OUTPUT -o eth2 -j ACCEPT
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A bad_packets -s 10.0.0.0/8 -i eth2 -j DROP
-A bad_packets -s 172.16.0.0/12 -i eth2 -j DROP
-A bad_packets -s 192.160.0.0/12 -i eth2 -j DROP
-A bad_packets -s 127.0.0.0/8 -i eth2 -j DROP
-A bad_packets -s 0.0.0.0/8 -i eth2 -j DROP
-A bad_packets -s 169.254.0.0/16 -i eth2 -j DROP
-A bad_packets -s 192.0.2.0/24 -i eth2 -j DROP
-A bad_packets -s 204.152.64.0/23 -i eth2 -j DROP
-A bad_packets -s 224.0.0.0/3 -i eth2 -j DROP
-A bad_packets -s 240.0.0.0/5 -i eth2 -j DROP
COMMIT
# Completed on Thu Jul 13 12:14:29 2023
# Generated by iptables-save v1.8.7 on Thu Jul 13 12:14:29 2023
*nat
:PREROUTING ACCEPT [49201:3965388]
:INPUT ACCEPT [16992:992577]
:OUTPUT ACCEPT [12060:1061656]
:POSTROUTING ACCEPT [33264:2122535]
-A PREROUTING -d 5.61.15.44/32 -i eth2 -j ACCEPT
-A PREROUTING -d 10.0.0.0/24 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3129
-A PREROUTING -d 10.0.0.0/24 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 3130
-A PREROUTING -d 2.2.2.2/32 -p tcp -m tcp --dport 6651 -j DNAT --to-destination 10.0.0.2:1566
-A PREROUTING -d 2.2.2.2/32 -p tcp -m tcp --dport 7651 -j DNAT --to-destination 10.0.0.3:1567
-A PREROUTING -d 2.2.2.2/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.0.0.3:80
-A PREROUTING -d 2.2.2.2/32 -p tcp -m tcp --dport 443 -j DNAT --to-destination 10.0.0.3:443
-A PREROUTING -d 2.2.2.2/32 -p tcp -m tcp --dport 8448 -j DNAT --to-destination 10.0.0.3:8448
-A PREROUTING -d 2.2.2.2/32 -p tcp -m tcp --dport 8888 -j DNAT --to-destination 10.0.0.5:80
-A PREROUTING -d 2.2.2.2/32 -p tcp -m tcp --dport 9889 -j DNAT --to-destination 10.0.0.4:9889
-A POSTROUTING -s 195.209.130.9/32 -o eth2 -j SNAT --to-source 10.0.0.10
-A POSTROUTING -s 10.0.0.0/24 -d 20.0.0.0/24 -j MASQUERADE
-A POSTROUTING -s 10.0.0.0/24 -o eth2 -j MASQUERADE
COMMIT
# Completed on Thu Jul 13 12:14:29 2023