linux bridge可以拦截流量吗?
发布时间:2020-12-14 02:30:00 所属栏目:Linux 来源:网络整理
导读:我将 linux机器设置为客户端和服务器之间的桥梁; brctl addbr0brctl addif br0 eth1brctl addif br0 eth2ifconfig eth1 0.0.0.0ifconfig eth2 0.0.0.0ip link set br0 up 我也有一个应用程序监听这台机器的8080端口. 是否可以将指向端口80的流量传递给我的应
我将
linux机器设置为客户端和服务器之间的桥梁;
brctl addbr0 brctl addif br0 eth1 brctl addif br0 eth2 ifconfig eth1 0.0.0.0 ifconfig eth2 0.0.0.0 ip link set br0 up 我也有一个应用程序监听这台机器的8080端口. 以下是我的其余设置: //set the ebtables to pass this traffic up to ip for processing; DROP on the broute table should do this ebtables -t broute -A BROUTING -p ipv4 --ip-proto tcp --ip-dport 80 -j redirect --redirect-target DROP //set iptables to forward this traffic to my app listening on port 8080 iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY --on-port 8080 --tproxy-mark 1/1 iptables -t mangle -A PREROUTING -p tcp -j MARK --set-mark 1/1 //once the flows are marked,have them delivered locally via loopback interface ip rule add fwmark 1/1 table 1 ip route add local 0.0.0.0/0 dev lo table 1 //enable ip packet forwarding echo 1 > /proc/sys/net/ipv4/ip_forward 但是我的申请中没有任何内容.我错过了什么吗?我的理解是,bro??ute BROUTING链上的目标DROP会将其推送到iptables进行处理. 其次,我还有其他选择吗? 编辑:IPtables在nat PREROUTING获得它,但看起来它在之后下降; INPUT链(在mangle或filter中)看不到数据包. 解决方法
我决定保持桥接行为.我将使用ebtables阻止我想拦截的流量,并让我的应用程序使用原始套接字拦截这些数据包.看起来像一个kludge,但似乎工作.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |