上回说道找到问题的症结所在,是硬件的问题,不买关子了------------是网卡的问题。
 
 
          服务器“假死”中,出项的iptables输出报错,网卡自动shutdown等。。。。。,都是由网卡的问题引起的。因为之前的那块845的主板只有一个pci插槽,另外一个是集成的网卡,呵呵,保险起见,还是另弄一块板,弄两个pci网卡。之后证明这个决定相当的“英明”。
 
 
          现在使用的服务器的配置是 945的主板 (像网上的MSI、 VIA、 ANDA 等 399那个类型的,本人使用的是ANDA 945GCT  ,注意是 2.0的板啊,本人DIY水平有限,再加上已基本确认是硬件的问题,怕淘的 845 865 的板,不行啊,真是一朝被蛇咬,十年怕井绳啊)
 
                        内存用的是1 G ddr2的 金士顿的 ,因以前的cpu p4 2.4是 478的 ,有没有旧的775的cpu,有弄了一个 散装的E2140 啊,呵呵,就保留了硬盘。再加两块 瑞昱的8139网卡。
 
 
                      ok,开始配置,一切都ok,从08年的4月份开始,稳定的运行到现在(除了中间的两次停电啊,抓。。。。。。一次放生在上月,物业有通知啊,一次在上周,突然断电了,没有UPS啊,是要弄个那家伙的啊,但因“雇主”的一些情况决定,现在或今年都可能不会用啊,好在深圳的写字楼一般供电都稳定,“雇主”现在也并不一定要求“无间断服务保障”。)
uptime 时间如下(刚通过pptp 拨号后,登陆获得的数据)
 
[root@RServer ~]# uptime
 23:24:44 up 7 days, 13:50,  1 user,  load average: 0.00, 0.00, 0.00
[root@RServer ~]# ipsec look
RServer Wed Aug 13 23:25:03 CST 2008
Destination  Gateway  Genmask  Flags  MSS Window  irtt Iface
0.0.0.0    xx.xx.xx.xx 0.0.0.0  UG     0 0          0 eth0
10.1.1.0  xx.xx.xx.xx 255.255.255.0  UG  0 0        0 eth0
xxx.xxx.xxx.xxx  0.0.0.0 255.255.255.248 U   0 0    0 eth0
 
 
   下面就要说说对应的iptables的设置了,(os是redhat 4.4 采用的系统自带的iptables,为进行重新编译)
 
       使用iptables的shell脚本方式,这得谢谢和我合作配置ipsec ***的对端的那位同仁了。
经实际运行,不断优化如下:( 注意请增加 iptables.sh 的执行权限,并放到 /etc/rc.d/rc.local 中以便于开机执行,再确认iptables服务也是开机运行的)
请注意windows 和 linux 不同字符换行等问题,建议最好自己在 vi  中手动输入。
 
echo "1" >/proc/sys/net/ipv4/ip_forward
modprobe ip_tables
modprobe iptable_filter
modprobe iptable_nat
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
#-----------------------------------------------------------
EXT_IF="eth1"
INT_IF="eth0"
EXT_IP="xx.xx.xx.xx" 本地公网ip

INT_IP="10.1.2.1"
#-----------------------------------------------------------
iptables -F -t filter
iptables -X -t filter
iptables -Z -t filter
iptables -F -t nat
iptables -X -t nat
iptables -Z -t nat
#-----------------------------------------------------------
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#-----------------------------------------------------------
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
#--------------------deny (allow) ping from internet--------
iptables -A INPUT -p icmp -j ACCEPT
#------for ×××
iptables -A INPUT -s xx.xx.xx.xx -j ACCEPT  对端外网卡配置的公网地址允许
iptables -A INPUT -s 10.1.1.0/24 -j ACCEPT     对端私有网络
iptables -A INPUT -s 10.1.2.0/24 -j ACCEPT     本端私有网络
iptables -A FORWARD -s xx.xx.xx.xx -j ACCEPT    对端外网卡配置的公网地址允许
iptables -A FORWARD -s 10.1.1.0/24 -j ACCEPT    对端私有网络
iptables -A FORWARD -s 10.1.2.0/24 -j ACCEPT     本端私有网络
#-----------------------------------------------------------
iptables -t nat -A POSTROUTING -o eth0 -s 10.1.2.0/24 -d ! 10.1.1.0/24 -j MASQUERADE
#------------------------------------nat--------------------
iptables -t nat -A POSTROUTING -s 10.1.2.0/24 -o eth1 -j SNAT --to xx.xx.xx.xx
#-----------------------------------end--------------------
 
 
未完,请看下回分解