vim /etc/hostname #修改主机名
[root@localhost ~]# reboot
[root@oldboy ~]
设置网络编辑器后不能连接互联网 设置图二
图一
图二安装CentOS时设置网卡地址
如果安装系统时没有设置网络
1.cd /etc/sysconfig/network-scripts
2.查看网卡信息 找到ifcfg-eth0
[root@localhost network-scripts]# ls
ifcfg-eth0 ifdown-isdn ifdown-tunnel ifup-isdn ifup-Team
ifcfg-lo ifdown-post ifup ifup-plip ifup-TeamPort
ifdown ifdown-ppp ifup-aliases ifup-plusb ifup-tunnel
ifdown-bnep ifdown-routes ifup-bnep ifup-post ifup-wireless
ifdown-eth ifdown-sit ifup-eth ifup-ppp init.ipv6-global
ifdown-ippp ifdown-Team ifup-ippp ifup-routes network-functions
ifdown-ipv6 ifdown-TeamPort ifup-ipv6 ifup-sit network-functions-ipv6
3.将地址信息添加到ifcfg-eth0中
IPADDR=10.0.0.128
#IP地址
NETMASK=255.255.255.0
#网络掩码
GATEWAY=10.0.0.254
#网关地址
DNS1=233.5.5.5
#dns1号地址
[root@oldboy network-scripts]# vi ifcfg-eth0
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="eth0"
UUID="7fe86358-a1a8-44f4-95cb-717d2e75572e"
DEVICE="eth0"
ONBOOT="yes"
IPADDR=10.0.0.128
GATEWAY=10.0.0.254
NETMASK=255.255.255.0
DNS=233.5.5.5
4.Esc -->:-->wq-->回车