Comment on How can I set up a VPN that will use the client IP address for the connection?
twinnie@feddit.uk 11 months ago
This can’t feasibly be done over the internet. An IP address must be unique as that’s how it finds it out of billions of other devices. There are situations where the same IP can route to different locations but that’s regional and way beyond what you’re trying to achieve here. It’s how something like 8.8.8.8 works without sending all the requests to a single location.
If your server is sending out traffic as 1.2.3.4 and then tries to send the encrypted traffic to the client at 1.2.3.4 the traffic would either be routed back to itself or the client would receive the plaintext traffic meant for the server.
BearOfaTime@lemm.ee 11 months ago
Depends.
Generally, yea, this isn’t how a client-server VPN works.
If you’re interconnecting two subnets that are part of the same network (say a remote site that uses a subnet of corporate address space) with a site-to-site vpn, then it can make sense. But then the VPN is usually transparent to the devices.
A client using VPN to connect to a VPN server as an entry point would need some kind of subnetting functionality to achieve this, something like what Tailscale does with Subnet Routing. But that would be reproducing the site-to-site, and you’d need to make sure IP addressing is peoperly configured (the remote site needs to be part of the same address space with no conflicts).
If you control both ends, this is possible with proper DHCP scoping/reservations, or just static addresses.
But without really understanding OP’s intent, it’s hard to say.