day29综合架构篇

  • 系统路由配置方法

  • 企业办公环境上网原理

  • 综合架构组成部分

  • 综合架构的服务准备

    • 系统基础优化配置
    • 系统网络配置
    • 进行虚拟主机克隆操作

1.系统路由配置
作用:路由网络线路可以进行选路
⑴、系统静态默认路由配置(临时配置)

centos6 ----需要安装软件net-tools
添加静态默认路由:
[root@oldboyedu ~]# route add default gw 10.0.0.254   
[root@oldboyedu ~]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         10.0.0.254      0.0.0.0         UG    0      0        0 eth0
    10.0.0.0        0.0.0.0         255.255.255.0   U     100    0        0 eth0
[root@oldboyedu ~]# ping 223.5.5.5
    PING 223.5.5.5 (223.5.5.5) 56(84) bytes of data.
    64 bytes from 223.5.5.5: icmp_seq=1 ttl=128 time=27.2 ms
删除静态默认路由:
[root@oldboyedu ~]# route del default gw 10.0.0.254
    [root@oldboyedu ~]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    10.0.0.0        0.0.0.0         255.255.255.0   U     100    0        0 eth0

centos7
添加静态默认路由:
[root@oldboyedu ~]# ip route add default via 10.0.0.254
[root@oldboyedu ~]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         10.0.0.254      0.0.0.0         UG    0      0        0 eth0
    10.0.0.0        0.0.0.0         255.255.255.0   U     100    0        0 eth0
[root@oldboyedu ~]# ping 223.5.5.5
    PING 223.5.5.5 (223.5.5.5) 56(84) bytes of data.
    64 bytes from 223.5.5.5: icmp_seq=1 ttl=128 time=27.4 ms
删除静态默认路由:
[root@oldboyedu ~]# ip route del default via 10.0.0.254
[root@oldboyedu ~]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    10.0.0.0        0.0.0.0         255.255.255.0   U     100    0        0 eth0

⑵、系统静态网段路由配置

centos6
添加静态网段路由:
[root@oldboyedu ~]# route add -net 223.5.5.0 netmask 255.255.255.0 gw 10.0.0.254
[root@oldboyedu ~]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    10.0.0.0        0.0.0.0         255.255.255.0   U     100    0        0 eth0
    223.5.5.0       10.0.0.254      255.255.255.0   UG    0      0        0 eth0
删除静态网段路由:
    route del -net 223.6.6.0 netmask 255.255.255.0 gw 10.0.0.254

centos7 
添加静态默认路由:
[root@oldboyedu ~]# ip route add 223.6.6.0/24 via 10.0.0.254
[root@oldboyedu ~]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    10.0.0.0        0.0.0.0         255.255.255.0   U     100    0        0 eth0
    223.6.6.0       10.0.0.254      255.255.255.0   UG    0      0        0 eth0
删除静态默认路由:
ip route del 223.6.6.0/24 via 10.0.0.254

⑶、系统静态主机路由配置

centos6
添加静态主机路由:
[root@oldboyedu ~]# route add -host 223.5.5.5 gw 10.0.0.254
[root@oldboyedu ~]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    10.0.0.0        0.0.0.0         255.255.255.0   U     100    0        0 eth0
    223.5.5.5       10.0.0.254      255.255.255.255 UGH   0      0        0 eth0
[root@oldboyedu ~]# ping 223.5.5.5
    PING 223.5.5.5 (223.5.5.5) 56(84) bytes of data.
    64 bytes from 223.5.5.5: icmp_seq=1 ttl=128 time=26.9 ms
[root@oldboyedu ~]# ping 223.5.5.6
    connect: 网络不可达
删除静态主机路由:
route del -host 223.5.5.5 gw 10.0.0.254

centos7
添加静态主机路由:
[root@oldboyedu ~]# ip route add 223.5.5.5/32 via 10.0.0.254
[root@oldboyedu ~]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    10.0.0.0        0.0.0.0         255.255.255.0   U     100    0        0 eth0
    223.5.5.5       10.0.0.254      255.255.255.255 UGH   0      0        0 eth0
[root@oldboyedu ~]# ping 223.5.5.5
    PING 223.5.5.5 (223.5.5.5) 56(84) bytes of data.
    64 bytes from 223.5.5.5: icmp_seq=1 ttl=128 time=32.3 ms
[root@oldboyedu ~]# ping 223.5.5.6
    connect: 网络不可达
删除静态主机路由:
ip route del 223.5.5.5/32 via 10.0.0.254

2.企业网络配置说明

第一个里程: 进行网络拓扑规划

第二个里程: 路由器上配置
     配置路由接口地址
     配置外网拨号设置
     配置动态获取地址(DHCP) 

第三个里程: 交换机配置
     配置交换机vlan设置: (命令行) 
     PS; 交换机所有的接口属于一个广播域
     1) 创建vlan 
        vlan xxx     
     2) 将指定接口划入指定vlan中
        switchport access vlan 10
     trunk: 对传输数据不打标, 允许不同vlan数据包进行传输
     设置方式:
     1) 指定接口模式
     sw mode trunk

     虚拟主机上网原理
     问题一: ssh远程连接不上:
     虚拟主机网络信息:
     01. 虚拟网卡地址配置
     02. 确认选择虚拟网卡 
     03. 确认远程服务开启
     04. 确认安全服务关闭
     
     物理主机网络信息:
     01. 确认虚拟网卡激活
     02. 确认虚拟网卡地址
     03. 确认虚拟网络服务  services.msc
     
     问题二: 无法访问外网
     原因: 
     01. 网卡信息配置 
     02. 初始化虚拟网络配置
     03. 确认虚拟网络服务  services.msc
     04. 翻墙代理工具开启  
     
     方式:
     NAT 桥接

3.综合架构组成部分

01.  防火墙服务器    阻止非法入侵        iptables/firewalld
02.  负载均衡服务器  10.0.0.5/172.16.1.5    lb01        调度分配请求信息    nginx/lvs/haproxy(?)
         负载均衡服务器  10.0.0.6/172.16.1.6    lb02        调度分配请求信息    nginx/lvs/haproxy(?) 
03.  网站web服务器   10.0.0.7/172.16.1.7    web01       处理用户访问请求    nginx/apache/tomcat/php/python
         网站web服务器   10.0.0.8/172.16.1.8    web02       处理用户访问请求    nginx/apache/tomcat/php/python
         网站web服务器   10.0.0.9/172.16.1.9    web03       处理用户访问请求    nginx/apache/tomcat/php/python
04.  数据库服务器    10.0.0.51/172.16.1.51  db01        存储字符信息        mysql/mariadb/oracle(数据库)    
05.  存储服务器      10.0.0.31/172.16.1.31  nfs01       存储图片/视频/音频  nfs/分布式存储
                         10.0.0.32/172.16.1.32  nfs02       存储图片/视频/音频  nfs/分布式存储    
06.  缓存服务器      内存存储数据        memcache/redis/mongodb
07.  vpn服务器       10.0.0.61/172.16.1.61  m01         用户身份认证        pptp vpn  
        
08.  跳板机服务器    10.0.0.61/172.16.1.61  m01         监管作用            jumpserver
09.  批量管理服务器  10.0.0.61/172.16.1.61  m01         批量管理            ansible/saltstack
10.  监控服务器      10.0.0.71/172.16.1.71  zabbix      监控服务运行状态    zabbix
11.  备份服务器      10.0.0.41/172.16.1.41  backup      备份数据            rsync
访问流程及维护流程.jpg

4.综合架构环境准备

1) 网络配置进行调整 
       a 需要添加网卡信息
       b 配置网卡地址信息
         cd /etc/sysconfig/network-scripts/
         cp ifcfg-eth0 ifcfg-eth1
         TYPE=Ethernet
         PROXY_METHOD=none
         BROWSER_ONLY=no
         BOOTPROTO=none
         DEFROUTE=yes
         IPV4_FAILURE_FATAL=no
         IPV6INIT=yes
         IPV6_AUTOCONF=yes
         IPV6_DEFROUTE=yes
         IPV6_FAILURE_FATAL=no
         IPV6_ADDR_GEN_MODE=stable-privacy
         NAME=eth1
         DEVICE=eth1
         ONBOOT=yes
         IPADDR=172.16.1.200
         PREFIX=24
         IPV6_PRIVACY=no
         systemctl restart network
    检查确认:
    [root@oldboyedu network-scripts]# ip a
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 00:0c:29:e5:d0:c7 brd ff:ff:ff:ff:ff:ff
        inet 10.0.0.200/24 brd 10.0.0.255 scope global noprefixroute eth0
           valid_lft forever preferred_lft forever
        inet6 fe80::560b:9e4b:8f6b:f8fb/64 scope link noprefixroute 
           valid_lft forever preferred_lft forever
    3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 00:0c:29:e5:d0:d1 brd ff:ff:ff:ff:ff:ff
        inet 172.16.1.200/24 brd 172.16.1.255 scope global noprefixroute eth1
           valid_lft forever preferred_lft forever
        inet6 fe80::3a47:1ca6:b9e2:2f6c/64 scope link noprefixroute 
           valid_lft forever preferred_lft forever
    
    2) 进行系统基础优化
       a 关闭系统安全策略
       getenforce
       systemctl stop firewalld.service
       systemctl disable firewalld.service
       
       b 更新yum源
       curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
       wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
       yum clean all
       
       c 更新系统字符集
       
       d 更新本地hosts文件
       cat >> /etc/hosts <<EOF
       10.0.0.5    lb01
       10.0.0.6    lb02
       10.0.0.7    web01
       10.0.0.8    web02
       10.0.0.9    web03
       10.0.0.31   nfs01
       10.0.0.41   backup
       10.0.0.51   db01
       10.0.0.61   m01
       10.0.0.71   zabbix
       EOF
    
    3) 虚拟主机克隆操作
       a 虚拟主机目录规划
       b 虚拟主机克隆操作 
         PS: 虚拟主机克隆好,一台一台开启进行修改网络配置  
         
    4) 虚拟主机克隆后调整
       修改主机名称:
       hostnamectl set-hostname backup
       修改主机网卡地址:
       sed -ri 's#200#41#g;/UUID|HWADDR/d' /etc/sysconfig/network-scripts/ifcfg-eth[01]
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容