Docker networking

From Teknologisk videncenter
Revision as of 07:14, 25 September 2024 by Heth (talk | contribs)
Jump to: navigation, search

docker networks

On a docker swarm

heth@docker1:~$ docker network ls
NETWORK ID     NAME              DRIVER    SCOPE
76a4537b0654   bridge            bridge    local
d6ae77b0b494   docker_gwbridge   bridge    local
cc493462394a   host              host      local
p3lm08ns2mrq   ingress           overlay   swarm
ba8252e136b1   none              null      local

on each node in swarm run:

heth@docker1:~$ docker network inspect ingress | grep Address
                "MacAddress": "02:42:0a:00:00:02",
                "IPv4Address": "10.0.0.2/24",
                "IPv6Address": ""
heth@docker3:~$docker network inspect ingress | grep Address
                "MacAddress": "02:42:0a:00:00:03",
                "IPv4Address": "10.0.0.3/24",
                "IPv6Address": ""
heth@docker3:~$ docker network inspect ingress | grep Address
                "MacAddress": "02:42:0a:00:00:04",
                "IPv4Address": "10.0.0.4/24",
                "IPv6Address": ""

Bridged interfaces

Example

brctl command

Install with (debian like): sudo apt install bridge-utils

heth@ub1:~$ brctl show
bridge name     bridge id               STP enabled     interfaces
br-501d0044fabe         8000.0242a9d6ae8d       no              veth413579c
                                                        veth6d6fce4
                                                        vethd3cbce2
br-ded1f2526def         8000.0242a675d928       no
crc             8000.525400fdbed0       yes
docker0         8000.02420af91289       no              veth180ce2d
virbr0          8000.5254009d12fa       yes
heth@ub1:~$ brctl showmacs br-501d0044fabe
port no mac addr                is local?       ageing timer
  1     02:42:ac:13:00:02       no                 3.96
  2     02:42:ac:13:00:03       no                 3.96
  1     46:b0:4b:02:26:99       yes                0.00
  1     46:b0:4b:02:26:99       yes                0.00
  2     96:fb:5a:ff:2c:9d       yes                0.00
  2     96:fb:5a:ff:2c:9d       yes                0.00
  3     aa:2c:8a:2b:06:81       yes                0.00
  3     aa:2c:8a:2b:06:81       yes                0.00

bridge command

heth@ub1:~$ bridge -d  vlan
port              vlan-id
virbr0            1 PVID Egress Untagged
                    state forwarding
crc               1 PVID Egress Untagged
                    state forwarding
docker0           1 PVID Egress Untagged
                    state forwarding
br-ded1f2526def   1 PVID Egress Untagged
                    state forwarding
veth180ce2d       1 PVID Egress Untagged
                    state forwarding
br-501d0044fabe   1 PVID Egress Untagged
                    state forwarding
veth413579c       1 PVID Egress Untagged
                    state forwarding
vethd3cbce2       1 PVID Egress Untagged
                    state forwarding
veth6d6fce4       1 PVID Egress Untagged
                    state forwarding

Links