Hello,
I’m trying to create an ipvlan l3 network and I seem to be stuck a little bit. I’m using the Youtube video called Docker networking is CRAZY!! (you NEED to learn it) from NetworkChuck as reference.
When I do an ifconfig
on my host Ubuntu, I find out that my network driver name for that host is enp1s0f0
with the IP 192.168.1.8
.
enp1s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.8 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 _____ prefixlen 64 scopeid 0x20<link>
ether _____ txqueuelen 1000 (Ethernet)
RX packets 9020 bytes 8697667 (8.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4155 bytes 703040 (703.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16
So then using that knowledge, I then create the docker network by doing
docker network create -d ipvlan \
--subnet 192.168.94.0/24 \
-o parent=enp1s0f0 -o ipvlan_mode=l3 \
--subnet 192.168.95.0/24 \
localLab
Then I create 2 containers just to test everything out.
docker run -itd --rm --network localLab --ip 192.168.94.7 --name container1 busybox
and
docker run -itd --rm --network localLab --ip 192.168.94.8 --name container2 busybox
So if I get into container1 and then ping for container2, I get this result
/ # ping container2
PING container2 (192.168.94.8): 56 data bytes
64 bytes from 192.168.94.8: seq=0 ttl=64 time=0.092 ms
64 bytes from 192.168.94.8: seq=1 ttl=64 time=0.109 ms
64 bytes from 192.168.94.8: seq=2 ttl=64 time=0.161 ms
^C
--- container2 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.092/0.120/0.161 ms
/ #
Which is good since I know container1 and container2 can talk to each other. So when I try to go out to the internet by pinging google.com, I get
/ # ping google.com
PING google.com (142.250.191.174): 56 data bytes
^C
--- google.com ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss
/ #
So I know I need to setup the static routes. My router is a Netgear R6020 so when I go to setup, this is how my static routes look like.
So when I go into container1 and try to ping Google again, I still get
/ # ping google.com
PING google.com (142.250.190.142): 56 data bytes
^C
--- google.com ping statistics ---
4 packets transmitted, 0 packets received, 100% packet loss
/ #
So my question is, what am I doing wrong here? I’m looking at this blog post and it looks very very similar to mine except his router is different.
https://4sysops.com/archives/configuring-ipvlan-networking-in-docker/
I’m stuck and I need a little help. I’ve changed the IP Subnet Mask multiple times from 255.255.255.255
to 255.255.255.0
and even did 255.255.0.0
with no dice. Same for the Gateway IP Address. I changed it from 192.168.1.2
to 192.168.1.0
to even 192.168.1.1
and nothing seems to be allowing me to ping the internet from my containers. The containers are able to talk to each other which is fine, but now I need to get to the internet so I can run things like apt-get -y update
and apt-get -y install
and what not on my other containers.