In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces how to install centos for virtualbox virtual machines and configure the network so that hosts and virtual machines can access each other. The content is very detailed. Interested friends can use it for reference. I hope it can be helpful to you.
Configuration step
After installing virtualbox, it installs a virtual network card on the host, as shown in the figure
Double-click it to view the details, as shown in the figure
I use host-only to configure the network on the virtual machine, of course, I can also use bridging, as for the difference between them, there are a lot of them on the Internet. The virtual network card is mainly used as the gateway on the virtual machine.
There are three main files to be configured after entering the centOS system:
1. Modify the ip address
Use the command vi / etc/sysconfig/network-scripts/ifcfg-eth0 to modify the contents of the file as follows
DEVICE= "eth0"
BOOTPROTO= "static" here change to use static ip
HWADDR= "08:00:27:0C:33:8F"
NM_CONTROLLED= "yes"
ONBOOT= "yes" is set to start automatically
TYPE= "Ethernet"
UUID= "f4adafbc-322d-4dc8-b549-4291f1c04f01"
IPADDR=192.168.137.101 sets the ip address of the virtual machine to be on the same network segment as the host, but the name cannot be repeated.
NETMASK=255.255.255.0 sets subnet mask
# GATEWAY=192.168.137.1 sets the gateway, that is
2. Modify the gateway
Use the command: vi / etc/sysconfig/network to modify the file as follows:
NETWORKING=yes
HOSTNAME=localhost.localdomain
GATEWAY=192.168.137.1 sets the gateway here, that is, the ip of the virtual network card.
3. Modify DNS
Use the command: vi / ect/resolv.conf to modify the file as follows:
Nameserver 192.168.137.1 adds a domain name server
Finally, restart the network service and ok, using the command service network restart.
At first, I follow this step to complete the configuration. Ping the virtual machine on the host, no problem can ping. But there is a problem with the ping host and gateway on the virtual machine, not to mention the ping extranet. The questions are as follows:
The ping host and gateway do not indicate that Ping is not available, but cannot receive messages from each other. Packets:Sent = 4 received = 0 load = 4 (100% loss). The ping www.baidu.com result is an invalid hostname. This problem has been bothering me all day, and Baidu can't find the result. I know that the problem must lie in the configuration of ip. After Baidu failed tonight, I thought of that virtual network card. I used the above method to configure it. I used that virtual network card as the gateway, but the virtual network card was not configured at all. It has nothing to do with the network card on my computer. It certainly can't be used directly. Then I thought that we can use broadband to share wireless wifi, why can't we share the broadband connection with that virtual network card? Try it right away. After starting sharing, the ip of the virtual network card has changed again, and then reconfigure the network information in centos according to the above steps. The result is really OK, and the problem that has plagued me for a day or two has finally been solved.
Ping host, ok.
Ping www.baidu.com is also ok.
This is about how to install centos for virtualbox virtual machines and configure the network so that hosts and virtual machines can access each other. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.