OpenVPN: Mask remote network IP range












0















I have a VPN setup using OpenVPN and an OpenWrt/LEDE router.



Everything works fine, except when I'm at home (it's my main office) where I have the same setup network wise.



Here's the setup shared by both LANs:



OpenVPN using Tunnelblick client on Mac OS X

Router: 10.0.0.1
Mask: 255.255.255.0
DNS: 10.0.0.1


Doing a tunnel makes that both networks now share the same subnet, which is a bad thing and nothing resolves. Sharing my cellular data works as it's out of the LAN.



Now, I've been looking around for a way to make all VPN IPs masked as 10.0.1.* instead of their real local IPs. Didn't find any quick solution to this.



This way it maps like so:



10.0.1.5 > goes through VPN > 10.0.0.5
10.0.0.5 > stays local > 10.0.0.5


Maybe there's a setting in the OpenVPN client config file I could use to mask all remote IPs to another subnet?










share|improve this question



























    0















    I have a VPN setup using OpenVPN and an OpenWrt/LEDE router.



    Everything works fine, except when I'm at home (it's my main office) where I have the same setup network wise.



    Here's the setup shared by both LANs:



    OpenVPN using Tunnelblick client on Mac OS X

    Router: 10.0.0.1
    Mask: 255.255.255.0
    DNS: 10.0.0.1


    Doing a tunnel makes that both networks now share the same subnet, which is a bad thing and nothing resolves. Sharing my cellular data works as it's out of the LAN.



    Now, I've been looking around for a way to make all VPN IPs masked as 10.0.1.* instead of their real local IPs. Didn't find any quick solution to this.



    This way it maps like so:



    10.0.1.5 > goes through VPN > 10.0.0.5
    10.0.0.5 > stays local > 10.0.0.5


    Maybe there's a setting in the OpenVPN client config file I could use to mask all remote IPs to another subnet?










    share|improve this question

























      0












      0








      0








      I have a VPN setup using OpenVPN and an OpenWrt/LEDE router.



      Everything works fine, except when I'm at home (it's my main office) where I have the same setup network wise.



      Here's the setup shared by both LANs:



      OpenVPN using Tunnelblick client on Mac OS X

      Router: 10.0.0.1
      Mask: 255.255.255.0
      DNS: 10.0.0.1


      Doing a tunnel makes that both networks now share the same subnet, which is a bad thing and nothing resolves. Sharing my cellular data works as it's out of the LAN.



      Now, I've been looking around for a way to make all VPN IPs masked as 10.0.1.* instead of their real local IPs. Didn't find any quick solution to this.



      This way it maps like so:



      10.0.1.5 > goes through VPN > 10.0.0.5
      10.0.0.5 > stays local > 10.0.0.5


      Maybe there's a setting in the OpenVPN client config file I could use to mask all remote IPs to another subnet?










      share|improve this question














      I have a VPN setup using OpenVPN and an OpenWrt/LEDE router.



      Everything works fine, except when I'm at home (it's my main office) where I have the same setup network wise.



      Here's the setup shared by both LANs:



      OpenVPN using Tunnelblick client on Mac OS X

      Router: 10.0.0.1
      Mask: 255.255.255.0
      DNS: 10.0.0.1


      Doing a tunnel makes that both networks now share the same subnet, which is a bad thing and nothing resolves. Sharing my cellular data works as it's out of the LAN.



      Now, I've been looking around for a way to make all VPN IPs masked as 10.0.1.* instead of their real local IPs. Didn't find any quick solution to this.



      This way it maps like so:



      10.0.1.5 > goes through VPN > 10.0.0.5
      10.0.0.5 > stays local > 10.0.0.5


      Maybe there's a setting in the OpenVPN client config file I could use to mask all remote IPs to another subnet?







      networking vpn openvpn openwrt tunnelblick






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 10 at 17:29









      pycvaladepycvalade

      915




      915






















          1 Answer
          1






          active

          oldest

          votes


















          0














          There is no simple solution other then the correct one you appear to want to avoid - You really don't want to be doing this as having the same IP in 2 places in a network breaks things. Unfortunately the correct solution is to move 1 network to a different range.



          Depending in exactly how the network is set up, there are some tricks you can use. Unfortunately these solutions are messy and difficult to debug. First the general stuff:



          You can use netmask to route traffic. A more specific netmask will take precident over a more general one. Thus you can advertise individual IPs across the VPN link so the router knows to prefer that.



          This leaves the problem that, while the router will know how to direct the traffic, the traffic won't get to the router because it's on the LAN. You can fix this by putting static routes for particular IPs with the router gateway on your workstations or move OpenVPN to the workstation. It will also mean that an overlap of IP addresses in your LAN means where the IP is identical on both sites your VPN won't work. You can solve this on a per host basis using source routing if supported by the host. Easy to say, hard to do, not sure that Windows can do it out the box.



          An alternative is to use port mapping and have the VPN server translate your request. IE you request something from 100.0.0.1 and the VPN server uses NAT to rewrite the packet to 10.0.0.1. This is a lot easier but means forsaking DNS or running solution DNS.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1392859%2fopenvpn-mask-remote-network-ip-range%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            There is no simple solution other then the correct one you appear to want to avoid - You really don't want to be doing this as having the same IP in 2 places in a network breaks things. Unfortunately the correct solution is to move 1 network to a different range.



            Depending in exactly how the network is set up, there are some tricks you can use. Unfortunately these solutions are messy and difficult to debug. First the general stuff:



            You can use netmask to route traffic. A more specific netmask will take precident over a more general one. Thus you can advertise individual IPs across the VPN link so the router knows to prefer that.



            This leaves the problem that, while the router will know how to direct the traffic, the traffic won't get to the router because it's on the LAN. You can fix this by putting static routes for particular IPs with the router gateway on your workstations or move OpenVPN to the workstation. It will also mean that an overlap of IP addresses in your LAN means where the IP is identical on both sites your VPN won't work. You can solve this on a per host basis using source routing if supported by the host. Easy to say, hard to do, not sure that Windows can do it out the box.



            An alternative is to use port mapping and have the VPN server translate your request. IE you request something from 100.0.0.1 and the VPN server uses NAT to rewrite the packet to 10.0.0.1. This is a lot easier but means forsaking DNS or running solution DNS.






            share|improve this answer




























              0














              There is no simple solution other then the correct one you appear to want to avoid - You really don't want to be doing this as having the same IP in 2 places in a network breaks things. Unfortunately the correct solution is to move 1 network to a different range.



              Depending in exactly how the network is set up, there are some tricks you can use. Unfortunately these solutions are messy and difficult to debug. First the general stuff:



              You can use netmask to route traffic. A more specific netmask will take precident over a more general one. Thus you can advertise individual IPs across the VPN link so the router knows to prefer that.



              This leaves the problem that, while the router will know how to direct the traffic, the traffic won't get to the router because it's on the LAN. You can fix this by putting static routes for particular IPs with the router gateway on your workstations or move OpenVPN to the workstation. It will also mean that an overlap of IP addresses in your LAN means where the IP is identical on both sites your VPN won't work. You can solve this on a per host basis using source routing if supported by the host. Easy to say, hard to do, not sure that Windows can do it out the box.



              An alternative is to use port mapping and have the VPN server translate your request. IE you request something from 100.0.0.1 and the VPN server uses NAT to rewrite the packet to 10.0.0.1. This is a lot easier but means forsaking DNS or running solution DNS.






              share|improve this answer


























                0












                0








                0







                There is no simple solution other then the correct one you appear to want to avoid - You really don't want to be doing this as having the same IP in 2 places in a network breaks things. Unfortunately the correct solution is to move 1 network to a different range.



                Depending in exactly how the network is set up, there are some tricks you can use. Unfortunately these solutions are messy and difficult to debug. First the general stuff:



                You can use netmask to route traffic. A more specific netmask will take precident over a more general one. Thus you can advertise individual IPs across the VPN link so the router knows to prefer that.



                This leaves the problem that, while the router will know how to direct the traffic, the traffic won't get to the router because it's on the LAN. You can fix this by putting static routes for particular IPs with the router gateway on your workstations or move OpenVPN to the workstation. It will also mean that an overlap of IP addresses in your LAN means where the IP is identical on both sites your VPN won't work. You can solve this on a per host basis using source routing if supported by the host. Easy to say, hard to do, not sure that Windows can do it out the box.



                An alternative is to use port mapping and have the VPN server translate your request. IE you request something from 100.0.0.1 and the VPN server uses NAT to rewrite the packet to 10.0.0.1. This is a lot easier but means forsaking DNS or running solution DNS.






                share|improve this answer













                There is no simple solution other then the correct one you appear to want to avoid - You really don't want to be doing this as having the same IP in 2 places in a network breaks things. Unfortunately the correct solution is to move 1 network to a different range.



                Depending in exactly how the network is set up, there are some tricks you can use. Unfortunately these solutions are messy and difficult to debug. First the general stuff:



                You can use netmask to route traffic. A more specific netmask will take precident over a more general one. Thus you can advertise individual IPs across the VPN link so the router knows to prefer that.



                This leaves the problem that, while the router will know how to direct the traffic, the traffic won't get to the router because it's on the LAN. You can fix this by putting static routes for particular IPs with the router gateway on your workstations or move OpenVPN to the workstation. It will also mean that an overlap of IP addresses in your LAN means where the IP is identical on both sites your VPN won't work. You can solve this on a per host basis using source routing if supported by the host. Easy to say, hard to do, not sure that Windows can do it out the box.



                An alternative is to use port mapping and have the VPN server translate your request. IE you request something from 100.0.0.1 and the VPN server uses NAT to rewrite the packet to 10.0.0.1. This is a lot easier but means forsaking DNS or running solution DNS.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 10 at 19:11









                davidgodavidgo

                43.9k75291




                43.9k75291






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1392859%2fopenvpn-mask-remote-network-ip-range%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                    Alcedinidae

                    RAC Tourist Trophy