- 论坛徽章:
- 0
|
回复 #5 platinum 的帖子
以下就是最小化脚本,但是没有做任何控制,个人认为能正常运行。
- #### Define networks #######################
- #!/bin/bash
- PATH=/sbin:/bin:/usr/sbin:/usr/bin
- export PATH
- INIF="eth1"
- EXTIF="eth0"
- LAN="192.168.0.0/19"
- export EXTIF INIF LAN
- ############################################
- #### PART I: Localhost Firewall Setting ####
- ############################################
- #### 1. Clear any existing chains ####
- iptables -F
- iptables -X
- iptables -Z
- #### 2. Setting up default policies ####
- iptables -P INPUT DROP
- iptables -P OUTPUT ACCEPT
- iptables -P FORWARD ACCEPT
- #### 3. Setting up interface lo access policies ####
- iptables -A INPUT -i lo -j ACCEPT
- iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
- ###################################################
- #### PART II: Internal Server Filewall Setting ####
- ###################################################
- #### 1. Load any special modules ####
- modprobe ip_tables > /dev/null 2>&1
- modprobe iptable_nat > /dev/null 2>&1
- modprobe ip_nat_ftp > /dev/null 2>&1
- modprobe ip_nat_irc > /dev/null 2>&1
- modprobe ip_conntrack > /dev/null 2>&1
- modprobe ip_conntrack_ftp > /dev/null 2>&1
- modprobe ip_conntrack_irc > /dev/null 2>&1
- modprobe tcp_syncookies > /dev/null 2>&1
- #### 2. Clear NAT table rules ####
- iptables -F -t nat
- iptables -X -t nat
- iptables -Z -t nat
- iptables -t nat -P PREROUTING ACCEPT
- iptables -t nat -P POSTROUTING ACCEPT
- iptables -t nat -P OUTPUT ACCEPT
- #### 3. Enable ip forward ####
- iptables -A INPUT -i $INIF -j ACCEPT
- echo 1 > /proc/sys/net/ipv4/ip_forward
- iptables -t nat -A POSTROUTING -s 0/0 -o $EXTIF -j MASQUERADE #Urgent use
-
- #### Access internet control list & NAT forward rules ####
- #######################################
- #### Modification/Update Date note ####
- #######################################
- #2009/08/08 created by lingping
复制代码 |
|