Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method and matters needing attention of setting static IP in VirtualBox6 installation CentOS7

Shulou Source: shulou.com Published: 2022-06-02 04:07:49 09月30日 Update

Install centos7 after installing virtualbox. I won't repeat it here. There are many tutorials online.

First shut down the virtual machine and configure the network as follows

We need to use a dual network card here, and we are opening the second network card, as shown below

Then turn on the virtual machine and do the following

# go to the directory where the network card is located, cd / etc/sysconfig/network-scripts/#, back up the network card information cp-rp / etc/sysconfig/network-scripts/ifcfg-enp0s3 / etc/sysconfig/network-scripts/ifcfg-enp0s3.bak#, and edit vi / etc/sysconfig/network-scripts/ifcfg-enp0s3 The following 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= "ee340a0f-1557-49c7-a927-5069c4e2ab88" DEVICE= "enp0s3" ONBOOT= "yes"

The above configuration is the information of the network card 1 that we added, and we are copying a copy of the information modified to network card 2.

Cp-rp / etc/sysconfig/network-scripts/ifcfg-enp0s3 / etc/sysconfig/network-scripts/ifcfg-enp0s8TYPE= "Ethernet" PROXY_METHOD= "none" BROWSER_ONLY= "no" BOOTPROTO= "static" 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= "enp0s8" UUID= "cb7e712d-c2db-4dee-8950-37f9d8a780e9" DEVICE= "enp0s8" ONBOOT= yes "IPADDR=" 172.21.208.200 "NETMASK=" 255.255.252.0 "GATEWAY=" 172.21.208.1 "DNS1=" 8.8.8 "

Note:

UUID should be replaced with your own. Using the uuidgen command, you can generate the IPADDR,NETMASK,GATEWAY in the attention enp0s8, not scribbling. Because our network card 2 chooses the bridging mode, that is to say, it is equivalent to connecting the virtual machine and the host to the same network environment, so you need to check the configuration of the host. Use WIN+R, type cmd+ enter, and open the dos command line. Enter ipconfig / all to view the network configuration in the host, as follows

Look carefully, the network segment configured in Nic 2 is the same as that on the host. You can use xshell to connect to the ip in Nic 2.

Summary

The above is the editor to introduce to you the VirtualBox6 installation CentOS7 setting static IP methods and matters needing attention, I hope to help you, if you have any questions, please leave me a message, the editor will reply to you in time. Thank you very much for your support to the website!

If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!

Tags: Network card configuration host network information matters notes commands help methods static consistent that is source backup location tutorials patterns environment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Redmi Xiaomi vpn macOS