Client
OpenVPN 2.3.9 x86_64-redhat-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Dec 16 2015
CentOS release 6.7
I've tried every combination I can possibly think of to get this working. I think the crux of the issue is that we are having to support RouterOS and standard clients. This is for a standard client, and not at all related to RouterOS - but ROS is the reason we are Bridging.
The issue - DHCP client (dhclient) is unable to get an IP when run as part of "up" or "ipchange"
If it is run manually - there's no issue at all. I can not for the life of me tell what the issue is.
I've confirmed it's being run as root - so no different to my running it myself.
A script (in this case /etc/openvpn/tap-connect) is defined by the conf entry:
...
script-security 2
up /etc/openvpn/tap-start
ipchange /etc/openvpn/tap-connect
down /etc/openvpn/tap-stop
down-pre
...
The relevant line of tap-connect is (normally without the -v it's there while I work out what the heck I'm doing wrong)
/sbin/dhclient -v $dev
Which is being executed as
/sbin/dhclient -v tap0
I get the below, giving the impression that it's asking for an IP address - but the server sees nothing. It's not a firewall issue - DHCP is expressly open on that interface, but I have also tried no firewall at all. Importantly if I manually run the command, it gets an IP without issue.
tap-connect: Configuring tap0 DHCP
tap-connect: /sbin/dhclient -v tap0
tap-connect: Internet Systems Consortium DHCP Client 4.1.1-P1
tap-connect: Copyright 2004-2010 Internet Systems Consortium.
tap-connect: All rights reserved.
tap-connect: For info, please visit https://www.isc.org/software/dhcp/
tap-connect:
tap-connect: Listening on LPF/tap0/b2:ef:59:a4:31:99
tap-connect: Sending on LPF/tap0/b2:ef:59:a4:31:99
tap-connect: Sending on Socket/fallback
tap-connect: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 4 (xid=0x47a6a114)
tap-connect: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 7 (xid=0x47a6a114)
tap-connect: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 15 (xid=0x47a6a114)
tap-connect: DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 19 (xid=0x47a6a114)
What I'm confused about is - why running the command as part of the script fails, why it's not even sending the request out via the interface, and what I can do to resolve it?
P.S. Running it manually yields:
[root@sv001 openvpn]# dhclient -v tap0
Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/tap0/b2:ef:59:a4:31:99
Sending on LPF/tap0/b2:ef:59:a4:31:99
Sending on Socket/fallback
DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 7 (xid=0x748cf3c4)
DHCPOFFER from 10.88.253.254
DHCPREQUEST on tap0 to 255.255.255.255 port 67 (xid=0x748cf3c4)
DHCPACK from 10.88.253.254 (xid=0x748cf3c4)
bound to 10.88.253.102 -- renewal in 245 seconds.