[Solved]Route to only Internal 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.
Locked
maas187
OpenVpn Newbie
Posts: 2
Joined: Sun Jan 11, 2015 10:41 pm

[Solved]Route to only Internal subnets.

Post by maas187 » Sun Jan 11, 2015 10:51 pm

HI all,
Hope you are doing well, I am new to openvpn. I hve setup a simple openvpn server with windows 7 client everything works well.

However this is what I see and I would like to change it if possible:

Current setup:

1 - Client connects to the server via -user/pass.
2 - all traffic go throw the VPN tunnel - my public IP is the remote server external IP. all internet protocols work.

What needs to be done:

1 - Client connects to the server via -user/pass.
2 - Only traffic that intended to go to the remote/internal network. But all other traffic like http/ftp etc use the current router.


Example:

Client NET: 192.168.0.0/24
Remote: 10.0.0.0/24

If I google to check my public IP I still use my client/home IP. But only traffic that should resolve to 10.0.0.0/24 network if routes to the remote network.


I kinda figure that my DNS should be using my remote/internal DNS server, but I believe all that is needed is a route to forward any traffic to 10.0.0.0/24 via VPN tunnel.

Please advise.

Thanks in advance.

:Server Config: - CentOS 5.

Code: Select all

port 1100
proto udp
dev tun
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
reneg-sec 0
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/cloudmain.cloudmgm.com.crt
key /etc/openvpn/easy-rsa/2.0/keys/cloudmain.cloudmgm.com.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so /etc/pam.d/login
client-cert-not-required
username-as-common-name
server 10.8.0.0 255.255.255.0
push "redirect-gateway def1"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 5 30
comp-lzo
persist-key
persist-tun
status 1100.log
verb 3
ifconfig-pool-persist ipp.txt
max-clients 10
log openvpn.log
mute 20

:Client Config:

Code: Select all

client
dev tun
proto udp
remote mydomain 1100 
resolv-retry infinite
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ca mydomain.crt
auth-user-pass
comp-lzo
reneg-sec 0
verb 3

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

Re: Route to only Internal subnets.

Post by maikcat » Mon Jan 12, 2015 9:42 am

2 - Only traffic that intended to go to the remote/internal network. But all other traffic like http/ftp etc use the current router.
comment out the push "redirect-gateway def1" statement and add the following:

Code: Select all

push "route 10.0.0.0 255.0.0.0"
to your server config.

maas187
OpenVpn Newbie
Posts: 2
Joined: Sun Jan 11, 2015 10:41 pm

Re: Route to only Internal subnets.

Post by maas187 » Mon Jan 12, 2015 6:14 pm

Yup that worked like a champ.


Thank you Sir :)

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

Re: [Solved]Route to only Internal subnets.

Post by maikcat » Tue Jan 13, 2015 6:32 am

You welcome.

closing topic.

Regards,

Michael.

Locked