OpenVPN Tap Server and Linux dhclient
Posted: Sun Jan 19, 2020 10:55 pm
I learn by trial and error, and this problem was a lot of trial and error... I have a Debian router running DnsMasq (v2.76) as the DHCP server and an OpenVPN (v2.4.0) tap server on the LAN bridge for local clients. I created hook-scripts for Windows clients with OpenVPN such that configuration is done by DHCP with the server running in "DHCP mode" ("server-bridge" only), these scripts work fine. I wanted to do the same for Linux clients with OpenVPN (v2.4.0) so I modified my dash scripts. I am able to obtain a lease using dhclient but only with the server running in the "no-gateway mode" ("server-bridge nogw"). I will give you a description of what I mean. With the only difference between the two following scenarios being the server mode, and with the hook-scripts only setting the device up, this is the difference at the root command prompt trying to obtain a lease;
- with server in DHCP mode ("bridge-server"), note that 192.168.1.193 is the gateway, 192.168.1.194 is a br0 alias for dnsmasq, and 192.168.1.209 is the client wifi link
- with server in no-gateway mode ("bridge-server nogw")
To me, this is impling that in "DHCP mode" the tunnel is not passing information, verified by trying to "ping -I tapbr0 192.168.1.193/194" which failed for both the gateway and dnsmasq. In the "no-gateway mode" I am able to ping dnsmasq only, the gateway fails. These senarios happen with DnsMasq bound to tapbr0/br0 or listening on 192.168.1.194(,127.0.0.1) only. When the hook-scripts are set to only put the tap up and then obtain a lease with dhclient, it works with the server set to "no-gateway mode" but fails when set to "DHCP mode". With "no-gateway mode" the routes (including default) are set by dhclient. Shouldn't OpenVPN be passing the DHCP requests/replys untouched in both senarios? What exactly is the "no routers option" reply? If needed I can post OpenVPN logs and configs as well as script logs, I wasn't sure if they are needed at this point.
Any insight would be appreciated, Dave
- with server in DHCP mode ("bridge-server"), note that 192.168.1.193 is the gateway, 192.168.1.194 is a br0 alias for dnsmasq, and 192.168.1.209 is the client wifi link
Code: Select all
root@user:/home/user# dhclient tapbr0 -v -lf /var/lib/dhcp/dhclient.tapbr0.leases
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/tapbr0/xx:xx:xx:8a:3a:0e
Sending on LPF/tapbr0/xx:xx:xx:8a:3a:0e
Sending on Socket/fallback
DHCPDISCOVER on tapbr0 to 192.168.1.194 port 67 interval 3
DHCPOFFER from 192.168.1.193: no routers option.
DHCPOFFER from 192.168.1.209: no routers option.
DHCPDISCOVER on tapbr0 to 192.168.1.194 port 67 interval 4
DHCPOFFER from 192.168.1.193: no routers option.
DHCPOFFER from 192.168.1.209: no routers option.
DHCPDISCOVER on tapbr0 to 192.168.1.194 port 67 interval 11
DHCPOFFER from 192.168.1.193: no routers option.
DHCPOFFER from 192.168.1.209: no routers option.
...continues
Code: Select all
root@user:/home/user# dhclient tapbr0 -v -lf /var/lib/dhcp/dhclient.tapbr0.leases
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.In
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/tapbr0/xx:xx:xx:8a:3a:0e
Sending on LPF/tapbr0/xx:xx:xx:8a:3a:0e
Sending on Socket/fallback
DHCPDISCOVER on tapbr0 to 192.168.1.194 port 67 interval 3
DHCPREQUEST of 192.168.1.217 on tapbr0 to 192.168.1.194 port 67
DHCPOFFER of 192.168.1.217 from 192.168.1.193
DHCPACK of 192.168.1.217 from 192.168.1.193
dhcp-server-identifier: 4 extra bytes
dhcp-server-identifier: 4 extra bytes
bound to 192.168.1.217 -- renewal in 55 seconds.
Any insight would be appreciated, Dave