w7 全网架构-1
Posted wenyule
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了w7 全网架构-1相关的知识,希望对你有一定的参考价值。
1.从安装系统开始准备 安装过程中添加网卡 eth0 ip 10.0.0.210 netmask 24 gateway 10.0.0.254 eth1 ip 172.16.1.210 netmask 24 2.统一网络环境 网关都是 10.0.0.254 电脑===>网络连接 2.服务器ip地址规划 服务器说明 外网IP( NAT) 内网IP( LAN区段/Host-only) 主机名规划 A1-nginx负载服务器 01 10.0.0.5/24 172.16.1.5/24 lb01 A1-nginx负载服务器 02 10.0.0.6/24 172.16.1.6/24 lb02 B2-nginx web服务器 10.0.0.7/24 172.16.1.7/24 web02 B2-nginx web服务器 10.0.0.8/24 172.16.1.8/24 web01 C3-mysql数据库服务器 10.0.0.51/24 172.16.1.51/24 db01 C1-NFS存储服务器 10.0.0.31/24 172.16.1.31/24 nfs01 C2-rsync存储服务器 10.0.0.41/24 172.16.1.41/24 backup X-管理服务器 10.0.0.61/24 172.16.1.61/24 m01
系统优化
#所有服务器模板机的基本优化 cp /etc/hosts{,.bak} cat >/etc/hosts<<EOF 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.16.1.5 lb01 172.16.1.6 lb02 172.16.1.7 web02 172.16.1.8 web01 172.16.1.51 db01 db01.etiantian.org 172.16.1.31 nfs01 172.16.1.41 backup 172.16.1.61 m01 EOF #0、更改yum源 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo yum makecache #1、关闭selinux sed -i.bak ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config grep SELINUX=disabled /etc/selinux/config setenforce 0 getenforce #2、关闭iptables /etc/init.d/iptables stop /etc/init.d/iptables stop chkconfig iptables off #3、精简开机自启动服务 export LANG=en chkconfig|egrep -v "crond|sshd|network|rsyslog|sysstat"|awk ‘{print "chkconfig",$1,"off"}‘|bash chkconfig --list|grep 3:on #4、提权oldboy可以sudo useradd oldboy echo 123456|passwd --stdin oldboy cp /etc/sudoers /etc/sudoers.ori echo "oldboy ALL=(ALL) NOPASSWD: ALL " >>/etc/sudoers visudo -c #5、英文字符集 cp /etc/sysconfig/i18n /etc/sysconfig/i18n.ori echo ‘LANG="en_US.UTF-8"‘ >/etc/sysconfig/i18n source /etc/sysconfig/i18n echo $LANG #6、时间同步 echo ‘#time sync by lidao at 2017-03-08‘ >>/var/spool/cron/root echo ‘*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com >/dev/null 2>&1‘ >>/var/spool/cron/root crontab -l #8、加大文件描述 echo ‘* - nofile 65535 ‘ >>/etc/security/limits.conf tail -1 /etc/security/limits.conf #9、内核优化 cat >>/etc/sysctl.conf<<EOF net.ipv4.tcp_fin_timeout = 2 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_keepalive_time = 600 net.ipv4.ip_local_port_range = 4000 65000 net.ipv4.tcp_max_syn_backlog = 16384 net.ipv4.tcp_max_tw_buckets = 36000 net.ipv4.route.gc_timeout = 100 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_synack_retries = 1 net.core.somaxconn = 16384 net.core.netdev_max_backlog = 16384 net.ipv4.tcp_max_orphans = 16384 #以下参数是对iptables防火墙的优化,防火墙不开会提示,可以忽略不理。 net.nf_conntrack_max = 25000000 net.netfilter.nf_conntrack_max = 25000000 net.netfilter.nf_conntrack_tcp_timeout_established = 180 net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120 net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60 net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120 EOF sysctl -p #10、安装其他小软件 yum install lrzsz nmap tree dos2unix nc telnet sl -y #11、 ssh连接速度慢优化 sed -i.bak ‘[email protected]#UseDNS [email protected] [email protected];[email protected]^GSSAPIAuthentication [email protected] [email protected]‘ /etc/ssh/sshd_config /etc/init.d/sshd reload
克隆虚拟机
克隆前准备 1清2删 1清 >/etc/udev/rules.d/70-persistent-net.rules 2删 sed -ri ‘/UUID|HWADDR/d‘ /etc/sysconfig/network-scripts/ifcfg-eth* sed -i ‘/IPADDR/s#210$#31#g‘ /etc/sysconfig/network-scripts/ifcfg-eth*
以上是关于w7 全网架构-1的主要内容,如果未能解决你的问题,请参考以下文章