Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add Virtual Network Devices to Ubuntu VirtualBox operating system

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the Ubuntu VirtualBox operating system how to add virtual network equipment, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.

First of all, let you know about Ubuntu VirtualBox, and then a comprehensive introduction to Ubuntu VirtualBox, I hope it will be useful to you. Generally speaking, after installing Ubuntu VirtualBox to set up the network, choose the default NAT mode, Guest can be connected smoothly, but this method is more rigid, in order to make more flexible changes, we should adopt the bridge mode (Bridged)

The bridge mode here is like the Bridged mode in VMware. Host and Guest have the same status in the local area network (LAN). Refer to the user manual file UserManual.pdf configuration that is placed in the Ubuntu VirtualBox directory after Ubuntu VirtualBox installation:

1. On Debian-and Ubuntu-based systems, the first step is to install uml-utilities, a tool for building virtual network devices (TAP interfaces), and bridge-utils, a bridge tool:

Sudo apt-get install uml-utilities

Sudo apt-get install bridge-utils

In order for your virtual machine to access the network interface, you must add the user name of the user running the virtual host (usually your ubuntu login user name) to the uml-net user group (replace the "vboxuser" with your user name):

Sudo gpasswd-a vboxuser uml-net

Note: in order for the changes to take effect, please restart your computer.

two。 Describe the virtual network device you want to add to your Debian or ubuntu operating system and edit / etc/network/interfaces:

Sudo vim / etc/network/interfaces

Add the following after the open file, name the virtual network interface "tap0", specify that the interface IP configuration method is manual, and specify the user who uses the interface (please replace the "vboxuser" with your user name):

Auto tap0

Iface tap0 inet manual

Up ifconfig $IFACE 0.0.0.0 up

Down ifconfig $IFACE down

Tunctl_user vboxuser

3. * use the virtual network interface and network bridge you just established to activate:

Sudo / sbin/ifup tap0

Sudo / sbin/ifup br0

This step only needs to be done once, and the interface and bridge will be activated automatically the next time the host restarts.

4. You also need to add the following to / etc/network/interfaces to create a bridge called "br0". The IP configuration of the bridge is configured through DHCP. All network interfaces in the host, including the virtual network interface tap0, will be built on this bridge:

Auto br0

Iface br0 inet dhcp

Bridge_ports all tap0

Here you can make changes according to your network condition, and you can make the network bridge use static IP:

Iface br0 inet static

Address 192.168.1.2

Netmask 255.255.255.0

Network 192.168.1.0

Broadcast 192.168.1.255

Gateway 192.168.1.1

5. Let Ubuntu VirtualBox use this virtual network interface, start Ubuntu VirtualBox, select the virtual machine that you want to use the virtual network interface just established on the main interface, click "Settings", select "Network" in the pop-up window, select one of the network cards (usually "Network Adapter 0"), select "enable Network Adapter", select "Host Interface" after "Connect to", and select "access Network Cable". Then in the "host network interface name", fill in the name of the virtual network interface you just established, "tap0", and confirm. Similarly, you can use VBoxManage's command line tool (change "My VM" to your virtual machine name):

VBoxManage modifyvm "My VM"-hostifdev1 tap0\

* configure the network of the host and the virtual machine so that the host and the virtual machine are on the same network segment, so that the host and the virtual machine become two machines with the same status in the LAN and can access each other.

Thank you for reading this article carefully. I hope the article "how to add Virtual Network Devices to the Ubuntu VirtualBox operating system" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report