day 29 综合架构开场章节

2019-08-12  本文已影响0人  流云若雨

课程介绍部分

1. 系统路由配置方法  centos6 centos7
   查看系统路由表信息: netstat -rn / route -n / ip route show
2. 企业办公环境上网原理
   虚拟主机网络通讯原理
3. 系统中常用网络相关命令
4. 综合架构组成部分
5. 综合架构服务准备
   a 系统基础优化配置
   b 系统网络配置
   c 进行虚拟主机克隆操作

一.系统路由配置

作用:对网络线路可以进行选路
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 (iproute)
添加静态默认路由
[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


2) 系统静态网段路由配置
centos6 (net-tools)
添加静态网段路由
[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 (iproute)
添加静态默认路由
[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

3) 系统静态主机路由配置
centos6 (net-tools)
添加静态主机路由
[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 (iproute)
添加静态主机路由
[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

上面的路由配置都是临时配置
要永久配置的话得去vim /etc/sysconfig/network-scripts/ifcfg-eth0

企业网络配置说

一个里程:进行网络拓扑规划
规划图
第二个里程:路由器上配置
配置路由接口地址
配置外网拨号设置
配置动态获取地址(DHCP)
第三个里程:交换机配置
配置交换机vlan设置:(命令行)
ps:交换机所有的接口属于一个广播域
1.创建vlan
    vlan xxxx
2.将指定接口划入指定vlan中
    switchport access vlan10
 trunk: 对传输数据不打标, 允许不同vlan数据包进行传输
 设置方式:
 1) 指定接口模式
 sw mode trunk
虚拟主机上网原理
问题一:ssh远程连接不上
  虚拟主机网络信息:
  01.虚拟网卡地址配置
  02.确认选择虚拟网卡
  03.确认远程服务是否开启
  04.确认安全服务关闭
    物理主机网络信息
    01.确认虚拟网卡激活
    02.确认虚拟网卡地址
    03确认虚拟网络服务  services.msc
  问题二:无法访问外网
    原因:
    01.网卡信息配置
    02.初始化虚拟网络配置
    03.确认虚拟网络服务   service.msc
    04.翻墙代理工具开启
   方式:桥接
图片.png

综合架构部署阶段

1.将基础部分知识 进行实际应用
2.综合架构所学习内容企业应用
3.综合架构学习各种服务程序  如何学习服务应用  排错配置方法
4.综合架构后续做铺垫      shell    mysql数据库  代码上线   jinkens
5.综合架构完后会有架构述职   
综合架构组成部分
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
架构图
综合架构环境准备
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]
上一篇 下一篇

猜你喜欢

热点阅读