CoooL’s router

#!/bin/sh

  # default
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

  # flush
iptables -t filter -F INPUT
iptables -t filter -F FORWARD
iptables -t filter -F OUTPUT
iptables -t nat -F PREROUTING
iptables -t nat -F POSTROUTING

  # aktivere masquerade

iptables -t nat -A POSTROUTING -j MASQUERADE -p icmp
iptables -t nat -A POSTROUTING -j MASQUERADE -p udp
iptables -t nat -A POSTROUTING -j MASQUERADE -p tcp


iptables -t nat -A PREROUTING -s ! 10.4.0.0/16 -p tcp --dport 20 -j DNAT --to-destination 10.4.0.3
iptables -t nat -A PREROUTING -s ! 10.4.0.0/16 -p tcp --dport 21 -j DNAT --to-destination 10.4.0.3
iptables -t nat -A PREROUTING -s ! 10.4.0.0/16 -p tcp --dport 22 -j DNAT --to-destination 10.4.0.3
iptables -t nat -A PREROUTING -s ! 10.4.0.0/16 -p tcp --dport 25 -j DNAT --to-destination 10.4.0.3
iptables -t nat -A PREROUTING -s ! 10.4.0.0/16 -p tcp --dport 80 -j DNAT --to-destination 10.4.0.3
iptables -t nat -A PREROUTING -s ! 10.4.0.0/16 -p tcp --dport 110 -j DNAT --to-destination 10.4.0.3

 

Dette indlæg blev udgivet i Knowledge Base, Linux, Networking, Old Base. Bogmærk permalinket.

Skriv et svar