CentOS静态IP配置
配置步骤
- # ifconfig
- # vi /etc/sysconfig/network-scripts/ifcfg-eth0
- 将ONBOOT=no 改成 ONBOOT= yes
4.# service network restart(重启)![]()
- cmd检测
![]()
eth0相关配置信息
vi /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO=static #启用静态ip地址
ONBOOT=yes #开启自动启用网络连接
IPADDR=10.211.55.16 #设置ip地址
NETMASK=255.255.255.0 #设置子网掩码
GATEWAY=192.168.0.1 #设置网关
DNS1=8.8.8.8 #设置主DNS
DNS2=8.8.4.4 #设置备DNS
IPV6INIT=no #禁用ipv6
:x #保存退出
service ip6tables stop #停止IPV6服务
chkconfig ip6tables off #禁止ipv6开机启动
//重启network
service netwrok restart
主机名配置
假如要设置主机名为:ci.mao.com
1.修改network
vi /etc/sysconfig/network
HOSTNAME=ci.mao.com
:x #保存退出
2.修改hosts
vi /etc/hosts
修改localhost.localdomain为新的主机名
127.0.0.1 ci.mao.com localhost
:x #保存退出