Multiple subnets

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.
Post Reply
hillcz
OpenVpn Newbie
Posts: 6
Joined: Wed Oct 11, 2017 5:45 pm

Multiple subnets

Post by hillcz » Wed Oct 11, 2017 5:55 pm

Hi all
Please I need help with server config
I have 3 routers as openvpn clients with 192.168.4.0/24 subnet on lan interface.
I need route trafic 192.168.4.0/24 from client1 with vpn ip 10.8.0.6 to router (10.8.0.2)
trafic 192.168.4.0/24 from client2 with vpn ip 10.8.0.7 to router (10.8.0.3)
and trafic 192.168.4.0/24 from client3 with vpn ip 10.8.0.8 to router (10.8.0.4)
Sorry my english is horryble
THX

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Multiple subnets

Post by TinCanTech » Wed Oct 11, 2017 7:37 pm

Do you mean all the subnets behind each of the routers s the same number .. 192.168.4.0/24 ?

hillcz
OpenVpn Newbie
Posts: 6
Joined: Wed Oct 11, 2017 5:45 pm

Re: Multiple subnets

Post by hillcz » Wed Oct 11, 2017 8:05 pm

Yes all routers have same address range on lan.
I need route trafic from specific client to specific router.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Multiple subnets

Post by TinCanTech » Wed Oct 11, 2017 8:10 pm

That is not how networks work and why the internet has almost run out of IPv4 address space.

hillcz
OpenVpn Newbie
Posts: 6
Joined: Wed Oct 11, 2017 5:45 pm

Re: Multiple subnets

Post by hillcz » Wed Oct 11, 2017 8:23 pm

TinCanTech wrote:That is not how networks work and why the internet has almost run out of IPv4 address space.
And route source address 10.8.0.6 to gw 10.8.0.2
source address 10.8.0.7 to gw 10.8.0.3 ...
Is not possible?

Odesláno z mého SM-G935F pomocí Tapatalk


TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Multiple subnets

Post by TinCanTech » Wed Oct 11, 2017 8:45 pm

Please read this and answer your own question:
HOWTO: Expanding the scope of the VPN to include additional machines

hillcz
OpenVpn Newbie
Posts: 6
Joined: Wed Oct 11, 2017 5:45 pm

Re: Multiple subnets

Post by hillcz » Wed Oct 18, 2017 7:24 am

Hi all
WINDOWS VPN client have address 10.8.0.4 for example
ROUTER as VPN client have address 10.8.0.8 and lan subnet 192.168.4.0/24

Code: Select all

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         x.x.x.1 0.0.0.0         UG    0      0        0 eth0
10.8.0.0        0.0.0.0         255.255.255.0   U     0      0        0 tun0
x.x.x.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
ON VPN server is route table horap

ip rule show

Code: Select all

0:      from all lookup local
32764:  from 10.8.0.4 lookup horap
32765:  from all to 10.8.0.4 lookup horap
32766:  from all lookup main
32767:  from all lookup default
ip route show table horap

Code: Select all

default via 10.8.0.8 dev tun0
192.168.4.0/24 via 10.8.0.8 dev tun0

Code: Select all

ip -s route get 192.168.4.1 from 10.8.0.4 iif tun0
192.168.4.1 from 10.8.0.4 via 10.8.0.8 dev tun0 table horap
    cache  users 1 age 4056sec iif tun0
But tracert is end on 10.8.0.1 (VPN SERVER IP)

THX for help

hillcz
OpenVpn Newbie
Posts: 6
Joined: Wed Oct 11, 2017 5:45 pm

Re: Multiple subnets

Post by hillcz » Thu Jan 11, 2018 12:53 pm

Hi all
If i used TAP instead of TUN
Multiple routing tables are working perfect.
How i can disable internal roiting table in OPENVPN with TUN adapter?
I need route in kernel from openvpn client to openvpn client.

THX

Post Reply