Closed Aetylus closed 1 year ago
Are you sure you have a dhcp server running on this interface?
Correct me if I'm misunderstanding, but doesn't netavark dhcp-proxy
proxy the host's DHCP to the containers? I'm admittedly unsure exactly if this is case as the documentation here seemed unclear, and only mentions DHCP in the following context:
The next step is to ensure that the DHCP service is running. This handles the DHCP leases from the network. [...] CNI and netavark both use their own DHCP service
If it is the case, then the host does have access to DHCP on its own interface. If not, is there additional documentation detailing proper configuration?
The netavark dhcp proxy requests a dhcp ip from your dhcp server on the network. So yes it uses the same dhcp server as the eth0 interface but it requests a ip for a different mac (the container mac) so you server has to respond to that request.
I don't know what hyperV does but it could be very well that it ignores request for other mac addresses. Or maybe out dhcp request is confusing the server somehow? Or as the error states your server took to long to answer and we timed out. Can you check with something like tcpdump if the dhcp request is being made and if you see a response from the server?
Thanks, that actually clued me into the fact that the Hyper-V VM needed to enable MAC address spoofing enabled for the container to acquire its MAC address. After doing so, it does look like it was able to acquire an IP from the DHCP server.
The only other thing I'm noticing - and maybe this is outside of the scope of this issue - is that while the container is accessible from the main host (that's to say, the Hyper-V host) and other machines on the network through its IP, it's not accessible to the VM host (the Fedora Server 38 host running Podman). Is this expected behavior?
If it is, no worries there though I am curious why, as I would assume it should be accessible from both. If it isn't, I presume it might be related to some unrelated networking configuration and can investigate further.
[Edit] I found this article (https://blog.oddbit.com/post/2018-03-12-using-docker-macvlan-networks/):
With a container attached to a macvlan network, you will find that while it can contact other systems on your local network without a problem, the container will not be able to connect to your host (and your host will not be able to connect to your container). This is a limitation of macvlan interfaces: without special support from a network switch, your host is unable to send packets to its own macvlan interfaces.
While it was written in 2018 and relates to Docker, I presume this limitations are still relevant both today and for Podman.
Yes macvlan bypasses any routing on the host for some reason. This is how the kernel implemented it, there is nothing podman or docker can do to change that fact. We should properly make this more clear in our docs.
I think this might be a bug after all, since it is possible to reach containers from the host by attaching the host to the macvlan bridge (as opposed to the unterlying interface). See e.g. https://wiki.archlinux.org/title/systemd-networkd#MACVLAN_bridge In my case I can bring up a container using --ipam-driver=host-local and then reach the DHCP server from inside the container while --ipam-driver=dhcp fails.
I don't know if this helps, but using wireshark am seeing the DHCP request from the proxy on the underlying interface but not on the macvlan one.
@sarming I don't see how this is related to this issue. Please file anew one and provide exact commands/setup to reproduce and ideally do the package dumps and see where the packages are being send.
Issue Description
Following the instructions detailed in the Podman documentation for Basic Networking, the attempt to run a container in the network (
webserver
) results in the following error:Steps to reproduce the issue
Following the documentation exactly:
Describe the results you received
I receive the error:
Describe the results you expected
I expect the container to be created successfully.
podman info output
Podman in a container
No
Privileged Or Rootless
Privileged
Upstream Latest Release
Yes
Additional environment details
This is running in a Hyper-V VM running Fedora Server 38, using an external network virtual switch.
Additional information
No response