Docker网络macvlan问题。子接口中的容器不会与外部连接

时间:2019-07-16 10:06:22

标签: docker networking docker-networking macvlan

我在docker中有几个容器,其ip的样式为192.168.X.2 24,因此每个容器位于不同的子网中。这些网络是通过以下方式创建的

docker network create -d macvlan   --subnet=192.168.X.0/24   --gateway=192.168.X.1   -o parent=eth0.X testX

这些计算机位于Centos7的虚拟机中,该虚拟机具有virtualbox和网桥适配器,并且网络接口连接到cisco路由器,因此目前,所有这些网络的端口1中的网关都作为vlan1中的ips作为辅助网络

这个想法是要安装类似的东西,但是要使用不同的vlan IP

https://docs.docker.com/v17.09/engine/userguide/networking/get-started-macvlan/#macvlan-8021q-trunk-bridge-mode-example-usage

问题是这些子接口的arp查询未收到响应

08:00:41.132782 ARP, Request who-has 192.168.2.1 tell 192.168.2.2, length 28
08:00:42.135804 ARP, Request who-has 192.168.2.1 tell 192.168.2.2, length 28
08:00:42.138763 STP 802.1d, Config, Flags [none], bridge-id 8001.1c:17:d3:0d:d4:80.8001, length 43
08:00:43.138921 ARP, Request who-has 192.168.2.1 tell 192.168.2.2, length 28
08:00:44.143655 STP 802.1d, Config, Flags [none], bridge-id 8001.1c:17:d3:0d:d4:80.8001, length 43
08:00:45.134850 ARP, Request who-has 192.168.2.1 tell 192.168.2.2, length 28
08:00:46.136855 ARP, Request who-has 192.168.2.1 tell 192.168.2.2, length 28
08:00:46.151921 STP 802.1d, Config, Flags [none], bridge-id 8001.1c:17:d3:0d:d4:80.8001, length 43
08:00:47.138610 ARP, Request who-has 192.168.2.1 tell 192.168.2.2, length 28
08:00:48.153870 STP 802.1d, Config, Flags [none], bridge-id 8001.1c:17:d3:0d:d4:80.8001, length 43
08:00:48.521751 IP 192.168.50.2.64007 > 192.168.110.102.snmp:  GetRequest(62)  25.3.2.1.5.1 25.3.5.1.1.1 25.3.5.1.2.1
08:00:49.138713 ARP, Request who-has 192.168.2.1 tell 192.168.2.2, length 28

相反,它会响应从虚拟机到路由器接口的ping操作,因此失败必须在arp地址中。

我尝试使用修改接口中的proxy_arp

echo 1 > /proc/sys/net/ipv4/conf/all/proxy_arp
echo 1 > /proc/sys/net/ipv4/conf/all/forwarding
echo 1 > /proc/sys/net/ipv4/conf/all/proxy_arp_pvlan 
echo 1 > /proc/sys/net/ipv4/conf/all/arp_filter

有人可以帮忙吗? 更新:1 我更改了macvlan网络并添加-o macvlan_mode = briedge和arp 它几乎可以工作。但是我有新的问题,arp将响应发送到eth0接口,但是我的macvlan在eth0.3中

eth0

13:45:09.238957 ARP, Request who-has 192.168.30.1 tell 192.168.30.2, length 28
13:45:09.239581 ARP, Reply 192.168.30.1 is-at 1c:17:d3:0d:d4:c2 (oui Unknown), length 46
13:45:09.255053 IP 192.168.50.2.54189 > 224.0.0.252.hostmon: UDP, length 25
13:45:09.454234 ARP, Request who-has gateway tell 192.168.50.2, length 46
13:45:09.456522 ARP, Reply gateway is-at 1c:17:d3:0d:d4:c0 (oui Unknown), length 46
13:45:09.497288 ARP, Reply gateway is-at 52:54:00:26:10:60 (oui Unknown), length 28

eth0.3

listening on eth0.3, link-type EN10MB (Ethernet), capture size 262144 bytes
13:49:30.348997 ARP, Request who-has 192.168.30.1 tell 192.168.30.2, length 28
13:49:31.351773 ARP, Request who-has 192.168.30.1 tell 192.168.30.2, length 28
13:49:32.355782 ARP, Request who-has 192.168.30.1 tell 192.168.30.2, length 28
13:49:33.359876 ARP, Request who-has 192.168.30.1 tell 192.168.30.2, length 28
13:49:34.363528 ARP, Request who-has 192.168.30.1 tell 192.168.30.2, length 28

0 个答案:

没有答案