计算机网络: Lab5
2019-03-04 本文已影响0人
写代码的海怪
发送 TCP
配置如下图所示
![](https://img.haomeiwen.com/i2979799/c17c604605c74525.png)
Router 里有一个接口是 Serial3/0,可以用以下命令来配置
R1(config)# interface Seria1l3/0
R1(config-if)# shutdown
R1(config-if)# ip address 10.0.2.1 255.255.255.0
R1(config-if)# no shutdown
先在 PC2 开始监听
PC2% iperf3 -s
然后用以下命令发包
PC1% iperf3 -c 10.0.3.33 -n 10K -l 1K –b 100K
结果如下
![](https://img.haomeiwen.com/i2979799/7fbb9b241f5249eb.png)
发送 UDP
还是先在 PC2 开始监听
PC2% iperf3 -s
然后使用如下命令发包
PC1% iperf3 -c 10.0.3.33 -u -n 10K -l 1K –b 100K
结果如下
![](https://img.haomeiwen.com/i2979799/f0476de42efa7172.png)
MTU
可以使用如下命令去修改 MTU 的值
R1(config-if)# mtu 500
然后开启 mtu probing
PC% sysctl -w net.ipv4.tcp_mtu_probing=2
配置 Telnet
可以将某个 Router 给定用户名和密码
R1# config terminal
R1(config)# username user secret password
然后开启 Telnet Server
R1# configure terminal
R1(config-if)# line vty 0 15
R1(config-line)# login local
R1(config-line)# end
可以用以下命令创建 TCP 连接
PC1% telnet 10.0.1.1
结果如下
![](https://img.haomeiwen.com/i2979799/adfbdfb4d140ae5c.png)
如果和不存在的 IP 创建连接,那么结果会是这样
![](https://img.haomeiwen.com/i2979799/1031ea6434fee539.png)
会不断地 Retransmit