- 论坛徽章:
- 0
|
公司有一个FC3想做路由器,请问以下设置符合我的要求吗?有安全问题没被考虑吗?
环境:FC3双网卡,eth0作为内网网卡,希望默认DROP掉所有数据,但是内网发起的所有对外连接都允许.
1:去除所有网卡的默认网关,可用的命令有:ifconfig
2:rpm –Uvh rp-pppoe-3.5-1.i386.rpm
3:/usr/sbin/adsl-setup配置adsl,并/usr/sbin/adsl -start启动连接,
/usr/sbin/adsl -status查看状态.
4:chkconfig 去除ipchain,加上iptables,并用chkconfig --add adsl把adsl在当前级别加进去
5:在/etc/rc.d/目录下用touch命令建立firewall文件,执行chmod u+x firewall以改变文件属性,编辑 /etc/rc.d/rc.local文件,在末尾加上/etc/rc.d/firewall以确保开机时能自动运行该脚本.
firewall内容为:
#!/bin/sh
echo "Enable IP Forwarding..."
echo "1">/proc/sys/net/ipv4/ip_forward
echo "Starting iptables rules..."
/sbin/modprobe iptable_filter
/sbin/modprobe ip_tables
/sbin/modprobe iptable_nat
#Refresh all chains
/sbin/iptables -F -t nat
/sbin/iptables -F -t mangle
/sbin/iptables -F -t Filter
/sbin/iptables -t nat -P DROP
/sbin/iptables -t mangle -P DROP
/sbin/iptables -t Filter -P DROP
/sbin/iptables -t Filter -A FORWARD -s 192.168.2.0/24 -o ppp0 -j ACCEPT \\所有内部发起的连接都被允许(如果有一个攻击数据包把自己源地址改成192.168.2.0/24的,那它不是进来了吗?有更好的写发吗?)
/sbin/iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o ppp0 -j MMASQUERADE
//完:~
像上面这样可以吗?有更好的吗?
还有,请问如果我需要把外网5901端口转发到内网的192.168.2.39这台机,请问应该怎么做DNAT.
DAT没有像MMASQUERADE这样的东西,但我的外网ip又不是固定的,那应该怎么写规则呢? |
|