OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / user / rp-pppoe / firewall-masq
1 #!/bin/sh
2 #
3 # firewall-masq         This script sets up firewall rules for a machine
4 #                       acting as a masquerading gateway
5 #
6 # Copyright (C) 2000 Roaring Penguin Software Inc.  This software may
7 # be distributed under the terms of the GNU General Public License, version
8 # 2 or any later version.
9
10 # Interface to Internet
11 EXTIF=ppp+
12
13 ANY=0.0.0.0/0
14
15 ipchains -P input ACCEPT
16 ipchains -P output ACCEPT
17 ipchains -P forward DENY
18
19 ipchains -F forward
20 ipchains -F input
21 ipchains -F output
22
23 # Deny TCP and UDP packets to privileged ports
24 ipchains -A input -l -i $EXTIF -d $ANY 0:1023 -p udp -j DENY
25 ipchains -A input -l -i $EXTIF -d $ANY 0:1023 -p tcp -j DENY
26
27 # Do masquerading
28 ipchains -A forward -j MASQ
29 echo 1 > /proc/sys/net/ipv4/ip_forward