18.04 / OpenVPN / SSH / Docker












1















This is an age old problem by looks of searching, but none of the answers seem to help me out. I'm new to VPN's so this has already swallowed several days of research.



I have Ubuntu server 18.04 on a mini pc, running various docker containers with OpenVPN client running on the host, and I access it via web URL's port-forwarded from my router to the host, with OpenVPN down, all works fine. When I bring VPN Tunnel up, all external access is cut off, which from what I read is expected. LAN access works fine (to both the host, and containers running in docker)



So the answer seems to be routing, and I found this :



ip rule add from 192.168.1.90 table 128
ip route add table 128 to 192.168.0.0/16 dev enx00ce39caacd3
ip route add table 128 default via 192.168.1.1


This gives me access to ssh on the host fine, and testing the external IP from console gives me my VPN IP, but none of the docker container URL's work and when I check any of the containers, they have lost their Internet access. I suspect because the docker containers are running in their own range and launching VPN is killing the default routes? So I've been trying to work out how to include the docker to have external VPN access, but allow inbound connections on the host's original public IP?



Pointers gratefully received, this has eaten days already and annoyingly when the box was running the preinstalled Win10 it worked fine :(



IP address for enx00ce39caacd3: 192.168.1.90
IP address for tun0: 172.21.24.45
IP address for br-d3e342478d7c: 172.18.0.1
IP address for br-55176ee6b772: 172.21.0.1
IP address for docker0: 172.17.0.1


Ta!










share|improve this question





























    1















    This is an age old problem by looks of searching, but none of the answers seem to help me out. I'm new to VPN's so this has already swallowed several days of research.



    I have Ubuntu server 18.04 on a mini pc, running various docker containers with OpenVPN client running on the host, and I access it via web URL's port-forwarded from my router to the host, with OpenVPN down, all works fine. When I bring VPN Tunnel up, all external access is cut off, which from what I read is expected. LAN access works fine (to both the host, and containers running in docker)



    So the answer seems to be routing, and I found this :



    ip rule add from 192.168.1.90 table 128
    ip route add table 128 to 192.168.0.0/16 dev enx00ce39caacd3
    ip route add table 128 default via 192.168.1.1


    This gives me access to ssh on the host fine, and testing the external IP from console gives me my VPN IP, but none of the docker container URL's work and when I check any of the containers, they have lost their Internet access. I suspect because the docker containers are running in their own range and launching VPN is killing the default routes? So I've been trying to work out how to include the docker to have external VPN access, but allow inbound connections on the host's original public IP?



    Pointers gratefully received, this has eaten days already and annoyingly when the box was running the preinstalled Win10 it worked fine :(



    IP address for enx00ce39caacd3: 192.168.1.90
    IP address for tun0: 172.21.24.45
    IP address for br-d3e342478d7c: 172.18.0.1
    IP address for br-55176ee6b772: 172.21.0.1
    IP address for docker0: 172.17.0.1


    Ta!










    share|improve this question



























      1












      1








      1








      This is an age old problem by looks of searching, but none of the answers seem to help me out. I'm new to VPN's so this has already swallowed several days of research.



      I have Ubuntu server 18.04 on a mini pc, running various docker containers with OpenVPN client running on the host, and I access it via web URL's port-forwarded from my router to the host, with OpenVPN down, all works fine. When I bring VPN Tunnel up, all external access is cut off, which from what I read is expected. LAN access works fine (to both the host, and containers running in docker)



      So the answer seems to be routing, and I found this :



      ip rule add from 192.168.1.90 table 128
      ip route add table 128 to 192.168.0.0/16 dev enx00ce39caacd3
      ip route add table 128 default via 192.168.1.1


      This gives me access to ssh on the host fine, and testing the external IP from console gives me my VPN IP, but none of the docker container URL's work and when I check any of the containers, they have lost their Internet access. I suspect because the docker containers are running in their own range and launching VPN is killing the default routes? So I've been trying to work out how to include the docker to have external VPN access, but allow inbound connections on the host's original public IP?



      Pointers gratefully received, this has eaten days already and annoyingly when the box was running the preinstalled Win10 it worked fine :(



      IP address for enx00ce39caacd3: 192.168.1.90
      IP address for tun0: 172.21.24.45
      IP address for br-d3e342478d7c: 172.18.0.1
      IP address for br-55176ee6b772: 172.21.0.1
      IP address for docker0: 172.17.0.1


      Ta!










      share|improve this question
















      This is an age old problem by looks of searching, but none of the answers seem to help me out. I'm new to VPN's so this has already swallowed several days of research.



      I have Ubuntu server 18.04 on a mini pc, running various docker containers with OpenVPN client running on the host, and I access it via web URL's port-forwarded from my router to the host, with OpenVPN down, all works fine. When I bring VPN Tunnel up, all external access is cut off, which from what I read is expected. LAN access works fine (to both the host, and containers running in docker)



      So the answer seems to be routing, and I found this :



      ip rule add from 192.168.1.90 table 128
      ip route add table 128 to 192.168.0.0/16 dev enx00ce39caacd3
      ip route add table 128 default via 192.168.1.1


      This gives me access to ssh on the host fine, and testing the external IP from console gives me my VPN IP, but none of the docker container URL's work and when I check any of the containers, they have lost their Internet access. I suspect because the docker containers are running in their own range and launching VPN is killing the default routes? So I've been trying to work out how to include the docker to have external VPN access, but allow inbound connections on the host's original public IP?



      Pointers gratefully received, this has eaten days already and annoyingly when the box was running the preinstalled Win10 it worked fine :(



      IP address for enx00ce39caacd3: 192.168.1.90
      IP address for tun0: 172.21.24.45
      IP address for br-d3e342478d7c: 172.18.0.1
      IP address for br-55176ee6b772: 172.21.0.1
      IP address for docker0: 172.17.0.1


      Ta!







      networking 18.04 openvpn docker






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 7 at 19:22









      mature

      2,1073831




      2,1073831










      asked Feb 7 at 18:52









      tdk1069tdk1069

      62




      62






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          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%2faskubuntu.com%2fquestions%2f1116479%2f18-04-openvpn-ssh-docker%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • 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%2faskubuntu.com%2fquestions%2f1116479%2f18-04-openvpn-ssh-docker%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

          How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

          is 'sed' thread safe

          How to make a Squid Proxy server?