安装工具
yum clean all yum list yum install -y vim yum install -y gcc yum install -y gcc-c++ yum install -y gdb yum install -y cmake yum install -y openssl yum install -y man-pages yum install -y bzip2 yum install -y wget yum install -y curl yum install -y git yum install -y subvion yum install -y nc yum install -y iperf3 yum install -y ntp yum install -y tmux yum install -y psmisc yum install -y net-tools
校时:
ntpdate cn.pool.ntp.org
配置防火墙:
1,关闭并停掉firewall systemctl stop firewalld.service systemctl disable firewalld.service 2,安装iptables yum install -y iptables-services systemctl enable iptables.service systemctl restart iptables.service 按照需要开放端口,默认只开启22号端口,其他全部拒绝 vim /etc/sysconfig/iptables 3,关闭selinux setenforce 0 #使配置立即生效 cp /etc/selinux/config /etc/selinux/config.install sed -i s@SELINUX=enforcing@#SELINUX=enforcing@ /etc/selinux/config sed -i s@SELINUXTYPE=targeted@#SELINUXTYPE=targeted@ /etc/selinux/config 4,重启iptables,注意文件中不能有注释:/etc/sysconfig/iptables systemctl restart iptables.service [root@localhost ~]# iptables -L -n Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination [root@localhost ~]#
网卡设置:
方式1: [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32 TYPE=Ethernet BOOTPROTO=dhcp DEVICE=ens32 ONBOOT=yes [root@localhost ~]# 方式2: [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32 TYPE=Ethernet DEVICE=ens32 BOOTPROTO=static ONBOOT=yes IPADDR=172.16.66.66 NETMASK=255.255.0.0 GATEWAY=172.16.1.1 DNS1=176.80.80.80 DNS2=8.8.8.8 [root@localhost ~]# [root@localhost ~]# service network restart Restarting network (via systemctl): [ OK ] [root@localhost ~]#
原文地址:http://990487026.blog.51cto.com/10133282/1970722