Use /30 netmask in Debian with bridged adapter in VirtualBox











up vote
0
down vote

favorite












I have Debian 9.6 installed in VirtualBox with bridged adapter. My question is, how to config my interfaces to have /30 netmask? I tried a lot a different things but I can't connect my host to the VM with ssh and so the vm isn't connect to the Internet.



My /etc/network/interfaces conf:



iface enp0s3 inet static
address 10.0.0.2
netmask 255.255.255.252
broadcast 10.0.0.3
gateway 192.168.1.1


and like I said the network conf in VirtualBox is "Bridged Adapter"



192.168.1.1 is my router 192.168.1.50 is my computer. Usualy I don't touch to the netmask because I don't need to touch that, but now I am stuck for a project.



Can someone explain how to config my interfaces to have a working /30 netmask and what is netmask?










share|improve this question




























    up vote
    0
    down vote

    favorite












    I have Debian 9.6 installed in VirtualBox with bridged adapter. My question is, how to config my interfaces to have /30 netmask? I tried a lot a different things but I can't connect my host to the VM with ssh and so the vm isn't connect to the Internet.



    My /etc/network/interfaces conf:



    iface enp0s3 inet static
    address 10.0.0.2
    netmask 255.255.255.252
    broadcast 10.0.0.3
    gateway 192.168.1.1


    and like I said the network conf in VirtualBox is "Bridged Adapter"



    192.168.1.1 is my router 192.168.1.50 is my computer. Usualy I don't touch to the netmask because I don't need to touch that, but now I am stuck for a project.



    Can someone explain how to config my interfaces to have a working /30 netmask and what is netmask?










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have Debian 9.6 installed in VirtualBox with bridged adapter. My question is, how to config my interfaces to have /30 netmask? I tried a lot a different things but I can't connect my host to the VM with ssh and so the vm isn't connect to the Internet.



      My /etc/network/interfaces conf:



      iface enp0s3 inet static
      address 10.0.0.2
      netmask 255.255.255.252
      broadcast 10.0.0.3
      gateway 192.168.1.1


      and like I said the network conf in VirtualBox is "Bridged Adapter"



      192.168.1.1 is my router 192.168.1.50 is my computer. Usualy I don't touch to the netmask because I don't need to touch that, but now I am stuck for a project.



      Can someone explain how to config my interfaces to have a working /30 netmask and what is netmask?










      share|improve this question















      I have Debian 9.6 installed in VirtualBox with bridged adapter. My question is, how to config my interfaces to have /30 netmask? I tried a lot a different things but I can't connect my host to the VM with ssh and so the vm isn't connect to the Internet.



      My /etc/network/interfaces conf:



      iface enp0s3 inet static
      address 10.0.0.2
      netmask 255.255.255.252
      broadcast 10.0.0.3
      gateway 192.168.1.1


      and like I said the network conf in VirtualBox is "Bridged Adapter"



      192.168.1.1 is my router 192.168.1.50 is my computer. Usualy I don't touch to the netmask because I don't need to touch that, but now I am stuck for a project.



      Can someone explain how to config my interfaces to have a working /30 netmask and what is netmask?







      networking virtualbox virtual-machine network-interface






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 24 at 5:22









      Scott

      6,77642650




      6,77642650










      asked Nov 24 at 3:09









      Julien

      1




      1






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Netmask is how many bits of the IP address are for the network, and how many (by subtracing from 32) are for clients or addresses within the subnet. Your issue with the posted config is that the gateway is outside of the configured subnet... so no way to reach it.



          You probably want to reconsider either the network configuration or the type of virtualbox networking that you are using.



          My standard intro to my students (Linux Services) on vbox network types -



          1) NAT - this does what it says. Unfortunately, it doesn't create a matching address on your host machine. The only way to connect is to forward individual ports, just like you would on your home router. This is done in the manager interface, in the settings for the machine, on the networks tab. If you have "NAT" selected as the network type and the card is active/enabled, the Port Forwarding button will be active and available.



          1b) "NAT network" - Like above, but you have to configure a NAT network first. You'll be able to pick subnet, if there is DHCP, etc. If you have multiple VMs on a "NAT network" they can communicate between themselves. You can create multiple "NAT network" names and subnets, they do not see each other unless you go out of your way to set that up.



          2) Bridged - this bridges across one of your ethernet devices in the host machine, and connects directly to the network as if it were plugged in to a jack somewhere. HOWEVER... some work places, schools, etc. do not allow multiple MAC addresses to communicate through a single managed switch port, and if that is the case on whatever LAN you are connecting to it Won't Work.



          3) Host Only - this creates a virtual network between your host machine and the guest(s). There is a dhcp service available, but it won't provide a gateway. If you want your guests to connect, you'll need to set up NAT/etc on the host machine and provide access that way.



          4) Internal only - this connects machines to a virtual internal dumb switch. No DHCP service, no gateway access, nothing. Oh, and no matching adapter on your host machine.



          What I do for a lot of practice/playground/experimentation is set up one machine with 2 interfaces - one on bridged, and one internal. I then turn that into a router machine, with a fake domain (fake.tld) DNS service, DHCP, caching DNS service for the world, etc. and then spin up other VMS to actually experiment and do things with on the internal only network






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            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: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            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%2funix.stackexchange.com%2fquestions%2f483814%2fuse-30-netmask-in-debian-with-bridged-adapter-in-virtualbox%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













            Netmask is how many bits of the IP address are for the network, and how many (by subtracing from 32) are for clients or addresses within the subnet. Your issue with the posted config is that the gateway is outside of the configured subnet... so no way to reach it.



            You probably want to reconsider either the network configuration or the type of virtualbox networking that you are using.



            My standard intro to my students (Linux Services) on vbox network types -



            1) NAT - this does what it says. Unfortunately, it doesn't create a matching address on your host machine. The only way to connect is to forward individual ports, just like you would on your home router. This is done in the manager interface, in the settings for the machine, on the networks tab. If you have "NAT" selected as the network type and the card is active/enabled, the Port Forwarding button will be active and available.



            1b) "NAT network" - Like above, but you have to configure a NAT network first. You'll be able to pick subnet, if there is DHCP, etc. If you have multiple VMs on a "NAT network" they can communicate between themselves. You can create multiple "NAT network" names and subnets, they do not see each other unless you go out of your way to set that up.



            2) Bridged - this bridges across one of your ethernet devices in the host machine, and connects directly to the network as if it were plugged in to a jack somewhere. HOWEVER... some work places, schools, etc. do not allow multiple MAC addresses to communicate through a single managed switch port, and if that is the case on whatever LAN you are connecting to it Won't Work.



            3) Host Only - this creates a virtual network between your host machine and the guest(s). There is a dhcp service available, but it won't provide a gateway. If you want your guests to connect, you'll need to set up NAT/etc on the host machine and provide access that way.



            4) Internal only - this connects machines to a virtual internal dumb switch. No DHCP service, no gateway access, nothing. Oh, and no matching adapter on your host machine.



            What I do for a lot of practice/playground/experimentation is set up one machine with 2 interfaces - one on bridged, and one internal. I then turn that into a router machine, with a fake domain (fake.tld) DNS service, DHCP, caching DNS service for the world, etc. and then spin up other VMS to actually experiment and do things with on the internal only network






            share|improve this answer

























              up vote
              0
              down vote













              Netmask is how many bits of the IP address are for the network, and how many (by subtracing from 32) are for clients or addresses within the subnet. Your issue with the posted config is that the gateway is outside of the configured subnet... so no way to reach it.



              You probably want to reconsider either the network configuration or the type of virtualbox networking that you are using.



              My standard intro to my students (Linux Services) on vbox network types -



              1) NAT - this does what it says. Unfortunately, it doesn't create a matching address on your host machine. The only way to connect is to forward individual ports, just like you would on your home router. This is done in the manager interface, in the settings for the machine, on the networks tab. If you have "NAT" selected as the network type and the card is active/enabled, the Port Forwarding button will be active and available.



              1b) "NAT network" - Like above, but you have to configure a NAT network first. You'll be able to pick subnet, if there is DHCP, etc. If you have multiple VMs on a "NAT network" they can communicate between themselves. You can create multiple "NAT network" names and subnets, they do not see each other unless you go out of your way to set that up.



              2) Bridged - this bridges across one of your ethernet devices in the host machine, and connects directly to the network as if it were plugged in to a jack somewhere. HOWEVER... some work places, schools, etc. do not allow multiple MAC addresses to communicate through a single managed switch port, and if that is the case on whatever LAN you are connecting to it Won't Work.



              3) Host Only - this creates a virtual network between your host machine and the guest(s). There is a dhcp service available, but it won't provide a gateway. If you want your guests to connect, you'll need to set up NAT/etc on the host machine and provide access that way.



              4) Internal only - this connects machines to a virtual internal dumb switch. No DHCP service, no gateway access, nothing. Oh, and no matching adapter on your host machine.



              What I do for a lot of practice/playground/experimentation is set up one machine with 2 interfaces - one on bridged, and one internal. I then turn that into a router machine, with a fake domain (fake.tld) DNS service, DHCP, caching DNS service for the world, etc. and then spin up other VMS to actually experiment and do things with on the internal only network






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                Netmask is how many bits of the IP address are for the network, and how many (by subtracing from 32) are for clients or addresses within the subnet. Your issue with the posted config is that the gateway is outside of the configured subnet... so no way to reach it.



                You probably want to reconsider either the network configuration or the type of virtualbox networking that you are using.



                My standard intro to my students (Linux Services) on vbox network types -



                1) NAT - this does what it says. Unfortunately, it doesn't create a matching address on your host machine. The only way to connect is to forward individual ports, just like you would on your home router. This is done in the manager interface, in the settings for the machine, on the networks tab. If you have "NAT" selected as the network type and the card is active/enabled, the Port Forwarding button will be active and available.



                1b) "NAT network" - Like above, but you have to configure a NAT network first. You'll be able to pick subnet, if there is DHCP, etc. If you have multiple VMs on a "NAT network" they can communicate between themselves. You can create multiple "NAT network" names and subnets, they do not see each other unless you go out of your way to set that up.



                2) Bridged - this bridges across one of your ethernet devices in the host machine, and connects directly to the network as if it were plugged in to a jack somewhere. HOWEVER... some work places, schools, etc. do not allow multiple MAC addresses to communicate through a single managed switch port, and if that is the case on whatever LAN you are connecting to it Won't Work.



                3) Host Only - this creates a virtual network between your host machine and the guest(s). There is a dhcp service available, but it won't provide a gateway. If you want your guests to connect, you'll need to set up NAT/etc on the host machine and provide access that way.



                4) Internal only - this connects machines to a virtual internal dumb switch. No DHCP service, no gateway access, nothing. Oh, and no matching adapter on your host machine.



                What I do for a lot of practice/playground/experimentation is set up one machine with 2 interfaces - one on bridged, and one internal. I then turn that into a router machine, with a fake domain (fake.tld) DNS service, DHCP, caching DNS service for the world, etc. and then spin up other VMS to actually experiment and do things with on the internal only network






                share|improve this answer












                Netmask is how many bits of the IP address are for the network, and how many (by subtracing from 32) are for clients or addresses within the subnet. Your issue with the posted config is that the gateway is outside of the configured subnet... so no way to reach it.



                You probably want to reconsider either the network configuration or the type of virtualbox networking that you are using.



                My standard intro to my students (Linux Services) on vbox network types -



                1) NAT - this does what it says. Unfortunately, it doesn't create a matching address on your host machine. The only way to connect is to forward individual ports, just like you would on your home router. This is done in the manager interface, in the settings for the machine, on the networks tab. If you have "NAT" selected as the network type and the card is active/enabled, the Port Forwarding button will be active and available.



                1b) "NAT network" - Like above, but you have to configure a NAT network first. You'll be able to pick subnet, if there is DHCP, etc. If you have multiple VMs on a "NAT network" they can communicate between themselves. You can create multiple "NAT network" names and subnets, they do not see each other unless you go out of your way to set that up.



                2) Bridged - this bridges across one of your ethernet devices in the host machine, and connects directly to the network as if it were plugged in to a jack somewhere. HOWEVER... some work places, schools, etc. do not allow multiple MAC addresses to communicate through a single managed switch port, and if that is the case on whatever LAN you are connecting to it Won't Work.



                3) Host Only - this creates a virtual network between your host machine and the guest(s). There is a dhcp service available, but it won't provide a gateway. If you want your guests to connect, you'll need to set up NAT/etc on the host machine and provide access that way.



                4) Internal only - this connects machines to a virtual internal dumb switch. No DHCP service, no gateway access, nothing. Oh, and no matching adapter on your host machine.



                What I do for a lot of practice/playground/experimentation is set up one machine with 2 interfaces - one on bridged, and one internal. I then turn that into a router machine, with a fake domain (fake.tld) DNS service, DHCP, caching DNS service for the world, etc. and then spin up other VMS to actually experiment and do things with on the internal only network







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 24 at 3:20









                ivanivan

                3,3831314




                3,3831314






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • 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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2funix.stackexchange.com%2fquestions%2f483814%2fuse-30-netmask-in-debian-with-bridged-adapter-in-virtualbox%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

                    Morgemoulin

                    Scott Moir

                    Souastre