In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-16 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 "what are the methods of configuring IP address in CentOS6.5 under virtual machine". The editor shows you the operation process through an actual case, which is simple, fast and practical. I hope that this article "what are the methods of configuring IP address in CentOS6.5 under virtual machine" can help you solve the problem.
Experimental software environment: virtual machine vmware workstation10.0, centos 6.532bit
1. Obtain the ip address automatically
The virtual machine uses the bridging mode, which is equivalent to connecting to the network of the physical machine, where the dhcp server automatically assigns the ip address.
# dhclient automatically get ip address command # ifconfig query system Nic information, ip address, mac address
After the ip address is assigned, the physical machine is used to ping ip the address to check whether ping is connected.
2. Set the ip address manually
If the virtual machine cannot obtain ip automatically, it can only be configured manually, as follows:
Enter a command
# vi / etc/sysconfig/network-scripts/ifcfg-eth0 [Edit the configuration file of the network card]
Enter the above command, open the configuration file, use the arrow keys to move the cursor to the last line, press the letter key "o", enter edit mode, enter the following:
Ipaddr=192.168.4.10netmask=255.255.255.0gateway=192.168.4.1
In addition, move the cursor to the line "onboot=no" and change it to onboot=yes
"bootproto=dhcp", changed to bootproto=none
When finished, press the ESC key in the upper left corner of the keyboard, enter: wq can be seen at the bottom left of the screen, enter enter to save the configuration file.
After that, you need to restart the network service, and the command is
# servicenetwork restart
After the network is restarted, the ip of eth0 takes effect. Use the command # ifconfigeth0 to view
Next, check whether the configured ip can ping, use the shortcut key windows+r on the physical machine to open the run box, enter the command cmd, and enter ping 192.168.4.10
After testing, ping communication indicates that the ip configuration is correct.
Note: the physical machine segment I am in is 192.168.4.0 network segment. When you do the experiment, you can set it according to your own environment and keep the virtual machine and the physical machine in the same network segment.
3. Use nat mode
The virtual machine network connection uses nat mode, and the physical machine network connection uses vmnet8.
In the virtual machine settings-network adapter, select nat mode for network connection.
Virtual machine menu bar-edit-virtual network editor, select vmnet8 nat mode
1. Set ip to 192.168.20.0 subnet mask 255.255.255.0 in the lowest subnet
The gateway ip in 2.nat setting is 192.168.20.2.
3. Use the local dhcp service to assign ip addresses to virtual machines without checking the box.
Click apply to exit when the settings are complete.
Physical machine network connection vmnet8 manually sets the ip address 192.168.20.1 subnet mask 255.255.255.0
The gateway and dns address is 192.168.20.2 (that is, the gateway address of virtual machine nat)
Edit the configuration file of the linux network card eth0
# vi / etc/sysconfig/network-scripts/ifcfg-eth0
Enter the above command, open the configuration file, use the arrow keys to move the cursor to the last line, press the letter key "o", enter edit mode, enter the following:
Ipaddr=192.168.20.3netmask=255.255.255.0gateway=192.168.20.2
In addition, move the cursor to the line "onboot=no" and change it to onboot=yes
"bootproto=dhcp", changed to bootproto=none
When finished, press the ESC key in the upper left corner of the keyboard, enter: wq can be seen at the bottom left of the screen, enter enter to save the configuration file.
Set the dns address and run the command # vi / etc/resolv.conf
Move the cursor to the blank line, press the "o" key, enter nameserver 192.168.20.2 to exit the ESC key, and enter: wq enter to save the configuration file.
Restart network services
# service network restart
After reboot, # ifconfig checks the configured ip address, and the address of physical machine ping is tested to see if it can be reached.
This is the end of the content about "what are the methods of configuring IP addresses for CentOS6.5 under the virtual machine". 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.