如何在Docker容器中调试``无主机路由''

时间:2018-07-20 23:02:40

标签: docker networking

我只是没有足够的网络知识来理解这一点。

在笔记本电脑上,我同时运行Docker和多个无用的VM。

我想从docker容器中连接到其中一个无用的VM,但是ping仍然挂起或吐出“ Destination Host Unreachable”。我可以从主机(例如,在容器外部)对无用的VM进行ping操作。

您能指出正确的方向吗?我基本上想在无业游民的VM上安装Nginx,但在Docker中有一些负载均衡器。

这意味着docker容器需要能够“查看”无业游民的VM。

我需要一个路由表条目吗?我需要特殊的网络适配器吗?我需要建立一座桥梁吗?我只是不够了解,不胜感激朝着正确的方向前进。

以下是容器中的详细信息:

root@d755dbb8bbc9:/# ip route
default via 172.18.0.1 dev eth1 
10.0.1.0/24 dev eth2 proto kernel scope link src 10.0.1.6 
10.255.0.0/16 dev eth0 proto kernel scope link src 10.255.0.4 
172.18.0.0/16 dev eth1 proto kernel scope link src 172.18.0.5 
root@d755dbb8bbc9:/# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet 10.255.0.30/32 brd 10.255.0.30 scope global lo
       valid_lft forever preferred_lft forever
    inet 10.0.1.41/32 brd 10.0.1.41 scope global lo
       valid_lft forever preferred_lft forever
2: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1
    link/ipip 0.0.0.0 brd 0.0.0.0
3: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN group default qlen 1
    link/tunnel6 :: brd ::
29: eth0@if30: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UP group default 
    link/ether 02:42:0a:ff:00:04 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 10.255.0.4/16 brd 10.255.255.255 scope global eth0
       valid_lft forever preferred_lft forever
35: eth1@if36: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:ac:12:00:05 brd ff:ff:ff:ff:ff:ff link-netnsid 1
    inet 172.18.0.5/16 brd 172.18.255.255 scope global eth1
       valid_lft forever preferred_lft forever
39: eth2@if40: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UP group default 
    link/ether 02:42:0a:00:01:06 brd ff:ff:ff:ff:ff:ff link-netnsid 2
    inet 10.0.1.6/24 brd 10.0.1.255 scope global eth2
       valid_lft forever preferred_lft forever

这是来自无业游民的VM的一些东西:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:cf:1a:c3 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0
       valid_lft 67730sec preferred_lft 67730sec
    inet6 fe80::a00:27ff:fecf:1ac3/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:ca:c7:a1 brd ff:ff:ff:ff:ff:ff
    inet 172.17.8.101/16 brd 172.17.255.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:feca:c7a1/64 scope link 
       valid_lft forever preferred_lft forever
core@core-01 ~ $ ip route
default via 10.0.2.2 dev eth0 proto dhcp src 10.0.2.15 metric 1024 
10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15 
10.0.2.2 dev eth0 proto dhcp scope link src 10.0.2.15 metric 1024 
172.17.0.0/16 dev eth1 proto kernel scope link src 172.17.8.101

当我从docker容器ping 172.17.8.101(我要ping的无用VM的IP)时,它只是挂起。如何从一个Docker容器访问其中一个VM?

0 个答案:

没有答案