RE: I'd like to use the upstream DHCP server when using network sharing.

Thanks for the information.
I've been looking at the source and understand what going on now.  

Mark K Vallevand
Unisys | 651-635-7708 | mark vallevand unisys com 

MATERIAL and is for use only by the intended recipient. If you received this
in error, please contact the sender and delete the e-mail and its
attachments from all devices.

Outside of a dog, a book is man's best friend.
Inside of a dog, it's too dark to read.
-  Groucho

-----Original Message-----
From: Beniamino Galvani <bgalvani redhat com> 
Sent: Wednesday, January 27, 2021 2:26 AM
To: Vallevand, Mark K <Mark Vallevand UNISYS com>
Cc: networkmanager-list gnome org
Subject: Re: I'd like to use the upstream DHCP server when using network

On Tue, Jan 26, 2021 at 07:31:04PM +0000, Vallevand, Mark K wrote:
I'll try to explain.

I have three interfaces.   I'll call them eth0, eth1 and wlan0.
Normally, we create a bridge, br0, and enslave eth0 and eth1.  We assign
IP to br0 (DHCP) and it can access devices connected to eth0 and eth1.
Those devices also can access each other, too.  A DHCP server is upstream
Now, we want to use wlan0 instead of eth0.  So, we create br0 and only
enslave eth1.  Br0 is set to DHCP.
Wlan0 connects to a NAT/PAT access point with WPA2. It serves DHCP.
Everything works as expected.  It gets an address from the access point
Before sharing, we add a config file in
/etc/NetworkManager/dnsmasq-shared.d/.  There is only one setting in the
file.  "interface=br0"  This forces NetworkManager's dnsmasq to only
on br0.  This prevents inference with other dnsmasq instances that we are
We also assign an ipv4.addresses to br0 the br0 connection, so the DHCP
range will be determined.
We enable sharing on br0.  There is some magic that happens here.  I
looked at the code too much.  When br0 is shared, what actually happens?

When sharing is enabled on br0, NM starts dnsmasq to serve DHCP and
DNS requests on the interface. It also enables NAT for the traffic
going out of the interface.

Anyway, NetworkManager seems to use wlan0 without any configuration by us.

NM only enables NAT for traffic originated from the br0 subnet. Then
the kernel uses the routing table to determine where packets go.

Devices behind eth1 get addresses from the correct pool and can access
devices on the other side of the access point.

That's a lot of explanation.  Maybe we are thinking of this backwards.
Should we share wlan0?  Suggestions are welcome.

No, this sounds right.

We'd like to convince NetworkManager's dnsmasq to forward or relay or
DHCP requests so that they are handled by the DHCP server on the access
point.  Suggestions are welcome.

You would need to put the wifi interface and eth1 under the bridge,
but as said previously wifi interfaces can't be used as client in a

Finally, we noticed that traffic originating at br0, say, ping -I br0
x.x.x.x, where x.x.x.x is on the other side of access point, does not
Traffic the other way from br0 to devices behind eth1 will work.

Sorry, I don't know why.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]