文档库 最新最全的文档下载
当前位置:文档库 › centos网络配置

centos网络配置

centos网络配置
centos网络配置

二、设置IP地址、网关、DNS

约定:

第一块网卡为外网

第二块网卡为内网(没有外网的机器也要将内网配置在第二块网卡上)

说明:CentOS 6.6默认安装好之后是没有自动开启网络连接的!

输入账号root

再输入安装过程中设置的密码,登录到系统

vi /etc/sysconfig/network-scripts/ifcfg-eth0 #编辑配置文件,添加修改以下内容BOOTPROTO=static #启用静态IP地址

ONBOOT=yes #开启自动启用网络连接

IPADDR=192.168.21.129 #设置IP地址

NETMASK=255.255.255.0 #设置子网掩码

GATEWAY=192.168.21.2 #设置网关

DNS1=8.8.8.8 #设置主DNS

DNS2=8.8.4.4 #设置备DNS

IPV6INIT=no #禁止IPV6

:wq! #保存退出

service ip6tables stop #停止IPV6服务

chkconfig ip6tables off #禁止IPV6开机启动

service yum-updatesd stop #关闭系统自动更新

chkconfig yum-updatesd off #禁止开启启动

service network restart #重启网络连接

ifconfig #查看IP地址

三、设置主机名

约定:

主机名命名规范:业务.机房.主备.域名

这里设置主机名为:https://www.wendangku.net/doc/f319155287.html,

1、hostname “https://www.wendangku.net/doc/f319155287.html,”

#设置主机名为https://www.wendangku.net/doc/f319155287.html,

2、vi /etc/sysconfig/network #编辑配置文件HOSTNAME= https://www.wendangku.net/doc/f319155287.html,

#修改localhost.localdomain为https://www.wendangku.net/doc/f319155287.html, :wq! #保存退出

3、vi /etc/hosts #编辑配置文件

127.0.0.1 https://www.wendangku.net/doc/f319155287.html, localhost

#修改localhost.localdomain为https://www.wendangku.net/doc/f319155287.html, :wq! #保存退出

shutdown -r now #重启系统

至此,CentOS 6.6系统安装配置完成

相关文档