Question

Routing between two interfaces

Posted January 29, 2020 270 views
Ubuntu 18.04

I have a droplet running OpenVPN-AS. I connect to this server to surf the internet when I am using hostile wifi or unsecure networks (OpenVPN client IP 172.27.234.X). The OpenVPN-AS server connects to OpenVPN on a Linksys router to access my internal home network. I can ping and access the IPs on my home network from the server. I would like to route ONLY traffic for my home network over the tunnel on the server.

Info

my iPhone (172.27.234.x) —-connects to—-> OpenVPN-AS Digital Ocean Server (172.19.13.x) —-connects to—-> OpenVPN on Linksys home router —-connects to—-> internal home network (172.16.222.x)

Right now the iPhone connects perfectly routing all traffic through OpenVPN-AS and receiving an IP from OpenVPN-AS of 172.27.234.x.

OpenVPN-AS connects to OpenVPN Linksys

OpenVPN-AS is assigned an IP to tun0 of 172.19.13.x

OpenVPN Linksys allows access to 172.16.222.x

I would like iPhone to be able to client into OpenVPN-AS surf the net from OpenVPN-AS’s internet but be able to access anything in 172.16.222.x.

Here’s OpenVPN-AS’s routing table route-n

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 64.x.x.x 0.0.0.0 UG 0 0 0 eth0
10.46.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
64.x.x.x 0.0.0.0 255.255.240.0 U 0 0 0 eth0
172.16.222.0 172.19.13.1 255.255.255.0 UG 0 0 0 tun0
172.19.13.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0
172.27.224.0 0.0.0.0 255.255.254.0 U 0 0 0 as0t0
172.27.226.0 0.0.0.0 255.255.254.0 U 0 0 0 as0t1
172.27.228.0 0.0.0.0 255.255.254.0 U 0 0 0 as0t2
172.27.230.0 0.0.0.0 255.255.254.0 U 0 0 0 as0t3
172.27.232.0 0.0.0.0 255.255.254.0 U 0 0 0 as0t4
172.27.234.0 0.0.0.0 255.255.254.0 U 0 0 0 as0t5
172.27.236.0 0.0.0.0 255.255.254.0 U 0 0 0 as0t6
172.27.238.0 0.0.0.0 255.255.254.0 U 0 0 0 as0t7

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!