Question
Thread display: Collapse - |
All Answers
Share your knowledge
Start or search
Create a new discussion
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
Why this iptables config not working ?
for table in filter nat mangle
do
iptables -t $table -F
iptables -t $table -X
iptables -t $table -Z
done
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A INPUT -m state --state INVALID -j DROP
iptables -A INPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
# enable fowarding
echo 1 > /proc/sys/net/ipv4/ip_forward
# Access Internet Rules
iptables -A OUTPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -m multiport -p tcp --dport 80,443,21,22,110 -i eth2 -o eth1 -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type 0 -o eth1 -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type 8 -o eth2 -j ACCEPT
# enable DNS
#iptables -A FORWARD -p udp --sport 53 -i eth2 -o eth1 -j ACCEPT
iptables -A FORWARD -p udp --dport 53 -i eth1 -o eth2 -j ACCEPT
# Nat Dynamique
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -A FORWARD -i eth2 -o eth1 -j ACCEPT
#Nat Destination