海运的博客

OpenWrt/PandoraBox多网段转发udp广播包

发布时间:April 1, 2022 // 分类: // No Comments

之前有写不同网段间转发mdns消息,对于依赖udp广播的程序可通过iptables tee镜像流量转发广播到不同网段。
安装tee模块:

opkg install iptables-mod-tee
#将10.0.0.0网段udp广播目标端口9687转发到10.0.1.0网段
iptables -t mangle -I INPUT -i br-lan -d 255.255.255.255 -p udp --dport 9687 -m ttl --ttl-gt 0 -j TTL --ttl-set 1
iptables -t mangle -I INPUT -i br-lan -d 255.255.255.255 -p udp --dport 9687 -m ttl --ttl-gt 0 -j TEE --gateway 10.0.1.255

#反向
iptables -t mangle -I INPUT -i br-robot -d 255.255.255.255 -p udp --dport 9687 -m ttl --ttl-gt 0 -j TTL --ttl-set 1
iptables -t mangle -I INPUT -i br-robot -d 255.255.255.255 -p udp --dport 9687 -m ttl --ttl-gt 0 -j TEE --gateway 10.0.0.255

iptables放行9687数据包:

iptables -A FORWARD -i br-robot -o br-lan -p udp --dport 9687 -j ACCEPT

不支持iptables tee模块可使用独立的udp广播转发程序:
https://github.com/nomeata/udp-broadcast-relay
参考:
https://odi.ch/weblog/posting.php?posting=731

分类
最新文章
最近回复
  • 海运: 网络,找到相应的url编辑重发请求,firefox有此功能,其它未知。
  • knetxp: 用浏览器F12网络拦截或监听后编辑重发请求,修改url中的set为set_super,将POS...
  • Albert: 啊啊啊啊啊啊啊啊啊 我太激动了,终于好了英文区搜索了半天,翻遍了 pve 论坛没找到好方法,博...
  • jiangker: good, very helpful to me
  • fengfeng: N1 armbian 能有编译下内核吗。。我要开启can 不懂怎么操作
  • 1: 方法一ngtcp2要改下:./configure PKG_CONFIG_PATH=/usr/l...
  • 海运: 关闭服务器
  • 海风: override.battery.charge.low以及override.battery.r...
  • koldjf: 不能过滤
  • 杰迪武士: 此文甚好甚强巨,依照此文在树莓派2 + Rasbian上部署成功 感谢博主美文共赏