VirtualBox: ifconfig does not show my ip address

0

1

I recently installed centos7 onto virtualbox. I enabled bridged networking on adapter 1 (enp0s3) on the virtualbox manager, to bridge my wireless adapter on the host.

When I type ifconfig on the guest (the VM), I can't see any ip address, and can't access the internet.

ifconfig

Later, I changed the bridged adapter to adapter 3 and then I see an ip address under enp0s3. What gives?

Can someone explain to be the difference between choosing Adapter #'s 1,2,3, and 4? Also, is enp0s3 the adapter I should use? or the third one, virbr0 (not sure what this is)? My guess is the loopback adapter isn't right.

barrrista

Posted 2014-12-29T02:16:53.640

Reputation: 1 519

Depending on how much magic VirtualBox performs, bridging to a wireless adapter is not possible, because it’s a point-to-point connection that doesn’t expect a network on the client end. – Daniel B – 2016-07-12T11:32:59.993

Answers

1

After udev-200, the naming convention of interfaces no longer follows the kernel naming convention. Hence, eth0 no longer exists and something like enp0s3 is the new naming convention. Now the name differ depending on where the ethernet card is on the board.

There is no difference between the adapter number, but there might be a difference if the Attached to is different. Make sure you are using the correct form of attachment to your Host.

virbr0 is a virtual network interface that is used to connect the Host to the Guest in a virtualized environment. You don't really have to worry about it now.

The loopback adapter looks fine.

Digisec

Posted 2014-12-29T02:16:53.640

Reputation: 216

if adapter 1,2,3,4 does not matter, how does VirtualBox know which adapter on the VM side to bridge? e.g. enp0s3 vs. virbr0. – barrrista – 2014-12-31T01:18:48.463

Virbr0 will not work unless it is configured to but enp0s3 might differ if you change adapter. Forget about virbr0. – Digisec – 2014-12-31T01:20:24.933

0

You want to use the enp0s3 adapter. Edit/create /etc/sysconfig/network-scripts/ifcfg-enp0s3 as root and you can set an IP, DNS gateway, set on boot and other options. Then reboot and you should have internet. You also want to run echo "<IP of DNS server>" >> /etc/resolv.conf to set a DNS server if it isn't specified in ifcfg-enp0s3.

You can use this as a template: https://gist.github.com/fernandoaleman/2172388

The part of the UUID, use uuidgen enp0s3 and copy the output and use it for the ifcfg-enp0s3.

xR34P3Rx

Posted 2014-12-29T02:16:53.640

Reputation: 350

Actually, before you continue with my answer, how are your network adapters set up in the vm settings? – xR34P3Rx – 2014-12-29T06:41:49.430

This will only work if your enp0s3 is bridged to your external network. – xR34P3Rx – 2014-12-29T06:44:44.550

Right now it is on VirtualBox: Adapter 2, Bridged Adapter, Wireless LAN PCI (the right one I use on my host), Deny promiscuous mode, and cable connected. – barrrista – 2014-12-29T06:47:22.800

Nah, just edit the IP, DNS1, GATEWAY, subnet mask. That should get you online. – xR34P3Rx – 2014-12-29T06:53:55.310