Hello,
After some time of intensive Googling and a lot of attempts, I've decided to ask a question here.
I have 2 outgoing interfaces with the below configuration:
auto enp0s3
iface enp0s3 inet dhcp
metric 100
auto enp0s8
iface enp0s8 inet dhcp
metric 200
Route table:
default via 192.168.1.1 dev enp0s3 metric 100
default via 192.168.42.129 dev enp0s8 metric 200
What I'm trying to achieve is to have 2 instances of OpenVPN running in p2p mode (one on each interface). Both will be configured with remote option.
So I'd like to have first OpenVPN's instance (client_01) connected using
default via 192.168.1.1 dev enp0s3 metric 100
and the second (client_02) connected using
default via 192.168.42.129 dev enp0s8 metric 200
However, I found that --local OpenVPN's option doesn't work as expected in that case (OpenVPN tries to send packets with IP address of enp0s8 via enp0s3, which is really weird). Moreover, I'm forced to use DHCP for that, so specifying IP address rather than outgoing interface might be a problem (it might be workarounded, however, I'd like to have a clean solution for that).
With curl, ping, traceroute everything works as expected:
# curl --interface enp0s8 'http://api.ipify.org?format=json'
{"ip":"PUBLIC_IP_1"}
# curl --interface enp0s3 'http://api.ipify.org?format=json'
{"ip":"PUBLIC_IP_2"}
My client and server configuration is pretty simple:
proto tcp
remote REMOTE_IP
dev tun
ifconfig 10.8.0.2 10.8.0.1
secret static.key
Server configuration is basically the same (missing remote and swapped ifconfig values).
Could you please tell me how I can achieve configuration like that?
Thanks!