Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How subnet conflicts are resolved? #565

Open
balck-paint opened this issue Jun 6, 2024 · 5 comments
Open

How subnet conflicts are resolved? #565

balck-paint opened this issue Jun 6, 2024 · 5 comments

Comments

@balck-paint
Copy link

balck-paint commented Jun 6, 2024

If two clients are configured with the same subnetwork segment, for example, client A and client B are configured with ccd iroute push 192.168.2.0 255.255.255.0, client C accesses 192.168.2.x, and the server cannot determine who to forward to. Can I implement specified forwarding? For example, what my c really wants to access is the subnet of client B

`
clientA ccd

iroute 192.168.1.0 255.255.255.0
iroute 192.168.2.0 255.255.255.0
`

`
clientB ccd

iroute 192.168.1.0 255.255.255.0
iroute 192.168.2.0 255.255.255.0
`

`
clientC ccd

push "route 192.168.1.0 255.255.255.0"
push "route 192.168.2.0 255.255.255.0"
`

@ordex
Copy link
Member

ordex commented Jun 6, 2024

Hi, your sample CCD files do not truly match what you are saying.
push "route X Y" is telling the client to add a route of what should be sent to the VPN.
With your CCD files above you are telling all three clients to send traffic for those networks to the VPN server.

Now, what will the VPN server do with this traffic? Either this traffic has to go somewhere else (look up the system routing table) or should be redirected to another client.
In the latter case (which is what I think you are referring to), the server needs directives called iroutes and that should be added to the CCD file of the client responsible for that network.

If multiple clients are responsible for the same network, I believe simply keeps the directive of the last client that connected to the server (basically it overwrites any previous directive).

Therefore it's up to you to resolve the conflict somehow.

OTOH if you are using DCO on Linux, iroutes are implemented via system routing table too. Maybe there you can do some tricks and allow similar routes to coexists.

@balck-paint
Copy link
Author

@ordex
Sorry, the configuration I gave was wrong. Corrected. But you understand that right, all I want to do is instruct openvpnServer to redirect to the client I really want to access, how do I do that? Don't have a clue, do you have any good ideas?

@cron2
Copy link
Contributor

cron2 commented Jun 6, 2024

The clients will be assigned unique IP addresses on the VPN interface anyway. So if you want to "access the client", use these.

If you want to access something on the LAN side of the client, and multiple clients use the same subnet, this is not something OpenVPN can fix for you - iroutes must be unique, or it will pick one or the other (first client to connect, or last client to connect, not sure, but "not determined by config").

@ordex
Copy link
Member

ordex commented Jun 6, 2024

@balck-paint maybe you should start from scratch and think about the logic steps you'd need to determine what exact LAN you want to connect to. From there, you may be able to figure out how to implement that on your side.

You wrote "what my c really wants to access is the subnet of client B", but this is not something that can be converted to machine rules. What about other clients? Will the target LAN change over time? if yes, based on what?
After answering all these questions you may be able to start thinking the "how".

This said, I hardly believe OpenVPN alone can help you here.

@schwabe
Copy link
Contributor

schwabe commented Jun 6, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants