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.