I'm using Raspberry Pi to run OpenVPN client. I have 2 client connectios set up, using interfaces
tun0
tun1
The raspberry pi uses interface
eth0
to connect to the internet.
Then I have USB network adapters plugged in for 2 separate LANs, so that's interfaces
eth1
eth2
The output of ifconfig looks like this:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.1.6 netmask 255.255.255.0 broadcast 10.0.1.255
inet6 fe80::ba27:ebff:fed9:22e8 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:d9:22:e8 txqueuelen 1000 (Ethernet)
RX packets 36 bytes 15629 (15.2 KiB)
RX errors 0 dropped 2 overruns 0 frame 0
TX packets 113 bytes 16995 (16.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.110.1 netmask 255.255.255.0 broadcast 192.168.110.255
inet6 fe80::213:3bff:fe9c:bea3 prefixlen 64 scopeid 0x20<link>
ether 00:13:3b:9c:be:a3 txqueuelen 1000 (Ethernet)
RX packets 50 bytes 4871 (4.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 74 bytes 12272 (11.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.91.91 netmask 255.255.255.0 broadcast 192.168.91.255
inet6 fe80::213:3bff:fe9c:baa3 prefixlen 64 scopeid 0x20<link>
ether 00:13:3b:9c:ba:a3 txqueuelen 1000 (Ethernet)
RX packets 41 bytes 2038 (1.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 40 bytes 4972 (4.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 178 bytes 14436 (14.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 178 bytes 14436 (14.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.8.8.2 netmask 255.255.255.0 destination 10.8.8.2
inet6 fe80::9a75:196b:2daf:6e99 prefixlen 64 scopeid 0x20<link>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 9 bytes 1823 (1.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15 bytes 1045 (1.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.8.8.2 netmask 255.255.255.0 destination 10.8.8.2
inet6 fe80::8974:fdcd:d086:bc7e prefixlen 64 scopeid 0x20<link>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 39 bytes 2054 (2.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
The problem is that with the current routing
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.8.8.2 0.0.0.0 UG 0 0 0 tun0
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.8.8.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0
10.8.8.0 0.0.0.0 255.255.255.0 U 0 0 0 tun1
no-mans-land.m2 10.0.1.1 255.255.255.255 UGH 0 0 0 eth0
92.119.176.21 10.0.1.1 255.255.255.255 UGH 0 0 0 eth0
192.168.91.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
192.168.110.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
I don't know how to continue and configure the firewall/router in a way where devices on my network connected to eth1 use tun0 to get to the internet and devices connected to eth2 use tun1 instead.
I used systemd-networkd to set up the network, inspired by this thread VPN Passthrough two ethernet interface - now I try to expand it by adding second VPN connection and use the Raspberry as a dual VPN gateway.
/etc/openvpn/
? – Ingo Aug 27 '19 at 17:45