189 8069 5689

传输层TCP/UDP的示例分析

小编给大家分享一下传输层TCP/UDP的示例分析,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

竞秀ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18982081108(备注:SSL证书合作)期待与您的合作!

OSI 7 层

1 - 物理层                                                     
2 - 数据链路层                                                       
3 - 网络层                                                     
      编址和路由                                                     
4 - 传输层                                                     
      提供端到端的数据连接(端,就是端口的端)                                                      
        TCP                                                 
           UDP                                              

 5 - 会话层(系统内部实现机制,数据包中无法体现出来)                                                       
 6 - 表示层(系统内部实现机制,数据包中无法体现出来)                                                       
 7 - 应用层

==================================================

        seq: sequence number , 序列号;                                                     
 acknowledge :确定号;                                                      

  mask : 掩码;                                                        
subnet mask : 子网掩码                                                      
inverse mask :反掩码                                                       
wildcard bits:通配符                                                       

keep-alive : 保持存活计时器                                                        

传输层协议:端口 ===> 套接字 (socket)                                                      

TCP:80 ----> HTTP ,属于一个应用程序;                                                        

所以:                                                     
  一个套接字,就可以表示一个应用程序;                                                        

 IP socket => IP + TCP/UDP:Port ,表示的是IP地址代表的网络设备上的                                                      
                                应用程序;                                                       

 FTP :tcp 21/20                                                     
 Telnet : tcp 23                                                        
 SMTP:tcp 25                                                        
 POP3:                                                      
 DNS:tcp 53                                                     
 HTTP: tcp 80                                                       

 查看本机设备上的常用服务的端口号:                                                      
     C:\windows\system32\drivers\etc\service                                                        

 该文件中包含的都是一些“知名服务-wellknown”,           所用的端口号,一般都   不会进行更改。                                                        
   所以,这些服务使用的端口号,也称之为“ well-know port ”                                                     

    Port:                                                       
在报文中(TCP/UDP)占用了2个字节,所以端口号的取值空间                                                     
是: 0-65535 ;                                                    
   分类:                                                  
       知名端口号:                                                   
       随机高端口:大于1024的端口,称之为随机高端口;

=============================================================

 [huawei> system-view                                                       
[huawei]sysname R1                                                      
[R1]interface gi0/0/0                                                       
[R1-gi0/0/0]undo shutdown                                                       
[R1-gi0/0/0]ip address 192.168.1.1 255.255.255.0

  system-view                                                       
   [huawei]sysname R2                                                       
  [R2]interface gi0/0/0                                                     
  [R2-gi0/0/0]undo shutdown                                                         
   [R2-gi0/0/0]ip address 192.168.1.2 255.255.255.0                                                         
   [R2-gi0/0/0]quit                                                     

 [R2]user-interface vty 0 4 //远程用户的登录接口                                                     
[R2-userinterface-vty]authentication-mode password                                                      
                                        123haha                                                                   
                                                                                    quit

 [R2]                                                       
[R1]quit                                                        
telnet 192.168.1.2                                                      
 123haha

 R1/R2:                                                         
 进行以下配置,可以在 R1-R2之间抓取 udp 的报文(udp 520表示 RIP)                                                        
[R1]rip                                                     
[R1-rip-1]undo summary                                                      
[R1-rip-1]network 192.168.1.0                                                       

[R2]rip                                                     
[R2-rip-1]undo summary                                                      
[R2-rip-1]network 192.168.1.0


            个人学习笔记                                                      
实验名称:TCP/UDP报文结构分析                                                      
 实验拓扑:(缺)                                                       
实验需求:                                                       
 1、配置R1-R2互联链路:192.168.1.0/24                                                       
 2、配置R2的 telnet 密码,在R1上远程访问;抓取TCP报文并分析                                                  
     3、在R1和R2之间运行RIP协议;抓取 UDP 报文并分析                                                 

     实验步骤:                                                      
     1、配置R1,R2的端口IP地址;(并开启抓包功能)                                                     
       interface gi0/0/0                                                    
          undo shutdown                                                 
          ip address 192.168.1.1 255.255.255.0                                          
       interface gi0/0/0                                                
           undo shutdown                                                
          ip address 192.168.1.2  255.255.255.0                                         
 2、配置R2的 telnet 使用密码;                                                   
       user-interface vty 0 4                                                   
          authentication-mode password                                              
                                     hahahehe                                       

3、配置路由协议 - RIP ;(R1/R2同样的配置命令)                                              
        rip                                                 
          undo summary                                      
          version 2                                         
          network 192.168.1.0                                       

 4、验证与测试                                                    
       抓TCP: telnet 192.168.1.2                                                 
       抓UDP: 配置完 RIP,就可以随时抓取。因为RIP是周期性的发包                           
 5、保存配置                                                 
       save                                               

  实验总结:                                                     
1、Ethernet 头部机构                                                     
0、IP头部结构                                                        
  1、TCP结构                                                       
  2、UDP结构                                                       
  3、RIP的端口号是 udp 520 ,并且是以广播的方式发包(255.255.255.255)                                                      
4、Telnet 的端口是 tcp 23 ;                                                      
 5、使用一个端口表示应用时,该端口表示的一般都是目标端口,

此时对应的源端口,都是“随机高端口”;


 实验名称:配置 HTTP 与 DNS 功能                                                      
实验拓扑:                                                       
实验需求:                                                       
 1、按图中所示配置网络设备IP地址;                                                     
    2、通过客户端访问 web 服务器,看到相关内容                                                    
 实验步骤:                                                      
1、配置网络设备                                                        
        Gateway:                                                    
            -客户端网关                                          
                  interface gi0/0/0                                         
                  undo shutdown                                     
                  ip address 192.168.2.254 255.255.255.0                                    
            #NAME?                                      
                  interface gi0/0/1                                         
                  undo shutdown                                     
                  ip address 192.168.1.254 255.255.255.0                                    
2、配置客户端主机                                                   
    -配置IP地址 : 192.168.2.1 /24                                                   
    -配置网关地址:192.168.2.254                                               
    -配置DNS服务器地址:192.168.1.1                                             
    #NAME?                                              
3、配置服务器主机                                                       
    -基本IP地址配置                                                   
          ip:192.168.1.1 /24                                                
          gateway:192.168.1.254                                         
    #NAME?                                              
          -添加映射条目                                               
              www.tedu.cn     192.168.1.1                                           
          -开启 DNS 服务                                            
              “启动”                                          
    #NAME?                                              
          -添加 HTTP 服务器的默认网页文件                                               
          -开启 HTTP 服务                                           
              “启动”                                          
4、验证与测试                                                 
    在客户端设备,通过 http client ,输入 www.tedu.cn ,                                                 
    然后获取,就可以看到我们之前在服务器上上传的“默认网页”                                                

 实验总结:                                                      
        1、通过抓包分析,学习了 HTTP 报文 ;                                                      
         2、通过抓包分析,学习了 DNS 报文  ;                                                         
         3、HTTP的端口号 ...                                                         
          4、NDS的端口号 ...     

           远程访问                 

           设置访问人数:                  
            {huawei}user-interface vty 0 4                  
   身份验证模式:aaa                   
 {huawei-ui-vty0-4}authentication-mode aaa                  
    进入aaa模式:                    
     {huawei}aaa                    
     创建远程用户ar2 密码 加密123                 
      {huawei-aaa}local-user ar2 password cipher 123                    
   远程用户ar2 访问权限 15                  
 {huawei-aaa}local-user privilege level 15                  
 远程用户ar2 访问模式 telnet                    
  {huawei-aaa}local-user ar2 service-type telnet

以上是“传输层TCP/UDP的示例分析”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!


分享文章:传输层TCP/UDP的示例分析
URL地址:http://cdxtjz.cn/article/jdjisg.html

其他资讯