Firewall - CVP-bare

From Skytech
Revision as of 19:46, 12 March 2011 by 192.168.0.250 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#!/bin/sh
# eth0 er ydersiden (default GW), eth1 er extra yderside fra 3 (.91), eth2 er TDC gammel yderside, eth3 er indersiden
IPT=/sbin/iptables

IP0=xxx
IP1=xxx
IP2=xxx
IP3=xxx

# Tillad ping af firewall
$IPT -A FORWARD -p icmp --icmp-type echo-request -j ACCEPT

# Tillad ping gennem firewall
$IPT -A INPUT -p icmp --icmp-type echo-request -j ACCEPT

# Webmin + ssh
$IPT -A INPUT -m state --state NEW -s xxx-p tcp --dport 22 -j ACCEPT
$IPT -A INPUT -m state --state NEW -s xxx -p tcp --dport 10000 -j ACCEPT

## Forward af mailserver via IP2 På mailserveren oprettes en virtuel interface, der lytter på/til det net, hvor 
$IPT -t nat -A PREROUTING -p tcp -d $IP2 --dport 25 -j DNAT --to-destination xxx:25

## Forward af port 10001 til filserver 10000
$IPT -t nat -A PREROUTING -p tcp --dport 10001 -j DNAT --to-destination xxx:10000

## Nat den nye net kun via IP1
$IPT -t nat -A POSTROUTING -s xxx/32 -j MASQUERADE

## Tillad new, established, related
$IPT -A FORWARD -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT