临时设置
修改IP地址:
ifconfig eth0 10.60.45.205 mask 255.255.255.0
修改网关地址
route add default gw 10.60.45.1 dev eth0
永久修改:
修改配置网卡配置文件/etc/sysconfig/network-scripts/ifcfg-eth# (#代表第几张网卡)
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = eth0 #网卡对应的设备别名
BOOTPROTO = static #网卡获取ip地址的方式(默认为dhcp,表示自动获取)
HWADDR = ::E9::E8:B4 #网卡MAC地址(物理地址)
ONBOOT = yes ###网卡启动时是否激活此设备
IPADDR = 10.60.45.205 ###IP地址
NETMASK = 255.255.255.0 ###子网掩码
GATEWAY = 10.60.45.1 ###网关地址
DNS1 = 114.114.114.114 ###DNS1地址
DNS2 = 114.114.114.114 ###DNS2地址