Altering subnet to suit local network?

This forum is for admins who are looking to build or expand their OpenVPN setup.
Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
spicypeanut
OpenVpn Newbie
Posts: 2
Joined: Mon Apr 10, 2017 9:56 pm

Altering subnet to suit local network?

Post by spicypeanut » Tue Apr 11, 2017 1:16 am

Seems i posted this in the wrong topic earlier today, hopefully this is a better place.

Hi guys,

Fisrt time ive had to post asking a question, usually i can find a solution myself but this time i've got too many options and i'm not sure where my problem lies.

I'll explain my set up first.

Usually i use OpenVPN on my raspberry pi to connect into my home network so i can keep my traffic secure while traveling. and this has always worked just fine, my browser on iOS always shows my home ip and everyting works just fine. Ive recently moved my raspberry pi to work so i can connect into the network here and this is where is gets a bit tricky.

The network at work is a Billion 8900x router, connected to a standard unmanaged switch, which connects a bunch of Tridonic ConnecDim Gateways together (these are a DALI Lighting control device) the programming of these devices is done via an iPhone app. connected locally, i can see all the gateways on the network, connect to them and configure them. connecting through the VPN however, i can't see any.

From my reading, i suspect this is because the IP i have on the local network is not in the same sub net as the gateways, they are 192.168.1.1xx whereas i think the IP i have is something like 10.8.0.xx?

My question is, can i change the subnet the VPN gives me to the same as the local one? if so how do i do that? or should i use "one to one NAT" which i had read about somewhere else but did not understand at all.

If it helps, its only one client (my iphone) connected to the server at a time.

Any and all information, or pointers in the right direction would be greatly appreciated.

spicypeanut
OpenVpn Newbie
Posts: 2
Joined: Mon Apr 10, 2017 9:56 pm

Re: Altering subnet to suit local network?

Post by spicypeanut » Tue Apr 11, 2017 1:18 am

Server Config
dev tun
proto udp
port 1194
ca /etc/openvpn/easy-rsa/pki/ca.crt
cert /etc/openvpn/easy-rsa/pki/issued/server.crt
key /etc/openvpn/easy-rsa/pki/private/server.key
dh /etc/openvpn/easy-rsa/pki/dh2048.pem
topology subnet
server 10.8.0.0 255.255.255.0
# server and remote endpoints
ifconfig 10.8.0.1 10.8.0.2
# Add route to Client routing table for the OpenVPN Server
push "route 10.8.0.1 255.255.255.255"
# Add route to Client routing table for the OPenVPN Subnet
push "route 10.8.0.0 255.255.255.0"
# your local subnet
push "route 192.168.1.0 255.255.255.0"
# Set your primary domain name server address for clients
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
# Override the Client default gateway by using 0.0.0.0/1 and
# 128.0.0.0/1 rather than 0.0.0.0/0. This has the benefit of
# overriding but not wiping out the original default gateway.
push "redirect-gateway def1"
client-to-client
duplicate-cn
keepalive 10 120
tls-version-min 1.2
tls-auth /etc/openvpn/easy-rsa/pki/ta.key 0
cipher AES-256-CBC
auth SHA256
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
#crl-verify /etc/openvpn/crl.pem
status /var/log/openvpn-status.log 20
status-version 3
log /var/log/openvpn.log
verb 1
# Generated for use by PiVPN.io
Server is set up as such, however does this answer my question? is it a bridge rather than a router i need to set up?

https://openvpn.net/index.php/open-sour ... inuxscript

User avatar
TinCanTech
OpenVPN Protagonist
Posts: 2991
Joined: Fri Jun 03, 2016 1:17 pm

Re: Altering subnet to suit local network?

Post by TinCanTech » Tue Apr 11, 2017 10:10 am


Post Reply