In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "the method of configuring VirtualBox+CentOS virtual machine network card". The editor shows you the operation process through the actual case, and the operation method is simple, fast and practical. I hope this article "the method of configuring VirtualBox+CentOS virtual machine network card" can help you solve the problem.
1.virtualbox configuration
1.1 configuration Page
1.2 connection mode of network card
①, host only (host-only)
This connection only allows interworking between the host machine and the virtual machine
②, bridged network
This connection mode the virtual machine has a local area network ip on the same network as the bridge network card, and it interconnects with other machines in this local area network.
③, Network address Translation (nat)
With this connection, the virtual machine can access other hosts in the host machine's LAN, but other hosts cannot access the virtual machine.
2. Centos configuration
2.1 modify the mapping between the network card mac and the device name eth*
Vi / etc/udev/rules.d/70-persistent-net.rules
# this file was automatically generated by the / lib/udev/write_net_rules# program, run by the persistent-net-generator.rules rules file.## you can modify it, as long as you keep each rule on a single# line, and change only the value of the name= key.# pci device 0x8086:0x100e (e1000) subsystem== "net", action== "add", drivers== "? *", attr {address} = = "08 address 00 27 Frev 34 81 Frev 48", attr {type} = = "1", kernel== "eth*", name= "eth0"
P.s. The mac of attr {address} in this file must be the same as the mac address of the virtual machine network card in the figure above; if it is inconsistent, centos will automatically create a new record, and the corresponding number of eth* will increase itself.
2.2 configure the specific properties of the network card
Vi / etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0type=ethernetonboot=yesbootproto=staticipaddr=192.168.56.10netmask=255.255.255.0gateway=192.168.56.1hwaddr=08:00:27:34:81:48
P.s. What I configure here is a static ip to prevent ip address changes each time the virtual machine is started. Anyone who has used virtualbox knows that the 56 network segment is the default hostonly network segment of virtualbox. Since vm can only communicate with the host computer, it becomes a trouble of static ip. In addition, to use dhcp, configure the following:
Device=eth0type=ethernetonboot=yesbootproto=dhcphwaddr=08:00:27:34:81:48
If the network corresponding to the Nic can be connected to the public network, you can configure the corresponding dns address
(take dns of Jiangsu Telecom as an example)
Dns1=218.2.135.1
Dns2=61.147.37.1
Restart the network card after modifying the configuration
Ifdown eth0ifup eth0
P.s. The choice of n in ifcfg-eth* should be consistent with the name in 70-persistent-net.rules, and the mac address should also be the same.
2.3 default gateway configuration in a multi-card network environment
If there are multiple network cards in the virtual machine, for example, the gateway is
192.168.56.1-host-only
192.168.20.1-bridge lan
192.168.10.1-bridge wlan
The 192.168.10.1 network can be connected to the public network, and the public network can be accessed by adding a default gateway.
Route add default gw 192.168.10.1 on the "VirtualBox+CentOS virtual machine network card configuration method" content is introduced here, thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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.