VirtualBox VMs are not being assigned ip addresses

I am currently trying to set up a network of virtual machines using VirtualBox. I currently have a CentOS vm that I would like to use as a template for other vms but I cannot figure out how to assign an ip to en0s3. According to the video demo this should happen automatcially by using a bridged adapter in the network settings but when I ifconfig from the vm terminal there is no ip assigned to en0s3.
I am unclear how to trouble shoot this issue. I tried updating my version of VirtualBox but that did not work. I am using a MacBook and I read that Mac has a DHCP server that can be set up…is this necessary? I was under the impression that the router is what assigns ip addresses so I’m a little lost. If anyone has any advice I’d greatly appreciate it.


Hello @Anna-Fuenmayor,
Please share the following commands output: -

ip a


and screenshot of VM’s network settings.

KodeKloud Support

Thanks for the reply. I posted the screen shots.

Please share the output of the command: -

ip a

and screenshot of the VM’s network settings.
Please find the attached screenshot.

KodeKloud Support

Hi, here is a screen shot of the vm terminal with the output for ip a and beside it you can see the network settings from the VirtualBox gui.

Hello @Anna-Fuenmayor,


  1. sudo pkill dhclient
  2. sudo dhclient

KodeKloud Support.

so I ran the commands you suggested

then I ran ip a again

Hello @Anna-Fuenmayor,
Try this sudo pkill dhclient then sudo dhclient

If the previous not working, Try the following to set a static IP with the following steps,

Within the directory /etc/sysconfig/network-scripts/ you should find the file ifcfg-INTERFACENAME (Where INTERFACENAME is the name of your interface). Open the correct file for editing with the command sudo nano /etc/sysconfig/network-scripts/ifcfg-<INTERFACENAME> or using vim editor. We need to modify that file in order to not only change the protocol from dhcp to static, but to add the specific IP address. So when you open up that file, you’ll want to change BOOTPROTO=dhcp to BOOTPROTO=static

Now you’ll need to add the entries to set not only the IP address, but the netmask, gateway, and DNS addresses. At the bottom of that file, add the following.






then restart the network service using this command systemctl restart network
Note: you need to check your PC settings first and according to these settings you will set your IP to be in the same network of your PC so you will be able to connect to the VM using putty or mobaxtrem

KodeKloud Support

Thanks for your reply. I do not see an ifcfg file for the interface enp0s3. I only see files for ifcg-lo and ifcg-Wired_connection_1.

I had the same issue, i found the fix below, hope it helps :slight_smile:

  • for issues setting up initial networking, follow this guide. Initialy, my network adapter was set to ‘no’ on boot, meaning it wasn’t turned on automatically. to remedy, i needed to edit /etc/sysconfig/network-scripts/<adaptor_name>
  • Can't SSH into VirtualBox Machine - YouTube
1 Like

Thanks for sharing @chrisdixon_live definitely it will help. :+1:

I have tried both Nat and abridged network setup and there are not any files showing up under the /etc/sysconfig/network-scripts. I am using the centos9 image from the Is there anyway there is a network manager that is causing this issue? However, I do get the output from ip a and ip addr show the lo and enp0s3. Any idea why those files are not being created?


Hi again,

I decided to experiment and tried to download the centos 7 64 bit file from and when I set up my guest I used bridged network. It worked like a champ. able to ping out and able to ping the guest vm from my host (laptop). More experimenting to see if the later downloads require some different instructins.


Thanks for sharing your experience with us, @rsgeinzer