Connect vbox to VPN only











up vote
0
down vote

favorite












I want to connect a VM to a VPN and only to that VPN; shows up as ppp0 in the list.



I cannot select ppp0 in the vbox bridged adapter list. The VPN works fine and I can access it if I just select "NAT" in the vbox network menu; but then my VM can access the internet; which I don't want to happen.



Also I don't want any of my regular traffic going via the VPN.



What would be the best way to go about this?



Note: the VPN is only active some of the time (it connects to a license server for some SW that I use, I need weekly connections to the server)










share|improve this question


























    up vote
    0
    down vote

    favorite












    I want to connect a VM to a VPN and only to that VPN; shows up as ppp0 in the list.



    I cannot select ppp0 in the vbox bridged adapter list. The VPN works fine and I can access it if I just select "NAT" in the vbox network menu; but then my VM can access the internet; which I don't want to happen.



    Also I don't want any of my regular traffic going via the VPN.



    What would be the best way to go about this?



    Note: the VPN is only active some of the time (it connects to a license server for some SW that I use, I need weekly connections to the server)










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I want to connect a VM to a VPN and only to that VPN; shows up as ppp0 in the list.



      I cannot select ppp0 in the vbox bridged adapter list. The VPN works fine and I can access it if I just select "NAT" in the vbox network menu; but then my VM can access the internet; which I don't want to happen.



      Also I don't want any of my regular traffic going via the VPN.



      What would be the best way to go about this?



      Note: the VPN is only active some of the time (it connects to a license server for some SW that I use, I need weekly connections to the server)










      share|improve this question













      I want to connect a VM to a VPN and only to that VPN; shows up as ppp0 in the list.



      I cannot select ppp0 in the vbox bridged adapter list. The VPN works fine and I can access it if I just select "NAT" in the vbox network menu; but then my VM can access the internet; which I don't want to happen.



      Also I don't want any of my regular traffic going via the VPN.



      What would be the best way to go about this?



      Note: the VPN is only active some of the time (it connects to a license server for some SW that I use, I need weekly connections to the server)







      networking virtualbox vpn






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 15 at 2:15









      Adam

      362




      362






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          I would write a script that set specific firewall rules to achieve your goal, in your case, it sounds like you don't want any traffic going out over an unencrypted interface. I use a script that I mostly stole that might help. (on my system my vpn interface is called tun0 ((tunnel 0)).



          sudo ufw reset
          sudo ufw default deny incoming
          sudo ufw default deny outgoing
          sudo ufw allow out on tun0 from any to any
          sudo ufw enable



          Your interface appears to be ppp0 so substitute accordingly.



          This script adjusts the firewall rules so that traffic can only come in or go out over your vpn (tun0, or in your case, ppp0).



          If you somehow drop your vpn connection - all traffic stops until you re-authenticate or revert back to your original firewall policies.



          Along those lines, you'll need a script that undoes all of this if you decide to access the internet with an unsecured connection. (Like if you need to reconnect to your vpn if it decides to drop your connection)



          sudo ufw reset
          sudo ufw default deny incoming
          sudo ufw default allow outgoing
          sudo ufw enable



          Once you get back on your vpn, run the first set of rules to make sure that ppp0 or tun0 or whatever your encrypted interface is called is restricted to your encrypted interface.



          I should point out that you run that first script AFTER you connect to your vpn. If you run it before, you won't be able to connect to your vpn.



          You run the second script after you drop your VPN connection.



          I should also point out that I can't swear on the bible that's going to work in a VM. You can confirm for sure by purposely dropping your vpn connection and watching the traffic via a utilty like bmon. Or you could just try to ping yahoo.com or something like that. Trust me, if you run these rules, all traffic stops the moment that the vpn drops.






          share|improve this answer























            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',
            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%2f1093048%2fconnect-vbox-to-vpn-only%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








            up vote
            0
            down vote













            I would write a script that set specific firewall rules to achieve your goal, in your case, it sounds like you don't want any traffic going out over an unencrypted interface. I use a script that I mostly stole that might help. (on my system my vpn interface is called tun0 ((tunnel 0)).



            sudo ufw reset
            sudo ufw default deny incoming
            sudo ufw default deny outgoing
            sudo ufw allow out on tun0 from any to any
            sudo ufw enable



            Your interface appears to be ppp0 so substitute accordingly.



            This script adjusts the firewall rules so that traffic can only come in or go out over your vpn (tun0, or in your case, ppp0).



            If you somehow drop your vpn connection - all traffic stops until you re-authenticate or revert back to your original firewall policies.



            Along those lines, you'll need a script that undoes all of this if you decide to access the internet with an unsecured connection. (Like if you need to reconnect to your vpn if it decides to drop your connection)



            sudo ufw reset
            sudo ufw default deny incoming
            sudo ufw default allow outgoing
            sudo ufw enable



            Once you get back on your vpn, run the first set of rules to make sure that ppp0 or tun0 or whatever your encrypted interface is called is restricted to your encrypted interface.



            I should point out that you run that first script AFTER you connect to your vpn. If you run it before, you won't be able to connect to your vpn.



            You run the second script after you drop your VPN connection.



            I should also point out that I can't swear on the bible that's going to work in a VM. You can confirm for sure by purposely dropping your vpn connection and watching the traffic via a utilty like bmon. Or you could just try to ping yahoo.com or something like that. Trust me, if you run these rules, all traffic stops the moment that the vpn drops.






            share|improve this answer



























              up vote
              0
              down vote













              I would write a script that set specific firewall rules to achieve your goal, in your case, it sounds like you don't want any traffic going out over an unencrypted interface. I use a script that I mostly stole that might help. (on my system my vpn interface is called tun0 ((tunnel 0)).



              sudo ufw reset
              sudo ufw default deny incoming
              sudo ufw default deny outgoing
              sudo ufw allow out on tun0 from any to any
              sudo ufw enable



              Your interface appears to be ppp0 so substitute accordingly.



              This script adjusts the firewall rules so that traffic can only come in or go out over your vpn (tun0, or in your case, ppp0).



              If you somehow drop your vpn connection - all traffic stops until you re-authenticate or revert back to your original firewall policies.



              Along those lines, you'll need a script that undoes all of this if you decide to access the internet with an unsecured connection. (Like if you need to reconnect to your vpn if it decides to drop your connection)



              sudo ufw reset
              sudo ufw default deny incoming
              sudo ufw default allow outgoing
              sudo ufw enable



              Once you get back on your vpn, run the first set of rules to make sure that ppp0 or tun0 or whatever your encrypted interface is called is restricted to your encrypted interface.



              I should point out that you run that first script AFTER you connect to your vpn. If you run it before, you won't be able to connect to your vpn.



              You run the second script after you drop your VPN connection.



              I should also point out that I can't swear on the bible that's going to work in a VM. You can confirm for sure by purposely dropping your vpn connection and watching the traffic via a utilty like bmon. Or you could just try to ping yahoo.com or something like that. Trust me, if you run these rules, all traffic stops the moment that the vpn drops.






              share|improve this answer

























                up vote
                0
                down vote










                up vote
                0
                down vote









                I would write a script that set specific firewall rules to achieve your goal, in your case, it sounds like you don't want any traffic going out over an unencrypted interface. I use a script that I mostly stole that might help. (on my system my vpn interface is called tun0 ((tunnel 0)).



                sudo ufw reset
                sudo ufw default deny incoming
                sudo ufw default deny outgoing
                sudo ufw allow out on tun0 from any to any
                sudo ufw enable



                Your interface appears to be ppp0 so substitute accordingly.



                This script adjusts the firewall rules so that traffic can only come in or go out over your vpn (tun0, or in your case, ppp0).



                If you somehow drop your vpn connection - all traffic stops until you re-authenticate or revert back to your original firewall policies.



                Along those lines, you'll need a script that undoes all of this if you decide to access the internet with an unsecured connection. (Like if you need to reconnect to your vpn if it decides to drop your connection)



                sudo ufw reset
                sudo ufw default deny incoming
                sudo ufw default allow outgoing
                sudo ufw enable



                Once you get back on your vpn, run the first set of rules to make sure that ppp0 or tun0 or whatever your encrypted interface is called is restricted to your encrypted interface.



                I should point out that you run that first script AFTER you connect to your vpn. If you run it before, you won't be able to connect to your vpn.



                You run the second script after you drop your VPN connection.



                I should also point out that I can't swear on the bible that's going to work in a VM. You can confirm for sure by purposely dropping your vpn connection and watching the traffic via a utilty like bmon. Or you could just try to ping yahoo.com or something like that. Trust me, if you run these rules, all traffic stops the moment that the vpn drops.






                share|improve this answer














                I would write a script that set specific firewall rules to achieve your goal, in your case, it sounds like you don't want any traffic going out over an unencrypted interface. I use a script that I mostly stole that might help. (on my system my vpn interface is called tun0 ((tunnel 0)).



                sudo ufw reset
                sudo ufw default deny incoming
                sudo ufw default deny outgoing
                sudo ufw allow out on tun0 from any to any
                sudo ufw enable



                Your interface appears to be ppp0 so substitute accordingly.



                This script adjusts the firewall rules so that traffic can only come in or go out over your vpn (tun0, or in your case, ppp0).



                If you somehow drop your vpn connection - all traffic stops until you re-authenticate or revert back to your original firewall policies.



                Along those lines, you'll need a script that undoes all of this if you decide to access the internet with an unsecured connection. (Like if you need to reconnect to your vpn if it decides to drop your connection)



                sudo ufw reset
                sudo ufw default deny incoming
                sudo ufw default allow outgoing
                sudo ufw enable



                Once you get back on your vpn, run the first set of rules to make sure that ppp0 or tun0 or whatever your encrypted interface is called is restricted to your encrypted interface.



                I should point out that you run that first script AFTER you connect to your vpn. If you run it before, you won't be able to connect to your vpn.



                You run the second script after you drop your VPN connection.



                I should also point out that I can't swear on the bible that's going to work in a VM. You can confirm for sure by purposely dropping your vpn connection and watching the traffic via a utilty like bmon. Or you could just try to ping yahoo.com or something like that. Trust me, if you run these rules, all traffic stops the moment that the vpn drops.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 15 at 3:11

























                answered Nov 15 at 2:37









                Robert Baker

                669




                669






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1093048%2fconnect-vbox-to-vpn-only%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 change which sound is reproduced for terminal bell?

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                    Can I use Tabulator js library in my java Spring + Thymeleaf project?