5 # Firewall configuration for a router with a dynamic IP.
7 # Author: Max Kellermann <max@duempel.org>
10 @def $DEV_PRIVATE = (eth0 eth1);
11 @def $DEV_WORLD = ppp0;
13 @def $NET_PRIVATE = 192.168.0.0/16;
20 mod state state INVALID DROP;
21 mod state state (ESTABLISHED RELATED) ACCEPT;
23 # allow local connections
27 proto icmp icmp-type echo-request ACCEPT;
30 interface $DEV_WORLD {
31 proto udp dport 500 ACCEPT;
32 proto (esp ah) ACCEPT;
35 # allow SSH connections from the private network and from some
36 # well-known internet hosts
37 saddr ($NET_PRIVATE 81.209.165.42) proto tcp dport ssh ACCEPT;
39 # we provide DNS and SMTP services for the internal net
40 interface $DEV_PRIVATE saddr $NET_PRIVATE {
41 proto (udp tcp) dport domain ACCEPT;
42 proto tcp dport smtp ACCEPT;
45 # some IRC servers want that
46 interface $DEV_WORLD {
47 proto tcp dport auth ACCEPT;
48 proto tcp dport (8080 3128) REJECT;
51 # the rest is dropped by the above policy
54 # outgoing connections are not limited
55 chain OUTPUT policy ACCEPT;
61 mod state state INVALID DROP;
62 mod state state (ESTABLISHED RELATED) ACCEPT;
64 # connections from the internal net to the internet or to other
65 # internal nets are allowed
66 interface $DEV_PRIVATE ACCEPT;
68 # the rest is dropped by the above policy
74 # masquerade private IP addresses
75 saddr $NET_PRIVATE outerface $DEV_WORLD MASQUERADE;