Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    OpenVPN IP conflict (same subnet)

    Scheduled Pinned Locked Moved OpenVPN
    14 Posts 5 Posters 9.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Heli0s
      last edited by

      So I have a number of clients that are connecting to my OpenVPN server. The issue is that a few of them are on the same subnet (192.168.1.1/24) as my server. Is there a way to make it so that when client A connects, I can put them on a different subnet so that there's no conflict between my LAN and theirs?

      1 Reply Last reply Reply Quote 0
      • P
        phil.davis
        last edited by

        The "easy" method is to always use "random" private address space for VPN tunnels and LANs that need to be reached from clients at the other end of a road-warrior VPN. Pick from bits of 10.0.0.0/8 and/or 172.16.0.0/12

        As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
        If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

        1 Reply Last reply Reply Quote 0
        • DerelictD
          Derelict LAYER 8 Netgate
          last edited by

          ~~Why are your clients being assigned addresses from your LAN?

          Do you have the same subnet assigned as your tunnel network as your LAN?

          Don't do that.~~

          Oh.  I see now.  Yeah.  It's up to those who know to protect those who don't by using random RFC1918 IP schemes.

          If you have a specific site-to-site that can't renumber, you have to NAT them.  It might be easier to have them renumber.

          Chattanooga, Tennessee, USA
          A comprehensive network diagram is worth 10,000 words and 15 conference calls.
          DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
          Do Not Chat For Help! NO_WAN_EGRESS(TM)

          1 Reply Last reply Reply Quote 0
          • DerelictD
            Derelict LAYER 8 Netgate
            last edited by

            @phil.davis:

            The "easy" method is to always use "random" private address space for VPN tunnels and LANs

            $ perl randomlan.pl
            10.113.170.0
            172.28.142.0
            192.168.222.0

            Chattanooga, Tennessee, USA
            A comprehensive network diagram is worth 10,000 words and 15 conference calls.
            DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
            Do Not Chat For Help! NO_WAN_EGRESS(TM)

            1 Reply Last reply Reply Quote 0
            • K
              kejianshi
              last edited by

              I use my random fingers to generate those…

              1 Reply Last reply Reply Quote 0
              • P
                phil.davis
                last edited by

                The sites that are not renumbering are the local Cafe… wherever the Road Warrior happens to be sitting sipping coffee at the time.

                As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
                If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

                1 Reply Last reply Reply Quote 0
                • johnpozJ
                  johnpoz LAYER 8 Global Moderator
                  last edited by

                  "I can put them on a different subnet so that there's no conflict between my LAN and theirs?"

                  While your tunnel network for sure should be different than their local network, if your local pfsense 192.168.1.0/24 conflicts with their local network.  Say starbucks is using 192.168.1.0/24 as well - this only matters if trying to access resources on your network.  If just using the tunnel for internet does not matter.  As long as you tunnel network doesn't match up - which it shouldn't since it should be something really small mask /29 for example

                  But how you work out the issue is use something random, say 172.20.122.0/24 or 10.192.14.0/24 for your local network.  Where you still have a problem is if someone used 10/8 for their network.. Which I have seen ;)  Which is why I would prob suggest something odd for 3rd octet in 192.168 since that is always /24 or smaller gives you odds of 1 out of 254 possible octets.  While 172 only gives you 16 different octets they might match on..

                  An intelligent man is sometimes forced to be drunk to spend time with his fools
                  If you get confused: Listen to the Music Play
                  Please don't Chat/PM me for help, unless mod related
                  SG-4860 24.11 | Lab VMs 2.8, 24.11

                  1 Reply Last reply Reply Quote 0
                  • H
                    Heli0s
                    last edited by

                    The clients can access the web without issue, but the do need access to a local asset. I'm also giving them access to the gateway for DNS so that they can use aliases instead of IPs.

                    So it looks like the simplest path is to re-IP my local LAN to something "random" (the third octet). What if I'm unable to do that and can't re-IP the local LAN. Is there a way to avoid conflicts using another method (NAT?)? If so, how would I go about doing that? My tunnel is 10.10.0.0/24, so I'm not really worried for conflicts on that IP (hopefully)

                    1 Reply Last reply Reply Quote 0
                    • DerelictD
                      Derelict LAYER 8 Netgate
                      last edited by

                      Look up 1:1 NAT for an entire network.  You have to NAT both sides.

                      Never use 10.0.0.0/anything, 192.168.0.0/24 or 192.168.1.0/24

                      Renumbering your end is easier, more straightforward, and easier to debug months down the road.

                      Chattanooga, Tennessee, USA
                      A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                      DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                      Do Not Chat For Help! NO_WAN_EGRESS(TM)

                      1 Reply Last reply Reply Quote 0
                      • DerelictD
                        Derelict LAYER 8 Netgate
                        last edited by

                        @johnpoz:

                        But how you work out the issue is use something random, say 172.20.122.0/24 or 10.192.14.0/24 for your local network.  Where you still have a problem is if someone used 10/8 for their network.. Which I have seen ;)  Which is why I would prob suggest something odd for 3rd octet in 192.168 since that is always /24 or smaller gives you odds of 1 out of 254 possible octets.  While 172 only gives you 16 different octets they might match on..

                        Very few people use 172.16/12.  Those that do have a pretty decent chance of having a clue and hopefully dole out /24s which kind of gives you a 1 in 4096 chance at a collision (12 bits).  Probably quite a bit less in reality but probably greater than 1:253 (192.168.0 and 1 are useless.)  But as far as odds go you have to add the countless 10/8-24 and 192.168.0/16 networks you can't collide with so I feel it makes it a better choice.

                        Chattanooga, Tennessee, USA
                        A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                        DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                        Do Not Chat For Help! NO_WAN_EGRESS(TM)

                        1 Reply Last reply Reply Quote 0
                        • H
                          Heli0s
                          last edited by

                          Is there an easy/quick way to re-IP my LAN (everything is on a DHCP/DNS), or do I need to go through everything manually (DHCP, DNS, firewall rules, NAT, etc.)?

                          1 Reply Last reply Reply Quote 0
                          • DerelictD
                            Derelict LAYER 8 Netgate
                            last edited by

                            All you should have to do is change the interface IP, change the DHCP server, then have everything on the interface get new DHCP (reboot, unplug from network for a few secs/plug back in, disable/enable switch ports, release/renew, whatever).

                            If you have DNS entries for local IPs they'll also have to be adjusted.

                            If you are using LAN net in your rules and have automatic outbound NAT, that should catch about everything.  Only you know the rules you have.  Anything that refers to the old network will have to be changed.

                            Chattanooga, Tennessee, USA
                            A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                            DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                            Do Not Chat For Help! NO_WAN_EGRESS(TM)

                            1 Reply Last reply Reply Quote 0
                            • K
                              kejianshi
                              last edited by

                              Derelict is right…

                              It also try that someone out there MIGHT happen to have an IP that will conflict with your setup after you make these changes...
                              But thats just one guy...  Better to have 1 random guy be screwed than lots and lots of people.
                              You are definitely being pointed in the right direction.

                              1 Reply Last reply Reply Quote 0
                              • P
                                phil.davis
                                last edited by

                                Do a quick search of your config file for "192.168.1" - that will quickly show where are the other references to things in 192.168.1.0/24
                                And of course you have to change any clients with hard-coded IP addresses (maybe some Windows servers, a managed switch, an AP or 2, a print server lying around your LAN…)

                                As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
                                If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post
                                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.