How to add Network Adapter in Oracle VirtualBox

 

Add network adapter (additional) - Oracle VirtualBox

Most of use are already familiar with Oracle VirtualBox which gives us a platform to create Virtual Machines. I am personally a big fan of Oracle VirtualBox software as now I don't have to worry about multiple hardware or server to test different configurations on multiple setups. I can just create multiple VMS, add additional disks, add additional Network Adapter to the VM and continue with my test.

When we create a new VM, by default we only have single single Network Adapter assigned to the VM. Now single network interface should be enough in most cases but if we want to add additional network interface to the same VM then the same can be done very easily. Although for beginners this may look little tricky so I plan to write a step by step tutorial to add additional network adapter to existing VM and steps to be done. Additionally I will share the steps to configure this new network on your Linux server which is installed on the VM.

Advertisement

I have AlmaLinux 8 installed on my VM so my steps would work on distributions like Rocky Linux, Fedora, CentOS etc.

 

Lab Environment

I have already explained about my setup, but let me just put in consolidated order so it is easier for you to understand. I have a Oracle VirtualBox installed on my Windows 10 Laptop where I have created a VM with single network adapter. This VM is installed with AlmaLinux 8. Now I intend to add one more network adapter to this VM for some tests.

 

Step-1: Power Off VM

If your VM is already in powered off state then you can skip this step.

You MUST power off the VM to be able to add additional network adapter in Oracle VirtualBox. From the Linux terminal as root user or using sudo you can execute the following command to power off the VM:

# poweroff

Alternatively, if you do not wish to do a graceful power off then you can also initiate power off using VM's settings. Right-click on the VM in your VirtualBox console and select "Power Off" under "Close" as shown below:
How to add Network Adapter in Oracle VirtualBox

 

Step-2: Access VM's Network Settings

Next open the Network Settings of the VM. Right click on the VM and select Settings as shown below:

Advertisement

How to add Network Adapter in Oracle VirtualBox

 

Step-3: Add additional network adapter in the VM

This will open a new pop-up window with the different Settings option. Click on Network form the left sidebar menu. Next select on Adapter 2 and click on the checkbox to enable this adapter.

Select the Network Type from the drop down menu under Attached to section, in most cases you can select Bridged Adapter. Click on OK once done.

How to add Network Adapter in Oracle VirtualBox

HINT: There is one additional field here Name: which means the device to be used to Bridge the network. In most cases the default network device from your host machine will be selected which should work out of the box. But if you have multiple interfaces on your host server then you can select your preferred device from the drop down menu under Name:

 

Step-4: Power ON the VM

Next we will power on the VM to further complete the network configuration. Again right click on your VM and select Start -> Normal Start to power on the VM.

How to add Network Adapter in Oracle VirtualBox

 

Step-5: Configure network in Linux

Once the VM is powered on, we need to configure the network in our Linux VM to be able to use it. List the available interfaces and their network configuration.

[root@server-1 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:d4:f8:cf brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute enp0s3
       valid_lft 86009sec preferred_lft 86009sec
    inet6 fe80::a00:27ff:fed4:f8cf/64 scope link
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:93:8c:70 brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:c3:ea:45 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:c3:ea:45 brd ff:ff:ff:ff:ff:ff

So, enp0s8 seems to be newly added as enp0s3 was already there on this VM. But we don't see any network IP assigned to this interface so we will have to fix this issue. Ideally in most cases the newly added network adapter should get the IP from DHCP Server (Our HOME or OFFICE Router).

To configure network we will use nmtui tool. Execute nmtui as root user from the terminal which will open a new terminal UI to configure network as shown below

# nmtui

Sample Output:

Advertisement

How to add Network Adapter in Oracle VirtualBox

 

Select Edit a connection using arrow button on your keyboard, using TAB navigate to <OK> and hit ENTER. In the next screen we should be able to see all our network interfaces. But we don't see enp0s8 here. So the configuration file is missing for our newly added network adapter, this is the reason IP was not assigned to this interface,

How to add Network Adapter in Oracle VirtualBox

 

To fix this, we need to manually create a new configuration file for this interface. Navigate to select <Add> and hit ENTER which will show you below prompt to select the type of connection to create. We will create Ethernet Type.

How to add Network Adapter in Oracle VirtualBox

 

In the next screen, we need to provide different details to configure the network for the newly added network adapter.

  • Profile name: This can be any name, this name will be used to create your configuration file.
  • Device: This should be same as interface name
  • ETHERNET: Leave this section empty.
  • IPv4 CONFIGURATION: If you plan to add static IP then you can select Manual instead of Automatic and provide the network details. We will leave it to Automatic to use DHCP for our VM.
  • IPv6 CONFIGURATION: If you plan to add IPv6 IP then you can modify the same by switching to Manual instead of Automatic. We can also change it to Ignore if we don't want to use IPv6. For now I will leave it to Automatic as it will not get any IP Address as I don't have any DHCPv6 server.
  • Automatically connect: Leave this checked to make sure your interface is automatically connected after reboot
  • Available to all users: I think this is self explanatory

How to add Network Adapter in Oracle VirtualBox

 

Click on <OK> to save the configuration. On the next screen now you should be able to see your interface. Navigate the cursor to <Back> to go back to previous terminal:

How to add Network Adapter in Oracle VirtualBox

 

Next we must activate this interface to fetch the IP Address from the DHCP server. We will again use nmtui console to re-activate this interface. You should see the below screen on your nmtui. Select Activate a connection and navigate to <OK>, press ENTER.

How to add Network Adapter in Oracle VirtualBox

 

Select your interface and navigate to Activate. Hit ENTER to Activate the interface.

How to add Network Adapter in Oracle VirtualBox

 

Once the interface is successfully activate, go back to the main screen and Quit the nmtui session.

How to add Network Adapter in Oracle VirtualBox

 

Now you can check, your interface should have a proper IP Address assigned:

[root@server-1 yum.repos.d]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:d4:f8:cf brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic noprefixroute enp0s3
       valid_lft 86399sec preferred_lft 86399sec
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:93:8c:70 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.196/24 brd 192.168.0.255 scope global dynamic noprefixroute enp0s8
       valid_lft 7199sec preferred_lft 7199sec
    inet6 fe80::a00:27ff:fe93:8c70/64 scope link
       valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:c3:ea:45 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default

So we have successfully added additional network adapter to our existing VM in Oracle VirtualBox.

 

Summary

In this tutorial I shared steps to add a new network adapter to our existing Virtual Machine running on Oracle Virtual Box. You can add multiple Network Adapters to any VM and configue network using the steps from this tutorial. Let me know if you face any issues using the comment section.

 

Further Reading

How to configure bridged network in virt-manager (CentOS / RHEL 7)
How to create or configure network bridge in CentOS / RHEL 7/8
How to configure port forwarding in VirtualBox for NAT Networking

 

Didn't find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Leave a Comment