Open Airine opened 4 years ago
Hi there! Unfortunately I've been quite busy so the Go rewrite is still in the early stages :(
It makes sense to lose connection after attaching the wired interface to the bridge. I don't think it matters too much, but you should delete the IP address on your wired interface (i.e. sudo ip addr del 192.168.1.72/24 dev enp0s25
). Also, try running your DHCP client in the foreground on the bridge and see what it outputs, as it seems an IP address isn't being acquired (only an autoconfigured one). For dhcpcd
do sudo dhcpcd -B my-bridge
.
My guess is there is some issue with your DHCP setup, as the plugin is also failing to get a lease. Maybe run Wireshark on enp0s25
and see if the DHCP packets are going while dhcpcd
is running?
Hope this helps, let me know how it goes.
Hi devplayer0!
Thanks for your help!
Following your instructions, I firstly test dhcpcd
with dhcpcd -N enp0s25
to renew the lease of enp0s25
. As shown in the screenshot, it works fine. And this time, my-bridge
successfully got the IP address 192.168.1.135
by dhcpcd -B
my-bridge. Also, after sudo ip add del 192.168.1.131/24 dev enp0s25
, I got the internet connection again.
But, the timeout error still occurred:
docker: Error response from daemon: failed to create endpoint infallible_bohr on network my-dhcp-net: NetworkDriver.CreateEndpoint: Timed out waiting for lease from udhcpc.
From the Wireshark log, it seems that the DHCP client run by the plugin keeps sending the DHCP Discover but the DHCP server did not send back the DHCP offer so that the DHCP process ended in the first step.
Can you see what's the problem so far? Do I need to provide more information?
Again, thanks a lot for your help!
Wireshark sreenshot:
Command history:
root@aaron-ubuntu:/home/aaron# ip link add my-bridge type bridge
root@aaron-ubuntu:/home/aaron# ip link set my-bridge up
root@aaron-ubuntu:/home/aaron# dhcpcd -B my-bridge
sending commands to master dhcpcd process
root@aaron-ubuntu:/home/aaron# dhcpcd -N enp0s25
sending commands to master dhcpcd process
root@aaron-ubuntu:/home/aaron# ip link set enp0s25 up
root@aaron-ubuntu:/home/aaron# dhcpcd -N enp0s25
sending commands to master dhcpcd process
root@aaron-ubuntu:/home/aaron# ip link set enp0s25 master my-bridge
root@aaron-ubuntu:/home/aaron# ifconfig
enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.131 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::65c5:4d45:e034:cb4 prefixlen 64 scopeid 0x20<link>
inet6 fe80::1b2e:f498:f36e:da79 prefixlen 64 scopeid 0x20<link>
ether 28:d2:44:09:7b:3f txqueuelen 1000 (Ethernet)
RX packets 1097 bytes 735998 (735.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1039 bytes 158739 (158.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xf1500000-f1520000
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 175 bytes 12449 (12.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 175 bytes 12449 (12.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
my-bridge: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 169.254.41.168 netmask 255.255.0.0 broadcast 169.254.255.255
inet6 fe80::ae38:da4c:9885:8550 prefixlen 64 scopeid 0x20<link>
ether 28:d2:44:09:7b:3f txqueuelen 1000 (Ethernet)
RX packets 37 bytes 3998 (3.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 46 bytes 7064 (7.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp3s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether f4:b7:e2:c8:11:09 txqueuelen 1000 (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
root@aaron-ubuntu:/home/aaron# dhcpcd -B my-bridge
sending commands to master dhcpcd process
root@aaron-ubuntu:/home/aaron# ifconfig
enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.131 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::65c5:4d45:e034:cb4 prefixlen 64 scopeid 0x20<link>
inet6 fe80::1b2e:f498:f36e:da79 prefixlen 64 scopeid 0x20<link>
ether 28:d2:44:09:7b:3f txqueuelen 1000 (Ethernet)
RX packets 1165 bytes 742995 (742.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1140 bytes 168403 (168.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xf1500000-f1520000
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 175 bytes 12449 (12.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 175 bytes 12449 (12.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
my-bridge: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.135 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::ae38:da4c:9885:8550 prefixlen 64 scopeid 0x20<link>
ether 28:d2:44:09:7b:3f txqueuelen 1000 (Ethernet)
RX packets 105 bytes 9771 (9.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 67 bytes 9208 (9.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp3s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether f4:b7:e2:c8:11:09 txqueuelen 1000 (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
root@aaron-ubuntu:/home/aaron# ip addr del 192.168.1.131/24 dev enp0s25
root@aaron-ubuntu:/home/aaron# ifconfig
enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::65c5:4d45:e034:cb4 prefixlen 64 scopeid 0x20<link>
inet6 fe80::1b2e:f498:f36e:da79 prefixlen 64 scopeid 0x20<link>
ether 28:d2:44:09:7b:3f txqueuelen 1000 (Ethernet)
RX packets 1284 bytes 772995 (772.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1343 bytes 189160 (189.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xf1500000-f1520000
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 192 bytes 14179 (14.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 192 bytes 14179 (14.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
my-bridge: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.135 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::ae38:da4c:9885:8550 prefixlen 64 scopeid 0x20<link>
ether 28:d2:44:09:7b:3f txqueuelen 1000 (Ethernet)
RX packets 223 bytes 37577 (37.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 133 bytes 16857 (16.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp3s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether f4:b7:e2:c8:11:09 txqueuelen 1000 (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
root@aaron-ubuntu:/home/aaron# docker network create -d devplayer0/net-dhcp:latest --ipam-driver null -o bridge=my-bridge my-dhcp-net
8679ea85842bc962bd6e2a233a86d88e256a2287b192b1180fe543afc2c6d9eb
root@aaron-ubuntu:/home/aaron# docker run --rm -ti --network my-dhcp-net alpine
docker: Error response from daemon: failed to create endpoint infallible_bohr on network my-dhcp-net: NetworkDriver.CreateEndpoint: Timed out waiting for lease from udhcpc.
Hi @devplayer0 ! How are you doing these days? I have found another alternative to do my experiment, but your plugin is still the most suitable one. Looking forward to your reply when you're free.
Hey, sorry for not getting back to you. Thanks for sending on the screenshot.
Good you got DHCP going on your bridge, strange it's not working for the plugin. Any chance you could run Wireshark on the Ethernet interface only and send me a .pcap
so I can take a look at the requests being sent out?
I experience the same Issue and recorded the dhcp reqest beeing send:
TIME: 2020-12-28 16:34:46.401
IP: 0.0.0.0 (e2:b9:3c:6b:28:94) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
HLEN: 6
HOPS: 0
XID: 727d4a71
SECS: 10
FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: e2:b9:3c:6b:28:94:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION: 53 ( 1) DHCP message type 1 (DHCPDISCOVER)
OPTION: 61 ( 7) Client-identifier 01:e2:b9:3c:6b:28:94
OPTION: 57 ( 2) Maximum DHCP message size 576
OPTION: 55 ( 7) Parameter Request List 1 (Subnet mask)
3 (Routers)
6 (DNS server)
12 (Host name)
15 (Domainname)
28 (Broadcast address)
42 (NTP servers)
OPTION: 60 ( 6) Vendor class identifier docker
I've come back to work on the rewrite at last! If you're still interested, see https://github.com/devplayer0/docker-net-dhcp/issues/12#issuecomment-856267625 for a brief explanation on my progress.
I've released the Go rewrite, feel free to try it out and let me know if this is still an issue.
Hi @devplayer0 !
How is going with the
golang
version? Is thegolang
branch ready to run?I am currently doing an experiment on my wireless bandwidth allocation system, and want to use docker containers to simulate the users. The problem I am facing is how to allocate IP address using the DHCP service on my router. So, the router can see the IP address of containers and control the bandwidth of them accordingly.
After days of searching and testing, I found you repo, which should perfectly solve my problem. But following your configuration guide, I got stuck on the last step like #2.
Set up commands:
Below is the log:
Could you help to localize the error I might have? I got no internet connection after command
ip link set enp0s25 master my-bridge
Could you release a golang (stable) version or give some instructions on how to compile the golang branch locally?
Looking forward to your reply and I appreciate your help very much!