Professional Documents
Culture Documents
in swarm
mode. Below diagram shows the same.
Now, lets initiate consul standlone server using below methods, in this scenario we are using below command to run consul server instead of
systemd.
or
Now lets a create a overlay network on one docker host machine and verify those details reflected on other (131 node) node.
130
131
Note: check the ID of the overlay network which is same on both the machine.
On 130 docker server, lets create container named as source and assign IP address from overlay which was created above.
root@ubuntuserverdemo:~# docker run -d -ti --ip 192.168.0.10 --net visualpath --name source ubuntu:18.04
Unable to find image 'ubuntu:18.04' locally
18.04: Pulling from library/ubuntu
7595c8c21622: Pull complete
d13af8ca898f: Pull complete
70799171ddba: Pull complete
b6c12202c5ef: Pull complete
Digest: sha256:a61728f6128fb4a7a20efaa7597607ed6e69973ee9b9123e3b4fd28b7bba100b
Status: Downloaded newer image for ubuntu:18.04
5fa594bd547c2bff55917b20352a83479fef01ab3caf6bec6d49e8c59027f3f3
root@ubuntuserverdemo:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
5fa594bd547c ubuntu:18.04 "/bin/bash" About a minute ago Up About a minute
source
root@ubuntuserverdemo:~#
root@ubuntuserverdemo:~# docker container inspect --format "{{ .NetworkSettings.Networks.visualpath.IPAddress }}"
source
192.168.0.10
root@ubuntuserverdemo:~#
root@5fa594bd547c:/# ip a
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
6: eth0@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UP group default
link/ether 02:42:c0:a8:00:0a brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 192.168.0.10/24 brd 192.168.0.255 scope global eth0
valid_lft forever preferred_lft forever
9: eth1@if10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:12:00:02 brd ff:ff:ff:ff:ff:ff link-netnsid 1
inet 172.18.0.2/16 brd 172.18.255.255 scope global eth1
valid_lft forever preferred_lft forever
root@5fa594bd547c:/#
root@5fa594bd547c:/#
root@5fa594bd547c:/# ip route
default via 172.18.0.1 dev eth1
172.18.0.0/16 dev eth1 proto kernel scope link src 172.18.0.2
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.10
root@5fa594bd547c:/#
Now login to 131 docker server and create a container to ping source container hosted on 130 docker server:
Note: Let's try to ping container “source” 192.168.0.10 for ubuntuserverdest docker host machine and see it will reject the incoming
packets.
or
root@ubuntuserverdemo:~#
root@ubuntuserverdemo:~# nsenter --net=/var/run/docker/netns/a1c3fa17996a ip addr show eth0
6: eth0@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UP group default
link/ether 02:42:c0:a8:00:0a brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 192.168.0.10/24 brd 192.168.0.255 scope global eth0
valid_lft forever preferred_lft forever
root@ubuntuserverdemo:~#
root@ubuntuserverdemo:~#
root@ubuntuserverdemo:~#
root@ubuntuserverdest:~# docker run -it --rm --net demonet debian ping 192.168.0.100
PING 192.168.0.100 (192.168.0.100): 56 data bytes
64 bytes from 192.168.0.100: icmp_seq=0 ttl=64 time=0.680 ms
64 bytes from 192.168.0.100: icmp_seq=1 ttl=64 time=0.503 ms
root@ubuntuserverdemo:~# sudo tcpdump -pni enp0s3 "port 4789"
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
12:55:53.652322 IP 10.0.0.11.64667 > 10.0.0.10.4789: VXLAN, flags [I] (0x08), vni 256
IP 192.168.0.2 > 192.168.0.100: ICMP echo request, id 1, seq 0, length 64
12:55:53.652409 IP 10.0.0.10.47697 > 10.0.0.11.4789: VXLAN, flags [I] (0x08), vni 256
IP 192.168.0.100 > 192.168.0.2: ICMP echo reply, id 1, seq 0, length 64