Docker Community Forums

Share and learn in the Docker community.

Container A links to eth0, Container B links to eth1


(Moonsyim) #1

Hello,
my server has 2 network interfaces such as eth0, eth1.

it looks all containers link to docker0 interface and it is bridge to default ‘eth0’.
what I’d like to do this
Container A is linked (bridge) to eth0
Container B is linked (bridge) to eth1

–net=host is not good option to me.

after run container and attach (login into) that container,
from container
ping “ip address of eth0” works
but
ping “ip address of eth1” doesn’t work.

it look container only recognize ip address of eth0 of server, but doesn’t for eth1.
is it true?
otherwise how to make container recognize eth1 (2nd network interface of server)?


(Ralph Kincade) #3

please type “ifconfig -a” and paste the results here

thanks


(Moonsyim) #4

Hi Brikeyes,
Thanks for response.

$ ifconfig -a
docker0 Link encap:Ethernet HWaddr 56:84:7A:FE:97:99
inet addr:172.17.42.1 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::5484:7aff:fefe:9799/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1
RX packets:168551 errors:0 dropped:0 overruns:0 frame:0
TX packets:166664 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:15440791 (14.7 MiB) TX bytes:16799960 (16.0 MiB)

eth0 Link encap:Ethernet HWaddr 02:25:55:32:03:85
inet addr:10.3.90.106 Bcast:10.3.90.255 Mask:255.255.255.0
inet6 addr: fe80::25:55ff:fe32:385/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1
RX packets:582543 errors:0 dropped:0 overruns:0 frame:0
TX packets:324984 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:594245388 (566.7 MiB) TX bytes:28425637 (27.1 MiB)

eth1 Link encap:Ethernet HWaddr 02:C9:76:44:CF:3B
inet addr:10.3.90.60 Bcast:10.3.90.255 Mask:255.255.255.0
inet6 addr: fe80::c9:76ff:fe44:cf3b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1
RX packets:2649 errors:0 dropped:0 overruns:0 frame:0
TX packets:2805 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:119032 (116.2 KiB) TX bytes:148146 (144.6 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:12210 errors:0 dropped:0 overruns:0 frame:0
TX packets:12210 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1158299 (1.1 MiB) TX bytes:1158299 (1.1 MiB)

vetha1d20f6 Link encap:Ethernet HWaddr 32:98:5E:38:FF:3B
inet6 addr: fe80::3098:5eff:fe38:ff3b/64 Scope:Link
UP BROADCAST RUNNING MTU:9001 Metric:1
RX packets:10997 errors:0 dropped:0 overruns:0 frame:0
TX packets:11113 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:982902 (959.8 KiB) TX bytes:1899845 (1.8 MiB)

vethd2f6672 Link encap:Ethernet HWaddr DA:A3:F9:4B:47:56
inet6 addr: fe80::d8a3:f9ff:fe4b:4756/64 Scope:Link
UP BROADCAST RUNNING MTU:9001 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:648 (648.0 b) TX bytes:1086 (1.0 KiB)

vethf4b1590 Link encap:Ethernet HWaddr CE:BF:E7:77:34:0F
inet6 addr: fe80::ccbf:e7ff:fe77:340f/64 Scope:Link
UP BROADCAST RUNNING MTU:9001 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:648 (648.0 b) TX bytes:508 (508.0 b)

$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bc4383fe6baf moonsyim/amazon-linux-ami-cassandra-20150716:0.9 “/bin/bash” 2 minutes ago Up 2 minutes 7000-7001/tcp, 7199/tcp, 9042/tcp, 9160/tcp cassandra2
380a26dc68f2 moonsyim/amazon-linux-ami-cassandra-20150716:0.9 “/bin/bash” 2 minutes ago Up 2 minutes 7000-7001/tcp, 7199/tcp, 9042/tcp, 9160/tcp cassandra1

I’d like
cassandra1 is linked (bridge) to eth0
cassandra2 is linked (bridge) to eth1

attach (login into) cassandra1 container,
$ ping eth0 works, but ping eth1 doesn’t

attach (login into) cassandra2 container, the same,
$ ping eth0 works, but ping eth1 doesn’t

but ping to any other server’s eth0, eth1 works.