新装系统(CentOS7.4)环境初始化配置笔记

新装系统(CentOS7.4)环境初始化配置笔记

一、概述

设备详情:
Dell R730 服务器 (四个网卡,一根网线插在第2个网卡上)
CentOS 7.4 x64 最小安装环境

二、网络环境配置

网卡1(em1)网络配置

# /etc/sysconfig/network-scripts/ifcfg-em1

#以下为修改
BOOTPROTO=static
ONBOOT=yes

#以下为新增
IPADDR=192.168.2.110
NETMASK=255.255.255.0
GATEWAY=192.168.2.1
BROADCAST=192.168.2.255
DNS1=114.114.114
DNS2=8.8.8.8

网卡2(em2)网络配置

#/etc/sysconfig/network-scripts/ifcfg-em2

#以下为修改
BOOTPROTO=static
ONBOOT=yes

#以下为新增
IPADDR=192.168.1.110
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
BROADCAST=192.168.1.255
DNS1=114.114.114
DNS2=8.8.8.8

重启网络

$ service network restart #重启网络,使配置生效

路由配置

$ ip route show #查看当前路由情况
$ ip route add default via 192.168.1.110 dev em2 #(如果网卡2(em2)连接网络(或为外网IP),则如果要连接外网,需设置em2为默认路由)
$ ip route del default dev em1

三、安装SSH服务

$ yum -y install openssh #安装SSH服务
$ systemctl start sshd #启动SSH服务
$ systemctl status sshd #查看SSH服务状态
$ systemctl enable sshd #设置SSH服务开机自启动

四、禁用firewall切换使用iptables

# centos7开始默认使用firewall防火墙,由于本人对iptables更熟悉些,故切换使用iptables

#关闭firewall:
$ systemctl stop firewalld.service #停止firewall
$ systemctl disable firewalld.service #禁止firewall开机启动

#安装iptables防火墙
$ yum -y install iptables-services #安装
$ systemctl start iptables
$ systemctl enable iptables.service #设置防火墙开机启动
$ systemctl status iptables #查看防火墙状态

五、安装时间同步服务

$ yum install -y ntp

$ crontab -e
00 12 * * * /sbin/ntpdate cn.pool.ntp.org

六、更多软件安装

参考其他两篇文章:

转载于:https://www.cnblogs.com/huligong1234/p/8456892.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值