Centos6 sets static address and cannot be linked to the static address after the VM is changed (or copied to the VM)

Source: Internet
Author: User

1. Set static addresses for centos6

1. Modify Nic configuration VI/etc/sysconfig/network-scripts/ifcfg-eth0

Device = "eth0"
Bootproto = none
Nm_controlled = "yes"
Onboot = "yes"
Type = "Ethernet"
Ipaddr = 192.168.0.xx
Netmask = 255.255.255.0
Network = 192.168.0.0
Gateway = 192.168.0.1
Hwaddr = XX: xx
Prefix = 24
Defroute = Yes
20174_failure_fatal = Yes
Ipv6init = No
Name = "system eth0"
UUID = 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
Last_connect = 1358664214

2. Modify the gateway configuration VI/etc/sysconfig/Network

Networking = Yes
Networking_ipv6 = No
Hostname = xxxxxxxxxx
Gateway = 192.168.0.1

3. Modify DNS configuration VI/etc/resolv. conf

Disable the NetworkManager service
/Etc/init. d/NetworkManager stop
Modify/etc/resolv. conf
Vim/etc/resolv. conf
Modify or add a DNS address:
Nameserver XXX. XXX
Save and exit

4. Restart the NIC

/Etc/init. d/network restart or service network restart

5. Avoid clearing DNS configurations after the server is restarted

Chkconfig NetworkManager off

2. The static address of the VM cannot be linked after the VM is changed or copied

1. The static address cannot be connected after the VM is changed

Error: Device eth0 does not seem to be present, delaying Initialization

(1) vi/etc/sysconfig/network-scripts/ifcfg-eth0

The ifcfg-eth0 configuration file saves the previous MAC address, the line is deleted in the restart Nic


(2)/etc/udev/rules. d/70-persistent-net.rules Delete and restart the machine
Because this file is bound to the NIC and MAC address, the MAC address changes after the NIC is changed, so it cannot be started normally, you can also directly edit this configuration file to replace the NIC and MAC address in it. However, if you delete and restart the configuration file, it will automatically generate one.

2. If you still cannot connect to another host, check the firewall or network connection settings of the host and other hosts.

(1) permanently disable the Firewall


View the current Firewall Status:/etc/init. d/iptables
Status
A series of information is displayed, indicating that the firewall is on.
/Etc/init. d/iptables stop

Permanently close:
Chkconfig -- level 35 iptables off

(2) permanently disable SELinux

View the current SELinux status:
/Usr/bin/setstatus-V

Edit/etc/SELinux/config and find the SELinux line and change it to: SELinux = disabled:

# This file controls the state of SELinux on the system.
# SELinux = can take one of these three values:
# Enforcing-SELinux security policy is enforced.
# Permissive-SELinux prints warnings instead of enforcing.
# Disabled-No SELinux policy is loaded.
SELinux = disabled
# Selinuxtype = can take one of these two values:
# Targeted-only targeted network daemons are protected.
# Strict-full SELinux protection.

Selinuxtype = targeted


(3) restart the system.

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.