Невозможно пропинговать хост из контейнера docker - PullRequest
0 голосов
/ 03 февраля 2020

Я работаю над этим более недели и не могу найти решение. Отчаянно нуждаюсь в помощи

  1. У меня есть 2 хоста, host1 и host2.

Сведения о сети хоста 1.

- bash -4.2 $ / sbin / ifconfig

docker0:

    flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
    inet6 fe80::42:51ff:fe23:53d7  prefixlen 64  scopeid 0x20<link>
    ether 02:42:51:23:53:d7  txqueuelen 0  (Ethernet)
    RX packets 873  bytes 218751 (213.6 KiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 532  bytes 86121 (84.1 KiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0 :

    flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9000
    inet 10.40.89.167  netmask 255.255.248.0  broadcast 10.40.95.255
    inet6 2606:b400:c13:e03:f816:3eff:fe48:f5d  prefixlen 64  scopeid 0x0<global>
    inet6 fe80::f816:3eff:fe48:f5d  prefixlen 64  scopeid 0x20<link>
    ether fa:16:3e:48:0f:5d  txqueuelen 1000  (Ethernet)
    RX packets 156003879  bytes 37924713148 (35.3 GiB)
    RX errors 0  dropped 17  overruns 0  frame 0
    TX packets 8377241  bytes 1139655340 (1.0 GiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo:

    flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 128401  bytes 29691788 (28.3 MiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 128401  bytes 29691788 (28.3 MiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth0313598:

    flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet6 fe80::88f8:2fff:fe15:e7c7  prefixlen 64  scopeid 0x20<link>
    ether 8a:f8:2f:15:e7:c7  txqueuelen 0  (Ethernet)
    RX packets 365  bytes 190333 (185.8 KiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 884  bytes 191667 (187.1 KiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Сведения о сети host2

docker0:

    flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
    ether 02:42:e6:0d:4c:a6  txqueuelen 0  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0:

    flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9000
    inet 10.40.67.187  netmask 255.255.248.0  broadcast 10.40.71.255
    inet6 fe80::f816:3eff:fe0b:cdb7  prefixlen 64  scopeid 0x20<link>
    inet6 2606:b400:c13:e00:f816:3eff:fe0b:cdb7  prefixlen 64  scopeid 0x0<global>
    ether fa:16:3e:0b:cd:b7  txqueuelen 1000  (Ethernet)
    RX packets 206797690  bytes 42338336490 (39.4 GiB)
    RX errors 0  dropped 6  overruns 0  frame 0
    TX packets 6772819  bytes 1007703663 (961.0 MiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo:

    flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 133640  bytes 30800694 (29.3 MiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 133640  bytes 30800694 (29.3 MiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Постановка задачи:

  1. У меня есть docker контейнер в host1 , работающий Oracle 19 c Enterprise Edition. Я могу подключиться к этой базе данных из внешнего мира, используя сопоставление портов 4521 хоста и 1521 контейнера.
  2. Я могу пропинговать host1 из контейнера Oracle

[oracle@b1d3ef32e104 ~] $ ping - c 2 10.40.89.167

    PING 10.40.89.167 (10.40.89.167) 56(84) bytes of data.
    64 bytes from 10.40.89.167: icmp_seq=1 ttl=64 time=0.081 ms
    64 bytes from 10.40.89.167: icmp_seq=2 ttl=64 time=0.090 ms
    --- 10.40.89.167 ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 1043ms
    rtt min/avg/max/mdev = 0.081/0.085/0.090/0.010 ms
Я могу пропинговать host2 с host1

- bash -4.2 $ ping - c 2 10.40.67.187

    PING 10.40.67.187 (10.40.67.187) 56(84) bytes of data.
    64 bytes from 10.40.67.187: icmp_seq=1 ttl=62 time=0.320 ms
    64 bytes from 10.40.67.187: icmp_seq=2 ttl=62 time=0.478 ms
    --- 10.40.67.187 ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 1005ms
    rtt min/avg/max/mdev = 0.320/0.399/0.478/0.079 ms
Актуальная проблема: я не могу пропинговать host2 из Oracle Контейнера

[oracle@b1d3ef32e104 ~] $ ping - c 2 10.40.67.187

    PING 10.40.67.187 (10.40.67.187) 56(84) bytes of data.
    ^C
    --- 10.40.67.187 ping statistics ---
    2 packets transmitted, 0 received, 100% packet loss, time 1023ms

Я использую мостовую сеть по умолчанию docker. firewalld работает на обоих хостах с конфигурацией по умолчанию. host1 имеет 4521 открытый порт для подключения к базе данных

...