1.设置桥接内网和外网:
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ifconfig br0 netmask 255.255.255.0 192.168.1.2 up
配置Iptables防火墙,eth0为外网,eth1为内网。
#配置防火墙自身规则
iptables -P INPUT DROP
iptables -A INPUT –m state --state RELATED,ESTABLISHED –j ACCEPT
iptables -A INPUT -p tcp --dport 22 -m physdev --physdev-in eth1 -j ACCEPT
#配置转发规则
iptables -P FORWARD DROP
iptables -A FORWARD –m state --state RELATED,ESTABLISHED –j ACCEPT
iptables -A FORWARD -m physdev --physdev-in eth1 --physdev-out eth0 -j ACCEPT