- 安装CentOS
- 设置静态ip地址
vim /etc/sysconfig/network这里主要是指定了hostname和网关
NETWORKING=yes
NETWORKING_IPV6=no
GATEWAY=192.168.0.1
HOSTNAME=localhost
vim /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0
#BOOTPROTO=dhcp
BOOTPROTO=static
IPADDR=192.168.1.21
NETMASK=255.255.255.0GATEWAY=192.168.0.1 #多网卡可以在这指定网关
TYPE=Ethernet
HWADDR=XX:XX:XX:XX:XX:XX
ONBOOT=yes
vim /etc/resolv.confnameserver 192.168.1.1
要是配置生效,需要重启网卡:ifconfig eth0 downifconfig eth0 up或直接重启服务service network restart