M
M
Maxim Vasiliev2014-11-14 15:38:26
openvpn
Maxim Vasiliev, 2014-11-14 15:38:26

How to make two routes through openvpn and through direct connection?

Available:
1. enterprise network, with dhcp: 192.168.0.0
2. openvpn to connect to it: 172.16.10.0
3. laptop, able to connect via vpn
4. virtual machines on the laptop: 172.16.99.0
I want my virtual machines to be routed to the enterprise network when connecting a laptop and through vpn, and by direct sticking.
For a direct connection, you can issue a permanent address via dhcp and add a static route through it.
For openvpn, you can specify that the virtual network is routed through the client. This adds a static route through the vpn router.
How to combine all this?
PS Well, that is, when you connect a laptop, one of the ways you need to, for example, run a script to switch routes.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Vasiliev, 2015-01-17
@qmax

Solved through client-connect and client-disconnect
client-connect scripts:

if [ "$common_name" = "$имяноута" ]; then
        ip route del виртуалки via ип_ноута_в_LAN
        ip route add виртуалки via $route_vpn_gateway dev $dev
fi

client disconnect:
if [ "$common_name" = "имяноута" ]; then
        ip route del виртуалки via $route_vpn_gateway
        ip route add виртуалки via ип_ноута_в_LAN
fi

S
Sergey, 2014-11-14
@bk0011m

on the openvpn server to the config:
push "route 192.168.0.0 255.255.255.0"
push "route 172.16.10.0 255.255.255.0"
route "172.16.99.0 255.255.255.0"
Do not forget after making the settings in the server config, you need to reboot it. Not the whole server, but a service
in the CLIENT's ccd:
iroute 172.16.99.0 255.255.255.0
Also, your client must be able to drive traffic from your virtual machines to the VPN network. Here you are your own director. And do not forget to make permission on firewalls.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question