CentOS IP configuration

Source: Internet
Author: User
After the system is started, ping the Internet or other machines in the LAN. If you select the NAT Internet access mode when configuring the virtual machine, you need to configure a fixed IP address later. For more information, see setting static IP addresses in VMwareNAT mode to obtain available IP ranges and gateways. First back up the ifcfg-eth0 to the home directory, do not put it in the same directory, then vim/etc/sysconfig/network-scripts/ifcfg-eth

After the system is started, ping the Internet or other machines in the LAN.

If you select the NAT Internet access mode when configuring the virtual machine, you need to configure a fixed IP address later. For more information, see setting static IP addresses in the VMware NAT mode to obtain available IP ranges and gateways.

First back up the ifcfg-eth0 to the home directory, do not put it in the same directory, and then

Vim/etc/sysconfig/network-scripts/ifcfg-eth0 IPADDR = 192.168.88.201 # specify the IP address NETMASK = 255.255.255.0 # subnet mask GATEWAY = 192.168.88.2 # default GATEWAY DNS1 = 192.168.88.2 # DNS1 server address, it is generally the same as the gateway

Then back up the/etc/sysconfig/network file and vim to modify the gateway.

Restart network service

service network restart
Related Command ifconfig
ifconfig

Displays information about the currently activated network interfaces.

ifconfig -a

Displays information about all network interfaces, whether activated or not.

Disable and activate NIC interfaces

[Root @ localhost ~] # Ifdown eth0 # Disable the network [root @ localhost ~] # Ifup eth0 # Start the network
Error related to cloned VM

When running service network restart

Device eth0 does not seem to be present,delaying initialization.      [FAILED]

Ifconfig does not find eth0 and eth1, but eth1 (hardware address: 00: 0C: 29: 45: 41: 1E) is found in ifconfig-)

View/etc/udev/rules. d/70-persistent-net.rules found that there are two hardware addresses, the eth0 is 00: 0C: 29: 22: 4A: 32 (original), and the eth1 is 00: 0C: 29: 45: 41: 1E

View/etc/sysconfig/network-scripts/ifcfg-eth0 found hardware address is 00: 0C: 29: 22: 4A: 32 (original)

The VM before the copy is eth0 and the hardware address is 00: 0C: 29: 22: 4A: 32.

If you still want to use eth0, you can

rm -rf /etc/udev/rules.d/70-persistent-net.rules

Change the hardware address for/etc/sysconfig/network-scripts/ifcfg-eth0 to 00: 0C: 29: 45: 41: 1E, and change the new IP address

Finally, reboot restarts the machine.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.