1、首先查看网卡信息,主要是物理地址
cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:db:2e:10", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
注意:ATTR{address}=="00:0c:29:db:2e:10", 物理地址为:00:0c:29:db:2e:10
2、填写静态ip
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0c:29:db:2e:10
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
DHCP_HOSTNAME=192.168.16.77
IPADDR=192.168.16.131
NETMASK=255.255.255.0
GATEWAY=192.168.16.1
DNS1=192.168.16.1
DNS2=114.114.114.114
IPADDR:ip地址
NETMASK:子网掩码
GATEWAY:网关
HWADDR:一定要填写和第一步查看的额为例地址一致
DHCP_HOSTNAME:没有可以不用填写
DNS:填写你相对应的。
3,重启网络服务
service network restart