网络设备知识笔记

华三设备常用命令说明

查看各网口状态, 以及各接口IP

display int brief

这个命令会展示两部分的内容, 一部分是route mode的网口, 另一部分是bridge mode的网口, 分别对应了第三层(IP层)和第二层(链路层)的接口. 第三层的接口会带IP信息, 而第二层只是桥接, 不带IP信息.
这是一个MSR830-6EI的路由器, 有6个物理接口从GE0到GE5, 在配置中, GE0-GE4被配置为了第三层接口, GE5依然是第二层接口. 在结果中, GE0/0对应标识为GE0的物理网口, 同样, GE0/1GE0/5对应标识为GE1GE5的物理网口. 其中GE0/0还有两个子接口GE0/0.10和GE0/0.11

这是另一个MSR830-6EI上的配置, 其中GE0和GE1是路由网口, GE2-GE5是桥接网口. 内部还设置了一个回路网口Loop0并配置了IP, 配置了一个VLAN接口Vlan100并配置了IP. 通过GE2-GE5接入的设备, 可以直接ping通Loop0和Vlan100的IP.

包转发率 PPS

一个最小的报文结构如下图

可以看到, 一个报文至少需要占用84个字节, 对于1G网卡, 首先算出字节数
1Gbps = 1,000,000,000 bits/s = (1,000,000,000 bits/s) / (8 bits/byte)= 125,000,000 bytes/s
然后可以计算出需要支持的最大包转发率
PPS = (125,000,000 bytes/s) / (84 bytes/packet) = 1,488,095 pps

由此可以得到不同速率网卡需要支持的最大包转发率

Speed bps Bps Max PPS
10Mbps 10,000,000 1,250,000 14,881 15Kpps
100Mbps 100,000,000 12,500,000 148,810 150Kpps
1Gbps 1,000,000,000 125,000,000 1,488,095 1.5Mpps
10Gbps 10,000,000,000 1,250,000,000 14,880,952 15Mpps
100Gbps 100,000,000,000 12,500,000,000 148,809,524 150Mpps

VLAN报文 88 bytes/package, 802.1Q报文 92 bytes/package, MPLS报文 96 bytes, 对于这些报文对应要到达网口速率的包转发率就会相应减少

网卡测试

修改MTU

测试不同MTU情况下, 网卡的带宽
Linux

ip link set dev eth0 mtu 1500

Win7, Win10

  • Open a command windows, run as administrator
  • type the command : netsh interface ipv4 show subinterfaces, this should output your interfaces and current MTU size.
  • Remember the interface name as you will need it to change the MTU size (For my example it is Ethernet).
  • Type the following command set new MTU size to 1518, netsh interface ipv4 set subinterface “Ethernet” mtu=1518 store=persistent

Windows对网速的限制

Windows默认会限制接收窗口(receive window)大小, 在这个链接中有详细解释
https://www.duckware.com/blog/how-windows-is-killing-internet-download-speeds/index.html
可以通过下面命令查看

C:\>netsh interface tcp show global
C:\>netsh interface tcp show heuristics

解决办法是关闭heuristics

C:\>netsh interface tcp set heuristics disabled

UDP协议下网速慢的问题

https://serverfault.com/questions/432101/why-is-udp-slower-than-tcp-on-ubuntu-server
Each frame goes through several buffers as you send it: The application buffer, The Protocol Buffer, The Software interface buffer and the Hardware interface buffer. As you start stressing the stack by sending high speed data you will fill up these buffers and either block or lose data. You also have strategies for timeliness and polling that can impact your performance. For example, by using a larger buffer and poll less often you can get much better performance while sacrificing latency.

TCP is optimized for high speed bulk transfers while UDP is optimized for low latency in the Linux kernel. This has an impact on buffer sizes and how data is polled and handed over. In addition to this, you frequently have offloading to hardware for TCP. I would expect considerably better performance for TCP compared to UDP.

Note that sending high speed data over UDP is usually a bad idea, unless you implement your own congestion control. TCP protects your network from congestion collapses. Use UDP when you have small amounts of data or high timeliness requirements.

iperf3测试

服务端

$ sudo iperf3 -s
 ------------------------------------------------------------
 Server listening on TCP port 5001
 TCP window size: 85.3 KByte (default)
 ------------------------------------------------------------

客户端

$ sudo iperf3 -c 172.17.16.78 -i1 -t 10 -m
# -i 统计的时间间隔
# -t 统计的总时间长度
# -m 打印 TCP MSS 尺寸
# -P 在客户端使用时, 表示并发的连接数, 默认为1
# -u 使用UDP (默认为TCP)
# -b 设置带宽限制, 对于TCP默认不限制, 对于UDP默认是1Mbps, 对于10GE可以设置为 -b 10000M

端口聚合

使用以太通道的话,交换机会把一组物理端口联合起来,做为一个逻辑的通道,也就是channel-group,这样交换机会认为这个逻辑通道为一个端口.
端口汇聚是将多个端口聚合在一起形成1个汇聚组,以实现出负荷在各成员端口中的分担,同时也提供了更高的连接可靠性。端口汇聚可以分为手工汇聚、动态lacp汇聚和静态lacp汇聚。同一个汇聚组中端口的基本配置应该保持一致,即如果某端口为trunk端口,则其他端口也配置为trunk端口;如该端口的链路类型改为access端口,则其他端口的链路类型也改为access端口。

技术优点

  • 带宽增加
    带宽相当于组成组的端口的带宽总和。
  • 增加冗余
    只要组内不是所有的端口都down掉,两个交换机之间仍然可以继续通信。
  • 负载均衡
    可以在组内的端口上配置,使流量可以在这些端口上自动进行负载均衡。

端口聚合它可将多物理连接当作一个单一的逻辑连接来处理,它允许两个交换器之间通过多个端口并行连接同时传输数据以提供更高的带宽、更大的吞吐量和可恢复性的技术。 一般来说,两个普通交换器连接的最大带宽取决于媒介的连接速度(100BAST-TX双绞线为200M),而使用Trunk技术可以将4个200M的端口捆绑后成为一个高达800M的连接。这一技术的优点是以较低的成本通过捆绑多端口提高带宽,而其增加的开销只是连接用的普通五类网线和多占用的端口,它可以有效地提高子网的上行速度,从而消除网络访问中的瓶颈。另外Trunk还具有自动带宽平衡,即容错功能:即使Trunk只有一个连接存在时,仍然会工作,这无形中增加了系统的可靠性。

聚合组状态

聚合组按负载分担类型分为两种:负载分担聚合和非负载分担聚合。

  • 对于ip报文, 负载分担是按照目的ip和源ip
  • 对于非ip报文, 负载分担是根据源mac和目的mac
  • 对于是否使用ip还是mac,检查协议类型来区别,以太网字段etype为0800的报文是ip报文

一般情况下,系统中的负载分担式聚合资源数量有限,因此需要在手工聚合组、静态聚合组、lacp动态聚合组、及包含需要硬件聚合资源的特殊端口的聚合组之间进行合理分配负载分担聚合资源。系统将始终为优先级高的聚合组分配硬件聚合资源,当聚合资源分配完后,所创建的聚合将为非负载分担聚合。

设备

组网

http://www.h3c.com/cn/d_201909/1229723_30005_0.htm

posted on 2021-01-29 02:48  Milton  阅读(728)  评论(0编辑  收藏  举报

导航