两个eth,一个作WAN,一个做LAN

前提:linux系统,两个网卡,分别是eth0/eth1,其中eth0做wan口,eth1做lan口;

一:wan口配置:

(eth0)自动获得ip: udhcpc -i eth0

# udhcpc -i eth0
udhcpc: started, v1.29.3
udhcpc: sending discover
udhcpc: sending select for 192.168.0.89
udhcpc: lease of 192.168.0.89 obtained, lease time 7200
deleting routers
adding dns 202.96.134.133
adding dns 202.96.128.86

 

lan 作网关(eth1):

ifup_lan.sh ./udhcpd.conf

============ifup_lan.sh start========

#/bin/sh
killall udhcpd

echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -s 192.168.1.1/24 -j ACCEPT
iptables -A FORWARD -d 192.168.1.1/24 -j ACCEPT

ifconfig eth1 192.168.1.1
udhcpd ./udhcpd.conf
echo "==========follow ap6181"
exit 0

============ifup_lan.sh end========

============udhcpd.conf start========

# the start and end of the IP lease block
start        192.168.1.10
end        192.168.1.254
# the interface that udhcpd will use
interface    eth1

option    subnet    255.255.255.0
opt    router    192.168.1.1
opt     dns     114.114.114.114 8.8.8.8
option    domain    local
option    lease    864000
============udhcpd.conf end========

分析下面的ebtables规则 # ebtables -L Bridge table: filter Bridge chain: INPUT, entries: 2, policy: ACCEPT -j br_wan -j portmapping_igmp Bridge chain: FORWARD, entries: 6, policy: DROP -j disBCMC -j br_wan_forward -j wlan_block -j wlan_map_block -j macfilter -j portmapping Bridge chain: OUTPUT, entries: 2, policy: ACCEPT -j br_wan_out -j br_lan_out Bridge chain: br_lan_out, entries: 2, policy: ACCEPT -p IPv6 -o eth0.4 --ip6-proto ipv6-icmp --ip6-icmp-type router-advertisement -j DROP -p IPv6 -o eth0.5 --ip6-proto ipv6-icmp --ip6-icmp-type router-advertisement -j DROP Bridge chain: br_wan_forward, entries: 3, policy: RETURN -p IPv6 -o nas0_5 -j ACCEPT -p PPP_SES -o nas0_5 -j ACCEPT -o nas0_5 -j DROP Bridge chain: wlan_block, entries: 0, policy: RETURN Bridge chain: wlan_map_block, entries: 0, policy: RETURN Bridge chain: disBCMC, entries: 2, policy: RETURN -d Broadcast -j DROP -d Multicast -j DROP Bridge chain: br_wan, entries: 1, policy: RETURN -i nas0_5 -j DROP Bridge chain: br_wan_out, entries: 1, policy: RETURN -o nas0_5 -j DROP Bridge chain: portmapping_igmp, entries: 2, policy: RETURN -p IPv4 -i eth0.4 --ip-proto igmp -j DROP -p IPv4 -i eth0.5 --ip-proto igmp -j DROP Bridge chain: macfilter, entries: 0, policy: ACCEPT Bridge chain: portmapping, entries: 31, policy: ACCEPT -i nas0_5 -o wlan1-vap3 -j RETURN -i wlan1-vap3 -o nas0_5 -j RETURN -i nas0_5 -o wlan1-vap2 -j RETURN -i wlan1-vap2 -o nas0_5 -j RETURN -i nas0_5 -o wlan1-vap1 -j RETURN -i wlan1-vap1 -o nas0_5 -j RETURN -i nas0_5 -o wlan1-vap0 -j RETURN -i wlan1-vap0 -o nas0_5 -j RETURN -i nas0_5 -o wlan1 -j RETURN -i wlan1 -o nas0_5 -j RETURN -i nas0_5 -o wlan0-vap3 -j RETURN -i wlan0-vap3 -o nas0_5 -j RETURN -i nas0_5 -o wlan0-vap2 -j RETURN -i wlan0-vap2 -o nas0_5 -j RETURN -i nas0_5 -o wlan0-vap1 -j RETURN -i wlan0-vap1 -o nas0_5 -j RETURN -i nas0_5 -o wlan0-vap0 -j RETURN -i wlan0-vap0 -o nas0_5 -j RETURN -i nas0_5 -o wlan0 -j RETURN -i wlan0 -o nas0_5 -j RETURN -i nas0_5 -o eth0.5 -j RETURN -i eth0.5 -o nas0_5 -j RETURN -i nas0_5 -o eth0.4 -j RETURN -i eth0.4 -o nas0_5 -j RETURN -i eth+ -o eth+ -j RETURN -i eth+ -o wlan+ -j RETURN -i wlan+ -o eth+ -j RETURN -i wlan+ -o wlan+ -j RETURN -i eth0+ -j DROP -i wlan+ -j DROP -i nas0_5 -j DROP
07-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值