Answer the question
In order to leave comments, you need to log in
How to link multiple client subnets through an OpenVPN server?
Hello dear!
There is a VPN server built on the basis of Ubuntu + OpenVPN, authorization using certificates, white external IP.
There are also three clients that are on their own subnets behind NAT:
Client 1 : subnet 192.168.0.0 255.255.255.0
Client 2 : subnet 192.168.1.0 255.255.255.0
Client 3 : subnet 192.168.2.0 255.255.255.0
VPN network has internal addresses 10.8.0.x, all clients have static addresses (10.8.0.30, 32, 34 respectively).
It was possible to configure access from the server to client subnets.
server.conf fragment
proto tcp
dev tun
server 10.8.0.0 255.255.255.0
client-to-client
client-config-dir ccd
route 192.168.0.0 255.255.255.0
route 192.168.1.0 255.255.255.0
route 192.168.2.0 255.255.255.0
ifconfig-push 10.8.0.30 10.8.0.31
iroute 192.168.2.0 255.255.255.0
Answer the question
In order to leave comments, you need to log in
addition to your configuration.
You can use the
parameter on the server
# this is the IP of the server
ifconfig 10.8.0.1 255.255.255.0
route-gateway 10.8.0.1
route 192.168.0.0 255.255.255.0 10.8.0.30 1
route 192.168.1.0 255.255.255.0
10.8.0.30 255.255.255.0 10.8.0.34 1
and in the files of clients client1 and further by analogy:
ifconfig-push 10.8.0.30 255.255.255.0
iroute 192.168.0.0 255.255.255.0
link
routing must be enabled on the server ip_forward=1
shaazz tried with these settings but didn't work so far.
Full server configuration file:
port 1194
proto tcp
;proto udp
;dev tap
dev tun
topology subnet
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key
dh /etc/openvpn/keys/dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
client-config-dir ccd
ifconfig 10.8.0.1 255.255.255.0
route-gateway 10.8.0.1
route 192.168.0.0 255.255.255.0 10.8.0.32 1
route 192.168.1.0 255.255.255.0 10.8.0.34 1
route 192.168.2.0 255.255.255.0 10.8.0.30 1
client-to-client
keepalive 10 120
tls-auth /etc/openvpn/keys/ta.key 0 # This file is secret
cipher BF-CBC # Blowfish (default)
;cipher AES-128-CBC # AES
;cipher DES-EDE3-CBC # Triple-DES
comp-lzo
max-clients 10
persist-key
persist-tun
status /var/log/openvpn-status.log
log /var/log/openvpn.log
;log-append openvpn.log
verb 3
mute 20
ifconfig-push 10.8.0.30 255.255.255.0
iroute 192.168.2.0 255.255.255.0
ifconfig-push 10.8.0.32 255.255.255.0
iroute 192.168.0.0 255.255.255.0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question