centos 虚拟机 静态IP 配置

1. 如只有eth1,没有eth0

vi /etc/udev/rules.d/70-persistent-net.rules

# PCI device 0x8086:0x100f (e1000)
# SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:ec:9c:cc", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:3e:ae:16", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

注释 SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:ec:9c:cc", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

NAME="eth1" 改为 NAME="eth0"

copy 00:0c:29:3e:ae:16

2. 修改eth0

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:0c:29:3e:ae:16"
IPV6INIT="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="81767865-e718-4d1c-9676-449b2cf8527a"
IPADDR=192.168.125.133
NETMASK=255.255.255.0
GATEWAY=192.168.125.2
DNS1=8.8.8.8

3. reboot

4. ping test & ifconfig

你可能感兴趣的:(centos 虚拟机 静态IP 配置)