免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 30332 | 回复: 1
打印 上一主题 下一主题

[网络管理] 如何用iptables将多播数据从一个interface路由到另一个inteface? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2019-10-29 07:00 |只看该作者 |倒序浏览
如题,请问如何用iptable 将一mDNS包从一个网口路由到另一个网口?
想将下面 ens33里的mDNS传到 docker0 这个bridge里

具体如下:

  1. host机器的eth接口:

  2. docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
  3.         inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
  4.         。。。

  5. ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
  6.         inet 192.168.1.101  netmask 255.255.255.0  broadcast 192.168.1.255
  7.         。。。

  8. lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
  9.         inet 127.0.0.1  netmask 255.0.0.0
  10.         。。。

  11. vetha6f8ec5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
  12.         inet6 fe80::fcb3:bbff:fe78:c72d  prefixlen 64  scopeid 0x20<link>
  13.         。。。
复制代码

  1. iptables -t filter -L
  2. Chain INPUT (policy ACCEPT)
  3. target     prot opt source               destination         

  4. Chain FORWARD (policy ACCEPT)
  5. target     prot opt source               destination         
  6. DOCKER-USER  all  --  anywhere             anywhere            
  7. DOCKER-ISOLATION-STAGE-1  all  --  anywhere             anywhere            
  8. ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
  9. DOCKER     all  --  anywhere             anywhere            
  10. ACCEPT     all  --  anywhere             anywhere            
  11. ACCEPT     all  --  anywhere             anywhere            

  12. Chain OUTPUT (policy ACCEPT)
  13. target     prot opt source               destination         

  14. Chain DOCKER (1 references)
  15. target     prot opt source               destination         
  16. ACCEPT     tcp  --  anywhere             172.17.0.2           tcp dpt:http

  17. Chain DOCKER-ISOLATION-STAGE-1 (1 references)
  18. target     prot opt source               destination         
  19. DOCKER-ISOLATION-STAGE-2  all  --  anywhere             anywhere            
  20. RETURN     all  --  anywhere             anywhere            

  21. Chain DOCKER-ISOLATION-STAGE-2 (1 references)
  22. target     prot opt source               destination         
  23. DROP       all  --  anywhere             anywhere            
  24. RETURN     all  --  anywhere             anywhere            

  25. Chain DOCKER-USER (1 references)
  26. target     prot opt source               destination         
  27. RETURN     all  --  anywhere             anywhere
复制代码
  1. Chain PREROUTING (policy ACCEPT)
  2. target     prot opt source               destination         
  3. DOCKER     all  --  anywhere             anywhere             ADDRTYPE match dst-type LOCAL

  4. Chain INPUT (policy ACCEPT)
  5. target     prot opt source               destination         

  6. Chain OUTPUT (policy ACCEPT)
  7. target     prot opt source               destination         
  8. DOCKER     all  --  anywhere            !localhost/8          ADDRTYPE match dst-type LOCAL

  9. Chain POSTROUTING (policy ACCEPT)
  10. target     prot opt source               destination         
  11. MASQUERADE  all  --  172.17.0.0/16        anywhere            
  12. MASQUERADE  tcp  --  172.17.0.2           172.17.0.2           tcp dpt:http

  13. Chain DOCKER (2 references)
  14. target     prot opt source               destination         
  15. RETURN     all  --  anywhere             anywhere            
  16. DNAT       tcp  --  anywhere             anywhere             tcp dpt:http-alt to:172.17.0.2:80
复制代码




论坛徽章:
59
2015七夕节徽章
日期:2015-08-24 11:17:25ChinaUnix专家徽章
日期:2015-07-20 09:19:30每周论坛发贴之星
日期:2015-07-20 09:19:42ChinaUnix元老
日期:2015-07-20 11:04:38荣誉版主
日期:2015-07-20 11:05:19巳蛇
日期:2015-07-20 11:05:26CU十二周年纪念徽章
日期:2015-07-20 11:05:27IT运维版块每日发帖之星
日期:2015-07-20 11:05:34操作系统版块每日发帖之星
日期:2015-07-20 11:05:36程序设计版块每日发帖之星
日期:2015-07-20 11:05:40数据库技术版块每日发帖之星
日期:2015-07-20 11:05:432015年辞旧岁徽章
日期:2015-07-20 11:05:44
2 [报告]
发表于 2020-10-25 16:26 |只看该作者
iptable的功能太强大了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP