Server does not recognize second VirtualBox Adapter

25,636

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.

  1. Get device name with dmesg | grep enp (enp could be replaced to your device type).

  2. Then insert (for device named enp0s8):

    enp0s8:
      addresses: []
      dhcp4: true
      optional: true
    
  3. 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.

Share:
25,636

Related videos on Youtube

Cesar
Author by

Cesar

Updated on September 17, 2022

Comments

  • Cesar
    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 running sudo 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
      Jeremy over 13 years
      Sorry, but I've got to ask: Did you run ifconfig or ifconfig -a ??
    • Cesar
      Cesar over 13 years
      @Jeremy: ifconfig but then i see your question and ran ifconfig -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
      Jeremy over 13 years
      Kk, 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
      Brian Thomas over 6 years
      your 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
    Lukasz Kamieniecki-Mruk over 11 years
    If you would like to avoid the system restart, you can use "sudo service networking restart" instead.
  • Highmastdon
    Highmastdon over 7 years
    To figure out what interfaces are available, use ip link. It'll show you the interfaces you have. You can then run the commands above, replacing eth1 with what you saw in the previous command
  • Riki137
    Riki137 about 7 years
    or just use nano instead of vi! :D
  • rm-vanda
    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
    Pandurang Patil over 4 years
    This one solves the issue with ubuntu 18.04 VM.
  • enrico69
    enrico69 about 4 years
    Worked for me too. Thanks