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

and like I said the network conf in VirtualBox is "Bridged Adapter" is my router 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?

1 Answer 1


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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .