[SOLVED] Client has no ip addressed assigned

This forum is for admins who are looking to build or expand their OpenVPN setup.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Locked
hudony
OpenVpn Newbie
Posts: 7
Joined: Tue Oct 04, 2011 12:25 pm

[SOLVED] Client has no ip addressed assigned

Post by hudony » Tue Oct 04, 2011 12:29 pm

Hi,

I'm using bridged openvpn server and the openvpn 'dhcp' emulation (server-bridge instruction in my server.conf) to assign ip addresses to my clients. When I connect to it, I see no errrors in logs and everthing seems to be fine. However, the tap0 interface on the client side has no ip address assigned.

If I set up one manually using ifconfig, it works fine and I can browser my local network.

Any idea anyone?

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: Client has no ip addressed assigned

Post by janjust » Tue Oct 04, 2011 12:51 pm

this is "by design" : server-bridge + remote DHCP has the side effect that the openvpn client does not bring up the tap0 interface by itself - this is left to the OS; on windows this is done automagically, on linux you need to run something like 'dhclient tap0' ; this can be added to the client config using

Code: Select all

script-security 2
up /sbin/dhclient tap0

hudony
OpenVpn Newbie
Posts: 7
Joined: Tue Oct 04, 2011 12:25 pm

Re: Client has no ip addressed assigned

Post by hudony » Tue Oct 04, 2011 2:14 pm

Thanks for the answer.

So I can only, if using linux, get an ip from my dhcp server so not from the range defined in the server-bridge instruction?

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: Client has no ip addressed assigned

Post by janjust » Tue Oct 04, 2011 2:29 pm

whoops I may have misread you:

if you use

Code: Select all

server-bridge 10.8.0.1 255.255.255.0 10.8.0.100 10.8.0.200
or something similar then the VPN client Is assigned an address from the 'server-bridge' address pool.

hudony
OpenVpn Newbie
Posts: 7
Joined: Tue Oct 04, 2011 12:25 pm

Re: Client has no ip addressed assigned

Post by hudony » Tue Oct 04, 2011 2:40 pm

Weird :

I have server-bridge

Code: Select all

172.16.0.1 255.255.255.0 172.16.0.90 172.16.0.99
in my server.conf but as I said, I got no ip. When I do

Code: Select all

dhclient tap0
, I receive one but I guess it then comes from the real dhcp server not the openvpn server ip pool.

:?

User avatar
Mimiko
Forum Team
Posts: 1564
Joined: Wed Sep 22, 2010 3:18 am

Re: Client has no ip addressed assigned

Post by Mimiko » Tue Oct 04, 2011 4:16 pm

Will be interesting to see client log with verb 3 where it must ask for ip.

hudony
OpenVpn Newbie
Posts: 7
Joined: Tue Oct 04, 2011 12:25 pm

Re: Client has no ip addressed assigned

Post by hudony » Tue Oct 04, 2011 4:23 pm

Here is a pastebin :

http://pastebin.com/MhrUhwiF

Note that I did ctrl+c at the end.

User avatar
Mimiko
Forum Team
Posts: 1564
Joined: Wed Sep 22, 2010 3:18 am

Re: Client has no ip addressed assigned

Post by Mimiko » Tue Oct 04, 2011 4:40 pm

After using dhclient what ip does tap0 get?

Did you check the firewall on server, may be it blocks input or output packets on bridge for tap end.

hudony
OpenVpn Newbie
Posts: 7
Joined: Tue Oct 04, 2011 12:25 pm

Re: Client has no ip addressed assigned

Post by hudony » Tue Oct 04, 2011 4:54 pm

I receive 172.16.0.241 so obviously not coming from the openvpn pool.

Ya, i used iptables but I was sure everything was correctly set up :

Not that all INPUT and FORWARD are dropped by default :


#OPENVPN
iptables -A INPUT -i $EXTERNAL_INT -m state --state NEW,ESTABLISHED,RELATED -p udp --dport 1194 -j ACCEPT
iptables -A INPUT -i tap0 -j ACCEPT
iptables -A INPUT -i br0 -j ACCEPT
iptables -A FORWARD -i br0 -j ACCEPT
iptables -A FORWARD -i $EXTERNAL_INT -o br0 -m state --state ESTABLISHED,RELATED -j ACCEPT

User avatar
Mimiko
Forum Team
Posts: 1564
Joined: Wed Sep 22, 2010 3:18 am

Re: Client has no ip addressed assigned

Post by Mimiko » Tue Oct 04, 2011 5:28 pm

Interesting problem you have. Can you also check firewall on client for tun adapter?

Show complet server config, the log, the routing table, the interface configuration, and the output of iptables -L -n and iptables -L -t nat.

hudony
OpenVpn Newbie
Posts: 7
Joined: Tue Oct 04, 2011 12:25 pm

Re: Client has no ip addressed assigned

Post by hudony » Tue Oct 04, 2011 8:03 pm

Iptables server : http://pastebin.com/qBehcw1b
IpTables client : http://pastebin.com/sfMamSky

server.conf : http://pastebin.com/ry2tesma
client.conf : http://pastebin.com/ExdzVnWj

server interfaces: http://pastebin.com/b0GLgqej
client interfaces: http://pastebin.com/LHicZf03

Thanks,

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: Client has no ip addressed assigned

Post by janjust » Tue Oct 04, 2011 9:24 pm

your client config contains only 'tls-client', not 'client' : the result is that settings from the server are not pulled in (which I also could not find in the cllient log).

Either use

Code: Select all

client
or add

Code: Select all

pull
to the client config file.

hudony
OpenVpn Newbie
Posts: 7
Joined: Tue Oct 04, 2011 12:25 pm

Re: Client has no ip addressed assigned

Post by hudony » Wed Oct 05, 2011 12:21 pm

That did it!

Thank you guys for your fast answers. Now I'm getting an ip form the pool. :D

Locked