本文主要是介绍手动设定centOS服务器地址,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
手动设定
手动设定只要修改三个文件就可以了
a),/etc/sysconfig/network
[zhangy@localhost network-scripts]$ cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
#HOSTNAME=localhost.localdomain //为什么要把主机名注释掉,一般先解析主机名或者域名,再解析DNS
GATEWAY=192.168.1.1 //加上网关
b),/etc/sysconfig/network-scripts/ifcfg-eth0
[zhangy@localhost network-scripts]$ cat ifcfg-eth0
# Marvell Technology Group Ltd. 88E8039 PCI-E Fast Ethernet Controller
DEVICE=eth0
BOOTPROTO=none //启动为手动
BROADCAST=192.168.1.255
HWADDR=00:16:D3:A2:F6:09
IPADDR=192.168.1.108 //设置的IP
NETMASK=255.255.255.0 //子网掩码
NETWORK=192.168.1.0
IPV6INIT=yes
IPV6_AUTOCONF=yes
ONBOOT=yes
TYPE=Ethernet //网络类型
c),/etc/resolv.conf
[zhangy@localhost network-scripts]$ cat /etc/resolv.conf
#; generated by /sbin/dhclient-script
#nameserver 192.168.1.1
#search localdomain
nameserver 116.228.111.118 //加上主DNS
nameserver 180.168.255.18 //加上次DNS
这篇关于手动设定centOS服务器地址的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!