Multiple External IP

This forum is for admins who are looking to build or expand their OpenVPN setup.

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
sohaibk
OpenVpn Newbie
Posts: 16
Joined: Thu Jun 10, 2021 11:27 am

Multiple External IP

Post by sohaibk » Tue Jul 25, 2023 6:31 pm

Hi,

I am running openvpn server as VPN provider. I got an IP pool of /24 now I want to offer dedicated IP type service to my clients.
I have setup a X.X.X.2 to main interface and other X.X.X.3 to X.X.X.254 configured as virtual interface.

There are 2 issues:
1- I want to run openvpn on 0.0.0.0/0 to it only connected on primary IP and when i try to connect to other IP it give TLS error.

2- I want to route user through the same IP on which user is connected, for example USER-A connected to X.X.X.10, he should see X.X.X.10 on ipinfo.io

Please guide me how can I achieve this.
thanks

User avatar
ordex
OpenVPN Inc.
Posts: 444
Joined: Wed Dec 28, 2016 2:32 am
Location: IRC #openvpn-devel @ libera.chat

Re: Multiple External IP

Post by ordex » Wed Sep 06, 2023 10:23 pm

Regarding 1, I think you need to add --multihome to your configuration, otherwise replies will always go out via the primary IP and thus receiver will be confused.

Regarding 2, this is not something that OpenVPN controls. It's about how you configure NAT on your system. Basically you want to configure a SNAT/MASQUERADING rule on a per-client basis with the IP to use being the one where the connection was received. Maybe a --client-connect script has all the variables to let you write a custom iptables rule.

Post Reply