linux下网桥实现:
1、安装编译安装bridge-utils;
apt-get install bridge-utils
2、配置网桥
brctl addbr bridge
ifconfig eth0 down
ifconfig eth1 down
ifconfig eth0 0.0.0.0
ifconfig eth1 0.0.0.0
brctl addif bridge eth0
brctl addif bridge ath0
ifconfig br0 up
dhclient br0 (启动dhclient获取ip地址)
android下网桥实现,同时android层需要处理好dhcp进行ip获取,dns设置:
1、先按linux设置网桥;
2、按下面配置androidiptables;
iptables -A FORWARD-i eth0 -o eth1 -j ACCEPT
iptables -A FORWARD-i eth1 -o eth0 -j ACCEPT
iptables -D FORWARD 4 /* 删除natctrl_FORWARD规则,FORWARD中的第4条规则 */
配置完成后,iptables–list看一下配置后的iptables FORWARD链为下面内容就对了
Chain FORWARD(policy ACCEPT)
target prot optsource destination
oem_fwd all -- anywhere anywhere
fw_FORWARD all -- anywhere anywhere
bw_FORWARD all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
本文介绍了Linux和Android下网桥的实现方法。在Linux下,需编译安装bridge - utils并启动dhclient获取IP地址;在Android下,先按Linux设置网桥,再配置android iptables,最后可通过iptables–list查看配置后的FORWARD链。
1251

被折叠的 条评论
为什么被折叠?



