如何在Docker中支持多播网络 [英] How to support multicast network in Docker

查看:611
本文介绍了如何在Docker中支持多播网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个有关docker中网络配置的大问题.感觉是这样的:

I've met a big problem about the network configuration in docker. The senario is this:

1.我的服务中有两个eth:eth0和eth1:

1.I have two eth on my serve : eth0 and eth1:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.198.172 netmask 255.255.255.0 broadcast 172.17.198.255
inet6 fe80::250:56ff:fea8:233f prefixlen 64 scopeid 0x20
ether 00:50:56:a8:23:3f txqueuelen 1000 (Ethernet)
RX packets 5415657 bytes 2659904664 (2.4 GiB)
RX errors 0 dropped 78 overruns 0 frame 0
TX packets 935762 bytes 1824232555 (1.6 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.251.6.68 netmask 255.255.255.0 broadcast 10.251.6.255
inet6 fe80::250:56ff:fea8:1778 prefixlen 64 scopeid 0x20
ether 00:50:56:a8:17:78 txqueuelen 1000 (Ethernet)
RX packets 4954017171 bytes 349830337818 (325.8 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 66380998 bytes 4647495138 (4.3 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

2.eth0是默认的网络接口. eth1是支持多播的接口.它在多播模式下接收和发送消息.

2.The eth0 is the default network interface. And eth1 is an interface which support multicast. It receives and send messages under the multicast mode.

3.现在,我使用以下命令创建一个容器: docker run -it -p 8181:8181 centos bash

3.Now I create a container using following command: docker run -it -p 8181:8181 centos bash

4.据我了解,eth0和eth1这两个接口都将桥接到容器中的veth0.所以我的问题是:

4.As my understanding, the eth0 and eth1 two interface will all be bridged to veth0 in the container. So my question is:

< 1>如果eth0和eth1都与veth0桥接,那么veth0如何从两个eths(eth0和eth1)接收ip数据包 < 2>如果我的理解是错误的,则docker仅将eth0桥接到veth0.如何在容器内将eth1桥接到veth1,以便容器可以通过eth1到veth1接收来自物理网络的多播数据包. 非常感谢 !这个问题困扰了我很长时间.如果您有任何想法或疑问,请在此处发表评论.谢谢!

<1>If the eth0 and eth1 are all bridge to veth0, how the veth0 receive ip data package from two eths(eth0 and eth1) <2>If my understanding is wrong, the docker only bridges eth0 to veth0. How can I bridge the eth1 to veth1 inside container so that the container could receive the multicast data packages from physical network through eth1 to veth1. Thanks so much ! This problem has been stucked me for a long long time. If you have any idea or any question, please leave a comment here. Thanks!

推荐答案

我认为当前不支持此功能.最好的选择可能是禁用Docker的网络命名空间并使用--net host.请注意,这使容器可以直接访问主机接口,并且您需要通过已发布的端口进行连接才能访问其他容器.

I don't believe this is currently supported. Best option may be to disable Docker's network namespacing and use --net host. Note that this gives the container direct access to the host interfaces, and you'll need to connect through published ports to access others containers.

您可以通过以下方式关注当前状态: https://github.com/moby /moby/issues/23659

You can follow the current status with this issue: https://github.com/moby/moby/issues/23659

这篇关于如何在Docker中支持多播网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆