Can OpenVPN invoke DHCP Client?
Posted
by
Ency
on Server Fault
See other posts from Server Fault
or by Ency
Published on 2011-11-26T14:31:28Z
Indexed on
2011/11/26
17:57 UTC
Read the original article
Hit count: 444
I have got working VPN connection through openvpn, but I would like to use also my DHCP server and not openvpn's push feature.
Currently everything works fine, but I have to manually start dhcp client, eg. dhclient tap0
and I get IP and other important stuff from my DHCP, is there any directive which start DHCP Client when connection is established?
There is my client's config:
remote there.is.server.com
float
dev tap
tls-client
#pull
port 1194
proto tcp-client
persist-tun
dev tap0
#ifconfig 192.168.69.201 255.255.255.0
#route-up "dhclient tap0"
#dhcp-renew
ifconfig 0.0.0.0 255.255.255.0
ifconfig-noexec
ifconfig-nowarn
ca /etc/openvpn/ca.crt
cert /etc/openvpn/encyNtb_openvpn_client.crt
key /etc/openvpn/encyNtb_openvpn_client.key
dh /etc/openvpn/dh-openvpn.dh
ping 10
ping-restart 120
comp-lzo
verb 5
log-append /var/log/openvpn.log
Here comes server's config:
mode server
tls-server
dev tap0
local servers.ip.here
port 1194
proto tcp-server
server-bridge
# Allow comunication between clients
client-to-client
# Allowing duplicate users per one certificate
duplicate-cn
# CA Certificate, VPN Server Certificate, key, DH and Revocation list
ca /etc/ssl/CA/certs/ca.crt
cert /etc/ssl/CA/certs/openvpn_server.crt
key /etc/ssl/CA/private/openvpn_server.key
dh /etc/ssl/CA/dh/dh-openvpn.dh
crl-verify /etc/ssl/CA/crl.pem
# When no response is recieved within 120seconds, client is disconected
keepalive 10 60
persist-tun
persist-key
user openvpn
group openvpn
# Log and Connected clients file
log-append /var/log/openvpn
verb 3
status /var/run/openvpn/vpn.status 10
# Compression
comp-lzo
#Push data to client
push "route-gateway 192.168.69.1"
push "redirect-gateway def1"
© Server Fault or respective owner