我有一台 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
Run Code Online (Sandbox Code Playgroud)
我还有一个应用程序正在监听这台机器的 8080 端口。是否可以将发往端口 80 的流量传递给我的应用程序?我做了一些研究,看起来可以使用ebtablesand来完成iptables。
这是我的其余设置:
//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 …Run Code Online (Sandbox Code Playgroud)