CentOS Router和Iptables实现

Linux Route :eth0 172.16.0.1
                         eth1 60.59.58.1
 
Intranet windows 172.16.0.100 ,172.16.0.101 netmask 255.255.255.0  gateway 172.16.0.1
Extranet windows 60.59.58.100 ,60.59.58.200 netmask 255.255.255.0 gateway 60.59.58.1
 
Intranet 机器可以访问所有 Externet 机器, Extranet 只有 60.59.58.100 能访问 Intranet 172.16.0.100 80 8080 端口。
 
Linux 配置如下:
 
双网卡 eth0 172.16.0.1 eth1 60.59.58.1
 
#echo “1” > /proc/sys/net/ipv4/ip_forward
#iptables �CF 
#iptables �CX
#iptables �CP FORWARD DROP
#iptables �CA FORWARD �Cm state �Cstate ESTABLISHED,RELATED �Cj ACCEPT
#iptables �CA FORWARD �Cs 172.16.0.0/24 �Cj ACCEPT
#iptables �CA FORWARD �Cs 60.59.58.100 �Cd 172.16.0.100 �Cp tcp �Cdport 80 �Cj ACCEPT
#iptables �CA FORWARD �Cs 60.59.58.100 �Cd 172.16.0.100 �Cp tcp �Cdport 8080 �Cj ACCEPT
#iptables-save >/etc/sysconfig/iptables

你可能感兴趣的:(centos,职场,iptables,休闲,router)