Virturalbox installation of the CentOS system, set up a dual network card to enable virtual machine Internet access and main house visits

Source: Internet
Author: User

One: Installation of the CentOS system to VirtualBox, note: The installation process set up the network connection information, the IPv4 is set to manual, the address is 192.168.56.101, the gateway is 192.168.56.0 (thought to be host-only mode)

Second: Start CentOS

A. View/etc/sysconfig/network-scripts/ifcfg-enp0s*

B. Check if you are connected to the Internet: Ping www.baidu.com

C. Install common commands: yum-y install net-tools,yum-y install vim,yum-y install Lrzsz

Three: Shutdown, configure the second network card, the default first card is a NAT mode (such as), the network card allows the virtual machine to access the external network

Click ' Nic 2 ', for example, select Host-only mode

The interface name is VirtualBox a connection created in "Network connection"

You can see it in the VirtualBox global settings

Four: Start the virtual machine to view IP information

Where Enp0s8 is the host-only nic that you just added

At this point, the local machine cannot access the virtual machine and change the VIM/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ENP0S3 The IP address inside: 192.168.56.101 (set in the first step) is 10.0.2.15, that is, the IP address in the ENP0S3 network card information, the gateway is also changed, PS: where Onboot=no is not changed to Yes (indicates whether the network card is activated when the system starts), I found the network was connected after rebooting the system.

Save quit Restart Network: Service network restart

Yes, the system can access the network can be accessed locally, local can also access the system, over

Virturalbox installation of the CentOS system, set up a dual network card to enable virtual machine Internet access and main house visits

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.