Server does not recognize second VirtualBox Adapter
Solution 1
have you got the interface configured in /etc/network/interfaces
? if not add the lines
auto eth1
iface eth1 inet dhcp
and restart
Solution 2
To find your available interfaces use:
ip link
this will show you the interfaces you have, like so:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:1d:bd:93 brd ff:ff:ff:ff:ff:ff
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:c2:c1:92 brd ff:ff:ff:ff:ff:ff
Now add the last interface to the interfaces (in this case enp0s8
)
vi /etc/network/interfaces
Type in [i]
to edit (and move with arrow keys or before [i] hjkl
(left, down, up, right))
auto enp0s8
iface enp0s8 inet dhcp
Save and close with [esc] :wq
Solution 3
For latest versions (18.04) of the Ubuntu, network settings are stored in
/etc/netplan/50-cloud-init.yaml
.
Get device name with
dmesg | grep enp
(enp could be replaced to your device type).Then insert (for device named enp0s8):
enp0s8: addresses: [] dhcp4: true optional: true
Then use
sudo netplan apply
to apply changes.
Solution 4
Ubuntu Server 20.04 LTS uses Netplan for network configuration by default. The default configuration file in that case is /etc/netplan/00-installer-config.yaml
.
-
Get the device name with
ip link
-
Insert the device in the file
/etc/netplan/00-installer-config.yaml
(for example,enp0s8
):
enp0s8:
addresses: [192.168.2.89/24] # example
gateway4: 192.168.2.1
dhcp4: true
- Run
sudo netplan apply
to apply changes.
Check this link for more information.
Related videos on Youtube
Cesar
Updated on September 17, 2022Comments
-
Cesar over 1 year
I have installed Ubuntu Server 10.04 as a guest operating system under VirtualBox 3.2.10. My host system is Ubuntu 9.04
I have configured two network adapters for the guess (a NAT one and a host-only one)
The NAT one is recognized without problems by the guest, but in order to recognize the host-only adapter I have to run
sudo dhclient
, thus making it impossible to run the guest in headless mode.I'm sure I am forgetting something.
When i run
ifconfig
right after login I see two interfaces (eth0 and lo), then after runningsudo dhclient
I see three interfaces (eth0, eth1 and lo)So the question is: How can I make ubuntu to get the IP from the second adapter at boot time in order to be capable of running headless and accessing it via ssh?
-
Jeremy over 13 yearsSorry, but I've got to ask: Did you run
ifconfig
orifconfig -a
?? -
Cesar over 13 years@Jeremy:
ifconfig
but then i see your question and ranifconfig -a
. But the output of both commands is (at least for me) exactly the same. Anyway it appears to be a bug in VirtualBox DHCP server implementation. -
Jeremy over 13 yearsKk, I can't really help you, just wanted to check if the interface was present, but down. Good luck! You could try Oracle <shudder> (Sun) support, if it's a bug in VBox, they'll be all over it.
-
Brian Thomas over 6 yearsyour comment on the dhclient saved me, i was wondering why i cant get adapter 2 to work in any situation. this now has it enrolled, thanks. I have a RHEL so not able to follow @cvrse suggestions.
-
-
Lukasz Kamieniecki-Mruk over 11 yearsIf you would like to avoid the system restart, you can use "sudo service networking restart" instead.
-
Highmastdon over 7 yearsTo figure out what interfaces are available, use
ip link
. It'll show you the interfaces you have. You can then run the commands above, replacingeth1
with what you saw in the previous command -
Riki137 about 7 yearsor just use nano instead of vi! :D
-
rm-vanda over 6 years@Highmastdon - thanks! That was the missing link for me. systemd went from ens3 (the only network adapter aside from lo) - to ens9, and I was trying this^ answer with ens4. Super helpful, thanks!
-
Pandurang Patil over 4 yearsThis one solves the issue with ubuntu 18.04 VM.
-
enrico69 about 4 yearsWorked for me too. Thanks