网络通讯基础

网络通讯基础

欢迎来到 来到大浪涛天的博客

1. 网络通讯基本原理

  1. 主机之间需要有传输介质
  2. 主机上必须有网卡设备
  3. 可以将二进制信息转换为高低电压 信号的调制过程
  4. 可以将高低电压转换为二进制信息 信号的解调过程
  5. 多台主机需要协商网络速率
  6. 常见的问题: 购买一个100M网络线路, 但是用迅雷下载软件的时候远远到达不了100M
  • 100Mb 网络的数据单位 bit 1bit=1/8byte 100/8=12.5 10M 12M
  • 100MB 磁盘的数据单位 Byte 1byte=8bit 100*8=800M

2. 网络基础硬件介绍

  1. 交换机: 在一个网络中实现多台主机之间通讯, 一台交换机所连接的所有主机构成网络,成为局域网
    实现通讯:
  • 主机上要有相应的mac地址(物理地址) 有12位16进制数组成 0-9 A B C D E F
  • 利用交换机进行通讯,有时需要借助广播方进行通讯
  • 广播的产生有时会影响主机性能
  • 通讯的过程一定是有去有回的
  1. 路由器: 实现不同局域网主机之间的通讯
    实现通讯:
  • 主机上要有相应的IP地址(逻辑地址) 用十进制表示 192.168.10.1
    IP地址的组成: 网络信息(局域网标识)+主机地址信息
  • 需要借助路由器中的路由表实现通讯
    网络信息(局域网标识信息) 接口信息 R1
              01                 eth0
                02                 eth1
                04                 eth2       手动配置

路由表的信息是如何生成的?

  • 利用直连网络环境自动生成
  • 利用手工配置方式 (静态路由配置)
  • 利用路由协议动态生成 (动态路由配置)
  • 网关: 一个主机想访问其他网络主机的必经之路
    • 路由器的接口: 网关接口
    • 路由器的地址: 网关地址
  1. 静态路由配置方法:
  • 网络环境规划
   a 两台主机 
     主机01  192.168.1.1  == 01.01    
             192.168.1.254
     主机02  192.168.4.1  == 04.01
             192.168.4.254
   b 两台交换机
   c 三台路由器
  • 第一个里程: 路由器配置(接口地址配置)
    R1
  Router> en  
    Router# conf t             
    Router(config)# interface interface g0/0    
    Router(config-if)#

g0/0接口配置

  ip address 192.168.1.254 255.255.255.0
    no shutdown

g0/1接口配置

  ip address 192.168.2.1 255.255.255.0
    no shutdown
检查确认:
  ctrl+z 快速返回到特权模式
    show ip interface brief    --- 只显示ip地址信息
    Router#show ip int br
    Interface              IP-Address      OK? Method Status                Protocol 
    GigabitEthernet0/0     192.168.1.254   YES manual up                    up 
    GigabitEthernet0/1     192.168.2.1     YES manual up                    down 

    R2
    R2#show ip int br
    Interface              IP-Address      OK? Method Status                Protocol 
    GigabitEthernet0/0     192.168.2.2     YES manual up                    up 
    GigabitEthernet0/1     192.168.3.1     YES manual up                    down 

    R3
    Router#show ip int br
    Interface              IP-Address      OK? Method Status                Protocol 
    GigabitEthernet0/0     192.168.3.2     YES manual up                    up 
    GigabitEthernet0/1     192.168.4.254   YES manual up                    up 
R1路由表信息
    R1#show ip route
         192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
    C       192.168.1.0/24   is directly connected, GigabitEthernet0/0
    L       192.168.1.254/32 is directly connected, GigabitEthernet0/0

        192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
    C       192.168.2.0/24   is directly connected, GigabitEthernet0/1
    L       192.168.2.1/32   is directly connected, GigabitEthernet0/1  
路由配置 
    ip route 去往网络地址信息 网络掩码  去往目标的下一条接口地址
    ip route 192.168.4.0 255.255.255.0 192.168.2.2  
    R1#show ip route
         192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
    C       192.168.1.0/24 is directly connected, GigabitEthernet0/0
    L       192.168.1.254/32 is directly connected, GigabitEthernet0/0
         192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
    C       192.168.2.0/24 is directly connected, GigabitEthernet0/1
    L       192.168.2.1/32 is directly connected, GigabitEthernet0/1

    S    192.168.4.0/24 [1/0] via 192.168.2.2
R2路由表信息
         192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
    C       192.168.2.0/24 is directly connected, GigabitEthernet0/0
    L       192.168.2.2/32 is directly connected, GigabitEthernet0/0

         192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
    C       192.168.3.0/24 is directly connected, GigabitEthernet0/1
    L       192.168.3.1/32 is directly connected, GigabitEthernet0/1
路由配置 
    ip route 去往网络地址信息 网络掩码  去往目标的下一条接口地址
    ip route 192.168.4.0 255.255.255.0 192.168.3.2
    ip route 192.168.1.0 255.255.255.0 192.168.2.1

         192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
    C       192.168.2.0/24 is directly connected, GigabitEthernet0/0
    L       192.168.2.2/32 is directly connected, GigabitEthernet0/0
         192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
    C       192.168.3.0/24 is directly connected, GigabitEthernet0/1
    L       192.168.3.1/32 is directly connected, GigabitEthernet0/1

    S    192.168.4.0/24 [1/0] via 192.168.3.2
    S    192.168.1.0/24 [1/0] via 192.168.2.1
R3路由表信息
       192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
    C       192.168.3.0/24 is directly connected, GigabitEthernet0/0
    L       192.168.3.2/32 is directly connected, GigabitEthernet0/0

         192.168.4.0/24 is variably subnetted, 2 subnets, 2 masks
    C       192.168.4.0/24   is directly connected, GigabitEthernet0/1
    L       192.168.4.254/32 is directly connected, GigabitEthernet0/1
路由配置 
    ip route 去往网络地址信息 网络掩码  去往目标的下一条接口地址
    ip route 192.168.1.0 255.255.255.0 192.168.3.1  

    S    192.168.1.0/24 [1/0] via 192.168.3.1

         192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
    C       192.168.3.0/24 is directly connected, GigabitEthernet0/0
    L       192.168.3.2/32 is directly connected, GigabitEthernet0/0
         192.168.4.0/24 is variably subnetted, 2 subnets, 2 masks
    C       192.168.4.0/24 is directly connected, GigabitEthernet0/1
    L       192.168.4.254/32 is directly connected, GigabitEthernet0/1
删除静态路由方法:
  R1取消静态路由
    no ip route 192.168.4.0 255.255.255.0 192.168.2.2
    R2取消静态路由
    no ip route 192.168.4.0 255.255.255.0 192.168.3.2
    no ip route 192.168.1.0 255.255.255.0 192.168.2.1   
    R3取消静态路由
    no ip route 192.168.1.0 255.255.255.0 192.168.3.1
  1. 动态路由配置方法:
    实现多个路由器路由表信息一致的过程: 路由收敛过程
    动态路由协议如何配置:
    RIP 思科私有(EIGRP) OSPF IS-IS BGP
    R1动态路由配置:
  router rip   --- 指定配置使用什么路由协议
    network 192.168.1.0   --- 宣告过程
    network 192.168.2.0 

学习的信息

  R    192.168.3.0/24 [120/1] via 192.168.2.2, 00:00:09, GigabitEthernet0/1
    R    192.168.4.0/24 [120/2] via 192.168.2.2, 00:00:20, GigabitEthernet0/1

R2动态路由配置

  router rip
    network 192.168.2.0
    network 192.168.3.0

学习的信息

  R    192.168.1.0/24 [120/1] via 192.168.2.1, 00:00:07, GigabitEthernet0/0
    R    192.168.4.0/24 [120/1] via 192.168.3.2, 00:00:13, GigabitEthernet0/1

R3动态路由配置

  router rip
    network 192.168.3.0
    network 192.168.4.0

学习的信息

  R    192.168.1.0/24 [120/2] via 192.168.3.1, 00:00:23, GigabitEthernet0/0
    R    192.168.2.0/24 [120/1] via 192.168.3.1, 00:00:23, GigabitEthernet0/0
  1. 网络架构设计方法(网络拓扑)
    三个层次规划网络拓扑
    核心层: 路由器(网关接口) 实现和外网通讯 冗余能力(主备)
    汇聚层: 交换机(三层交换机) 冗余能力 策略控制能力
    接入层: 交换机(二层交换机) 终端设备接入网络

  2. 网络层次模型
    OSI7层模型(公司的组织架构)
    层次模型结构: 由上至下
    应用层 标准规范

    • 应用层程序接口规范
      表示层
    • 数据转换加密 压缩
      会话层
    • 控制网络连接建立或者终止
      传输层
    • 保证数据传输的可靠性
      网络层 路由协议EIGRP(语言) 网络层 路由的能力 三层设备
    • 可以实现通过路由找到目标网络
      数据链路层 交换能力 二层设备
    • 可以实现通过交换找到真正目标主机
      物理层
    • 指定一些网络物理设备标准 网卡 网线 光纤
  3. TCP/IP模型(4层模型)
    在OSI7层模型的基础上做了简化

    • 应用层
    • 表示层 应用层
    • 会话层
    • 传输层 主机到主机层
    • 网络层 互联网层
    • 数据链路层 接入层
    • 物理层
  4. TCP协议和UDP协议优缺点

  • TCP协议: 传输控制协议 --- 面向连接的网络协议
    • 在线发送文件==面向连接
    • 发送文件 --> 对端点击接收
    • 数据传输可靠性高
    • 数据传输效率低
  • UDP协议: 用户报文协议 --- 无连接的网络协议
    • 离线发送文件==无连接
    • 发送文件 --> 直接发送了
    • 数据传输效率高
    • 数据传输可靠性低

posted @ 2020-05-17 11:13  OuYangTao  阅读(241)  评论(0编辑  收藏  举报