1. 准备知识
1.1 Iperf命令
假设iperf服务端为主机tian04,使用TCP协议,那么在控制台执行以下两个命令开启服务器进程。
iperf-s -p 12000 -i1
iperf-s -p 12001 -i1
假设iperf客户端为主机tian05,tian06。注意,与1G的实验环境使用的命令不同,当关闭网卡TSO、GSO时,R320服务器无法使用一个进程达到满带宽(约为9.42 Gbps),命令和结果如下:
iperf -c 192.168.9.4 -p 12000 -i1 -t 15
为了利用全部带宽,至少需要在客户端开启两个进程。命令和结果如下:
iperf-c 192.168.9.4 -p 12002 -i1 -t 15 -P 2
在拥塞实验中,tian05和tian06同时对tian04发包,客户端只能分享到接近5Gbps的带宽,因此上述两种客户端命令对实验结果并无影响。
1.1 开启Linux内核ECN特性
三台主机均需执行:
sudosysctl -w net.ipv4.tcp_ecn=1
当Linux内核开启ECN特性之后,iperf会在TCP握手时自动协商,使得该TCP连接启用ECN。
2. 配置交换机
以下大多数知识在华为文档QoS配置指南的第3章和第5章。
2.1 本交换机的独特特性
与之前用过的交换机不一样(暂未写完)
2.2 配置WRED丢弃模板
system-view
drop-profile drop-profile-name
color { green | non-tcp | red | yellow } low-limitlow-limit-percentage high-limit high-limit-percentage discard-percentagediscard-percentage
low-limit-percentage:当队列中的报文长度占队列长度达到此百分比时,开始进行WRED丢弃。
discard-percentage:指定WRED的最大丢弃概率。
commit
2.3 应用WRED丢弃模板
配置WRED丢弃模板后,需要在接口或端口队列上应用,WRED丢弃模板才会生效。以下描述在端口队列上应用WRED丢弃模板
system-view
interface interface-type interface-number 进入接口视图
qos queue queue-index wred drop-profile-name 将WRED丢弃模板应用于端口队列
commit
2.4 应用ECN
队列仅当应用WRED丢弃模板后才可以使能(enable)该队列的显式拥塞通知功能。
system-view
interface interface-type interface-number 进入接口视图
qos queue queue-index ecn 指定队列显式拥塞通知功能
commit
2.5 检查配置结果
display drop-profile [ brief | drop-profile-name ]查看WRED丢弃模板的配置结果。
display qos configuration interface [ interface-typeinterface-number ] 查看接口上所有的QoS配置信息。
2.6 命令综合运用
#创建wred模板
system-view
drop-profile drop-profile-tyz
DCTCP ECN 配置方法:
color green low-limit 2 high-limit 2discard-percentage 100
commit
quit
#以下开始配置各个端口的ECN(配了客户端没用,客户端不会拥塞)
int 10ge1/0/4
qos queue 0 wred drop-profile-tyz #查看3.5节服务等级与端口队列索引关系,可知发往队列0
qos queue 0 ecn
commit
quit
int 10ge1/0/5
qos queue 0 wred drop-profile-tyz
qos queue 0 ecn
commit
quit
int 10ge1/0/6
qos queue 0 wred drop-profile-tyz
qos queue 0 ecn
commit
quit
#查看配置结果
display drop-profile drop-profile-tyz
display qos configuration int 10ge1/0/4
display qos configuration int 10ge1/0/5
display qos configuration int 10ge1/0/6
3. 实验
首先,服务端tian04按照1.1节内容开启服务器进程。另外,服务端需要让10G网卡进入混杂模式并抓包。使用tcpdump完成这个工作。
sudotcpdump -i p1p1 -s 80 -w tian01.pcap
其中,-s80参数表示只抓取每个数据包的前80个字节,这已经抓取了完整的数据包头。注意到Ethernet、IP、TCP包头长度分别为14、20、20字节,而TCP经常启用了选项(option)字段,因此设为80字节是合理的。
不抓取完整数据包的原因:在1G实验环境中,如果抓取完整数据包,内核就会偶尔出现负载过大丢弃数据包的情况,极大影响了实验效果。
两个客户端tian05、tian06同时分别执行
iperf-c 192.168.9.4 -p 12000 -i1 -t 15
iperf-c 192.168.9.4 -p 12001 -i1 -t 15
15秒后运行完毕,终止tian04的tcpdump,并把pcap文件送往有图形界面的R730服务器中作分析。
scptian01.pcap commonuser@192.168.1.51:/home/commonuser/tyz/tian01.pcap
在wireshark中寻找IP包头CE 两个bit为11 = 0x3的数据包,过滤器设置ip.dsfield == 0x3。示例如下: