How to route all the traffic from a specific ip address to an openvpn tunnel to a client

Need help configuring your VPN? Just post here and you'll get that help.

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
rdmitry0911
OpenVpn Newbie
Posts: 1
Joined: Sat Jun 24, 2017 7:36 am

How to route all the traffic from a specific ip address to an openvpn tunnel to a client

Post by rdmitry0911 » Sat Jun 24, 2017 7:42 am

Hi guys,

I have openvpn server and some clients. I'd like to route all the traffic from one client to the internet via another client. For example:
  • openvpn server tun network is 10.10.11.0/24
    client 1 tun0 address is 10.10.11.10, eth0 address is 192.168.1.10
    client 2 tun0 address is 10.10.11.20, eth0 address is 192.168.2.10
I'd like client 1 to go to the internet thru client 2's internet connection. The obvious way would be to put
  • iroute 1.0.0.0 255.0.0.0
    iroute 2.0.0.0 255.0.0.0
    iroute 3.0.0.0 255.0.0.0
    . . . . . .

    iroute 254.0.0.0 255.0.0.0
    iroute 255.0.0.0 255.0.0.0
to client 2 ccd file and add some information to the routing table of the openvpn server like this:
  • ip add default 10.10.11.2 table 120
    ip rule add from 10.10.11.10 table 120
this way works fine when there are only client 1 and client 2, but if I want client 3 to go to the internet via clent 4's connection at the same time it doesn't work, as iroute records in client 2 and client 4 ccd files produce ambiguous rules in the routing table. The question is how to make possible to route traffic from client 1 to the internet via client 2's computer and from client3 to the internet via client 4's computer at the same time.

Thank you, Dmitry

Post Reply