Multiple Subnet & Multiple Clients

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
fahmad
OpenVpn Newbie
Posts: 1
Joined: Wed Nov 25, 2015 7:06 pm

Multiple Subnet & Multiple Clients

Post by fahmad » Wed Oct 18, 2017 11:42 am

Hello Everyone,

Following is my setup for OpenVPN Server and Clients.

SERVER = dammam
CLIENT1 = khobar
CLIENT2 = ahsa
CLIENT3 = jubail
CLIENT4 = corniche


SERVER = 192.168.1.0/24, 192.168.11.0/24, 192.168.12.0/24, 192.168.13.0/24, 192.168.14.0/24, 192.168.15.0/24, 192.168.16.0/24 and 192.168.17.0/24
CLIENT 1 = 192.168.3.0/24
CLIENT 2 = 192.168.5.0/24
CLIENT 3 = 192.168.7.0/24 and 192.168.74.0/24
CLIENT 4 = 192.168.80.0/22 and 192.168.84.0/24

VPN SERVER = 192.168.1.33

/etc/sysctl.conf

net.ipv4.ip_forward = 1

iptabels -A FORWARD -i eth0 -o tun0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptabels -A FORWARD -i tun0 -o eth0 -j ACCEPT
iptabels -t nat -A POSTROUTING -o eth0 -j MASQUERADE

My problem is when client with his own ip address connect to different client using vpn i always get VPN address 172.16.100.x which i do not want. I want client ip address to be logged. Can someone please help me in this regards.

server

port 443
proto tcp-server
dev tun
client-config-dir /etc/openvpn/ccd
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key # This file should be kept secret
dh /etc/openvpn/keys/dh.pem
server 172.16.100.0 255.255.255.0
#push "redirect-gateway def1"
#push "route 172.16.100.0 255.255.255.0"
ifconfig-pool-persist ipp.txt
keepalive 10 120
client-to-client
#comp-lzo no
cipher none
persist-key
persist-tun
#status openvpn-status.log
log-append openvpn.log
verb 4

# Dammam Center

route 192.168.1.0 255.255.255.0
route 192.168.11.0 255.255.255.0
route 192.168.12.0 255.255.255.0
route 192.168.13.0 255.255.255.0
route 192.168.14.0 255.255.255.0
route 192.168.15.0 255.255.255.0
route 192.168.16.0 255.255.255.0
route 192.168.17.0 255.255.255.0
push "route 192.168.1.0 255.255.255.0"
push "route 192.168.11.0 255.255.255.0"
push "route 192.168.12.0 255.255.255.0"
push "route 192.168.13.0 255.255.255.0"
push "route 192.168.14.0 255.255.255.0"
push "route 192.168.15.0 255.255.255.0"
push "route 192.168.16.0 255.255.255.0"
push "route 192.168.17.0 255.255.255.0"

# Khobar Center

route 192.168.3.0 255.255.255.0
route 192.168.31.0 255.255.255.0
push "route 192.168.3.0 255.255.255.0"
push "route 192.168.31.0 255.255.255.0"

# Hassa Center

route 192.168.5.0 255.255.255.0
push "route 192.168.5.0 255.255.255.0"

# Jubail Center

route 192.168.7.0 255.255.255.0
route 192.168.74.0 255.255.255.0
push "route 192.168.7.0 255.255.255.0"
push "route 192.168.74.0 255.255.255.0"

# Corniche Center
route 172.16.1.0 255.255.255.252
push "route 172.16.1.0 255.255.255.252"
route 192.168.8.0 255.255.255.0
route 192.168.80.0 255.255.252.0
route 192.168.84.0 255.255.255.0
push "route 192.168.8.0 255.255.255.0"
push "route 192.168.80.0 255.255.252.0"
push "route 192.168.84.0 255.255.255.0"


Thank you.

Post Reply