0.查看centos版本,linux内核版本
rpm -q centos-release
uname -a
1.关闭防火墙
centOS 6.5关闭防火墙步骤
关闭命令: service iptables stop
永久关闭防火墙:chkconfig iptables off
两个命令同时运行,运行完成后查看防火墙关闭状态
service iptables status
centos 7
重新启动网络:
systemctl start network.service
或者
service network restart
查看防火墙状态:
firewall-cmd --state
关闭防火墙:
systemctl stop firewalld.service
禁止开机启动:
systemctl disable firewalld.service
2.配置静态ip
cd /etc/sysconfig/network-scripts/ //进入到network-scripts目录下
vi ifcfg-eth0 //编辑配置文件
//修改以下内容
BOOTPROTO=static //启用静态IP地址
ONBOOT=yes //开启自动启用网络连接
//添加以下内容
IPADDR=192.168.30.1 //设置IP地址
NETMASK=255.255.255.0 //子网掩码
GATEWAY=192.168.131.2 //设置网关
3.DNS配置
vi /etc/resolv.conf //编辑 resolv.conf文件
nameserver 114.114.114.114 //添加DNS地址
常用的DNS地址:
阿里 223.5.5.5 或者 223.6.6.6
谷歌 8.8.8.8
国内移动、电信和联通通用的DNS 114.114.114.114