VirtualBox centos7 configures network bridging to connect internal and external networks

Time:2020-9-5

The installation resources of centos7 image can be viewed above: VirtualBox new centos7 reset root password

After the installation of VirtualBox is completed, you need to configure the network in the virtual machine management console and modify the CentOS configuration file before accessing the intranet and extranet. (VirtualBox installed under window)

1. Configure the VirtualBox network

1.1 view the machineIP

stayCMDTool inputipconfigCan be viewedIPv4Address. If so192.168.0.53
VirtualBox centos7 configures network bridging to connect internal and external networks

1.2 findVirtualBox Host-Only Network, configure network

openControl panel / all control panel items / network connection, foundVirtualBox Host-Only Network, configure the network.
The local IP is shown in the figure above192.168.0.xSo putVirtualBox Host-Only NetworkSet the same network segment with IP of192.168.0.111The subnet mask is also configured to255.255.255.0。 As shown in the figure

fVirtualBox centos7 configures network bridging to connect internal and external networks
VirtualBox centos7 configures network bridging to connect internal and external networks

2. VirtualBox set CentOS system network bridge

As shown in the figure below, the configuration is from left to right
VirtualBox centos7 configures network bridging to connect internal and external networks

3. CentOS system configuration network

1. SSH log in to centos7 system and enter the system network configuration directory

$ cd /etc/sysconfig/network-scripts/
$ ls

VirtualBox centos7 configures network bridging to connect internal and external networks

  1. editipcfg-enp0s3file
$ vi ifcfg-enp0s3

Document editing by example
VirtualBox centos7 configures network bridging to connect internal and external networks

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=18900bd0-ac26-498b-9683-1ea111d4ca5e
DEVICE=enp0s3
ONBOOT=yes
IPADDR=192.168.0.222
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=192.168.0.1
DNS2=192.168.0.1

4. Restart the network service of CentOS system

$ service network restart

5. Check access to intranet and extranet

#Access Intranet
$ ping 192.168.0.1 -c4

#Access to the Internet
$ ping baidu.com -c4

As shown in the figure below, it shows that the internal network and external network have been connected
VirtualBox centos7 configures network bridging to connect internal and external networks
VirtualBox centos7 configures network bridging to connect internal and external networks

Recommended Today

Development of laravel unideploy based on laravel project

In the actual project development, for the automatic deployment of PHP project, there are few good solutions on the market, such as Wali, such as the company’s Ruby project teamcapistranoAfter a few practices, we still choose to use PR, issue more active deployer aboutdeployerdeployLaravelThe initial practice plan of the project is relatively elementary,composer globalInstall to […]