Clients with static IP can't reach other clients' subnet

Need help configuring your VPN? Just post here and you'll get that help.

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.
Post Reply
patrickslee
OpenVpn Newbie
Posts: 6
Joined: Sun May 29, 2011 10:43 pm

Clients with static IP can't reach other clients' subnet

Post by patrickslee » Sun May 29, 2011 11:00 pm

Hi there

I have setup a openvpn server on a remote server configured to allow clients to access each other's subnet.

Basic scenario like this:

Server: 192.168.120.0/24
Client1: 192.168.0.0/24
Client2: 10.78.20.0/24

I want client2 connect to the server and be able to access 192.168.0.0/24. I have added the following to server.conf:

Code: Select all

dev tun
push "route 192.168.0.0 255.255.255.0"
route 192.168.0.0 255.255.255.0 default 30 # I have to lower the metric because client1 is the LAN gateway and this route will override the LAN route on client1 and cause the LAN to break
in client1's ccd:

Code: Select all

iroute 192.168.0.0 255.255.255.0
I got this set up working fine. client2 can reach 192.168.0.0/24 and other devices in 192.168.0.0/24 can reach client2.

Then I wanted to configure static IP addresses for the clients. So I added ifconfig-push to the ccds. From that point client2 can't reach client1's subnet anymore, nor the server can.

I noticed that the samples in server.conf had the IP addresses swapped for ifconfig-push but it doesn't matter which way I put it they simply don't work. Remove ifconfig-push and everything worked as expected.

Can anyone think of any explanations?

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

Re: Clients with static IP can't reach other clients' subnet

Post by janjust » Mon May 30, 2011 7:44 am

what values did you use for the 'ifconfig-push' ?
If you're not using 'topology subnet' (which I guess you are not using) then you MUST push addresses from valid /30 network blocks. Each client is assigned a /30 network, which for the ifconfig-push means that

* for the first client you use 'ifconfig-push 192.168.120.6 192.168.120.5'
* for the second client you use 'ifconfig-push 192.168.120.10 192.168.120.9'
* for the third client you use 'ifconfig-push 192.168.120.14 192.168.120.13'

(i.e. +4 every time).

patrickslee
OpenVpn Newbie
Posts: 6
Joined: Sun May 29, 2011 10:43 pm

Re: Clients with static IP can't reach other clients' subnet

Post by patrickslee » Mon May 30, 2011 8:52 am

I am using the default which is net30. And I am doing /30 according to your example.

Would topology subnet be any good to try?

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

Re: Clients with static IP can't reach other clients' subnet

Post by janjust » Mon May 30, 2011 8:58 am

pick any valid /30 network which is different from what is assigned automatically, but which is still part of the original 'server x.x.x.x' range. Try

Code: Select all

ifconfig-push X.X.X.22 X.X.X.21
and reconnect the client; post the relevant part of the server log file, esp the part where it is PUSHing out the configuration to the client. The .22 address should be mentioned there.

patrickslee
OpenVpn Newbie
Posts: 6
Joined: Sun May 29, 2011 10:43 pm

Re: Clients with static IP can't reach other clients' subnet

Post by patrickslee » Mon May 30, 2011 9:14 am

PUSH_REPLY,route 192.168.0.0 255.255.255.0 default 30,route 192.168.120.0 255.255.255.0,topology net30,ping 10,ping-restart 120,ifconfig 192.168.120.22 192.168.120.21

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

Re: Clients with static IP can't reach other clients' subnet

Post by janjust » Mon May 30, 2011 9:58 am

so the right info is pushed to the client - if the client does not use this new IP address then there's something weird going on at the client (is it configured to accept DHCP?).

patrickslee
OpenVpn Newbie
Posts: 6
Joined: Sun May 29, 2011 10:43 pm

Re: Clients with static IP can't reach other clients' subnet

Post by patrickslee » Mon May 30, 2011 10:03 am

The client is using the specified address.

The only difference is that if I use ifconfig-push then I can't reach other client's LAN subnet.

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

Re: Clients with static IP can't reach other clients' subnet

Post by janjust » Mon May 30, 2011 11:19 am

aha , now I get it...
can you try replacing
route 192.168.0.0 255.255.255.0 default 30
with

Code: Select all

route 192.168.0.0 255.255.255.0 vpn_gateway 30
'default' is not a special keyword; also, after client1 has connected, what does the routing table look like (on client1) ?

patrickslee
OpenVpn Newbie
Posts: 6
Joined: Sun May 29, 2011 10:43 pm

Re: Clients with static IP can't reach other clients' subnet

Post by patrickslee » Mon May 30, 2011 8:38 pm

Hm... I have tried that before. Basically I think I have RTFM and tried lots of different combinations. The issue is just if I use ifconfig-push then clients can't see each other's LAN. Actually nor the server can. But if I just let the server assign IPs to clients everything work as expected.

I have decided to live with dynamic IPs for now. I am just wondering if it is a known issue and have a solution.

I will go back and re-visit this if I have time later.

Thanks for your help though.

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

Re: Clients with static IP can't reach other clients' subnet

Post by janjust » Tue May 31, 2011 10:38 am

I have decided to live with dynamic IPs for now. I am just wondering if it is a known issue and have a solution.
it is not a known issue - I've just replicated your setup (without the "route 192.168.0.0 255.255.255.0 default 30") and it works fine : from one client I can ping hosts on the LAN behind another client, even though both clients are assigned static IPs using 'ifconfig-push' .

did you add 'client-to-client' on the server config ? or are you using other means to forward traffic between clients?

patrickslee
OpenVpn Newbie
Posts: 6
Joined: Sun May 29, 2011 10:43 pm

Re: Clients with static IP can't reach other clients' subnet

Post by patrickslee » Tue May 31, 2011 8:00 pm

I do have client-to-client in the config.

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Clients with static IP can't reach other clients' subnet

Post by maikcat » Wed Jun 01, 2011 9:22 am

hi there,

can you post both client/server configs?

Michael.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

Post Reply