Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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"
share|improve this question
add comment

1 Answer

Yes, it is possible.

if you pass "--up cmd" to the openvpn process.

the UP switch is defined as " Shell command to run after successful TUN/TAP device open (pre --user UID change). The up script is useful for specifying route commands which route IP traffic destined for private subnets which exist at the other end of the VPN connection into the tunnel."

share|improve this answer
    
Well I know about this option, but it is depending on current dhcp client application, isn't there anything more universal? And what about windows? –  Ency Nov 27 '11 at 10:25
    
There isn't anything more universal. I would claim that the majority of folks have the vpn server assign the ips dynamically or use static ips defined for the client. –  kormoc Feb 26 '13 at 6:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.