永久网络配置
# cd /etc/sysconfig/network-scripts/
# vim ifcfg-eth0
修改以下内容
DEVICE=eth0
TYPE=Ethernet
UUID=c7f9c449-91d2-433a-8641-18edd8362c0f
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.0.51
GATEWAY=192.168.0.1
NETMASK=255.255.255.0
DNS1=202.102.192.68
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
08:00:27:B4:12:48
ARPCHECK=no
# service network restart
生成硬链接随时修改:
# ln /etc/sysconfig/network-scripts/ifcfg-eth0 eth0.hard
临时网络配置(重启失效)
# ifconfig eth0 192.168.0.101
可能会出现的问题
问题:CentOS 6.5/Linux 重启网卡报错 Determining if ip address x.x.x.x is already in use
CentOS 6.5默认开启了ARPCHECK,将其关闭即可解决:
# sed -i “ARPCHECK=no” >> /etc/sysconfig/network-scripts/ifcfg-eth0
# service network restart