LJ Archive

Listing 4. DNS Entry for Mail Server

$IPT -t filter -N tcprules
$IPT -A tcprules  -i eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A tcprules -i ! eth1 -m state --state NEW -j ACCEPT
$IPT -A tcprules -i eth1 -p tcp --dport 25 -m state --state NEW -j ACCEPT
$IPT -A tcprules -i eth1 -m state --state NEW,INVALID -j DROP
$IPT -t nat -A PREROUTING -d 209.127.112.17 -p tcp --dport 25 -j DNAT --to-destination 192.168.0.2:25
$IPT -t nat -A POSTROUTING -o eth1 -s 192.168.0.0/24 -j SNAT --to-source 209.127.112.17
$IPT -A INPUT -j tcprules
$IPT -A FORWARD -j tcprules
echo 1 > /proc/sys/net/ipv4/ip_forward
LJ Archive