文章目录
实验1 网络实验入门
重启交换机和路由器
reset sa
reboot
交换机端口打开或关闭
inter e1/0/1
shutdown
undo shutdown
NAT地址转换
目的:使内部局域网能够联通互联网,使用NAT可以将多个内部专用的ip地址映射为少数几个甚至一个公网ip地址,用来减少公网ip的使用;NAT有效解决的IPv4地址短缺的问题
NAT技术主要有三种方式:
- 静态NAT(Static NAT)
- 动态地址NAT(Pooled NAT)
- 网络地址与端口转换NAPT
实验中每台机器分到的ip:组号*5 + 100 ---- 组号*5+104
组网图:
配置:
R1:
acl number 2001
rule permit source 10.0.0.0 0.0.0.255
rule deny source any
nat address-group 1 192.168.5.105 192.168.5.109
------v7------
nat address-group 1
address 192.168.5.105 192.168.5.109
---------------
inter e1/0/1
nat outbound 2001 address-group 1
ip route-static 0.0.0.0 0.0.0.0 192.168.5.1
-------
acl number/basic 2001
rule permit source 10.0.0.0 0.0.0.255
rule deny source any
quit
nat address-group 1
[ address ] 192.168.5.195 192.168.5.199
quit
inter e1/0
nat outbound 2001 address-group 1
ip route-static 0.0.0.0 0.0.0.0 192.168.5.1
v7
版本的配置命令(以第一组vms1-g0为例)
[R1]acl basic 2001 或 acl number 2001
[R1-acl-2001]rule permit source 10.0.0.0 0.0.0.255
[R1-acl-2001]rule deny source any
#这个访问控制列表定义了允许IP源地址为10.0.0.0/24的外出数据包
[R1]nat address-group 1
[R1-address-group-1] address 192.168.5.105 192.168.5.109
#这条命令定义了一个包含5个公网地址(5~9)的地址池,地址池名称为1
[R1] interface e0/1
[R1-Ethernet0/1]nat outbound 2001 address-group 1
#在出接口E0/1启用地址转换
[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.5.1
#在路由表添加静态路由
实验2 数据链路层
端口聚合
查看交换机mac地址表:dis mac-address
配置端口聚合
S1:
inter bridge-aggregation 1
link-aggregation mode dynamic
inter e1/0/1
port link-aggregation group 1
inter e1/0/2
port link-aggregation group 1
Vlan配置 【mark!!!】
vlan基本配置命令:
组网:
配置命令:
S1:
vlan 2
port e1/0/1 to e1/0/5
vlan 3
port e1/0/20 to e1/0/21
# 配置13端口为trunk,并允许vlan 2 3 通过
inter e1/0/13
port link-type trunk
port trunk permit vlan 2 3
dis vlan 2
# 配置端口13为Hybrid,vlan2 tagged,vlan3 untagged,默认pvid 为 1
inter e 1/0/13
undo port link-type
port link-type hybrid
port hybrid pvid vlan 1 #默认pvid 为 1
port hybrid vlan 2 tagged
port hybrid vlan 3 untagged
PPP协议
组网图:
配置ppp指令
R1
inter Serial 1/0
link-prorocol ppp
shutdown
undo shutdown
<R1>
debugging ppp all
terminal debugging
---------------------------
# 关闭R2的端口
PAP
配置PAP
R1
local-user RTB class network
service-type ppp
password simple aaa
inter Serial 1/0
ppp authentication pap
-------------------------
R2
inter Serial 1/0
ppp pap local-user RTB password simple aaa
然后在R1上重启接口,使配置生效
shutdown
undo shutdown
然后在R1上执行debug
debugging ppp pap all
terminal debugging
inter Serial 1/0
shutdown
undo shutdown
CHAP
R1
local-user RTB class network
service-type ppp
password simple aaa
inter serial 1/0
ppp authentication-mode chap
ppp chap user RTA
-----------------------------
R2
local-user RTA class network
service-type ppp
password simple aaa
inter serial 1/0
ppp chap user RTB
然后重启端口
R1
inter Serial 1/0
shutdown
undo shutdown
实验3 网络层
清空交换机的mac地址表:undo mac-address
清空三层交换机的arp缓存 :reset arp all
清空计算机的arp缓存:arp -d
Vlan间通信
实验5 OSPF实验
ospf配置流程
R1:
router id xxxx
ospf
area x
network 192.168.2.0 0.0.0.255
常用命令:
reset ospf process
dis ospf peer
dis ospf brief
dis ospf routing-table
------------------
debugging ospf all
重设router id
之后,要使用 reset ospf process
查看LSA信息:dis ospf lsdb network
ospf调试信息:
debugging ospf event
terminal debugging
ospf设置cost
inter vlan 2
ospf cost 200
inter e1/0/1
ospf cost 100
dis ospf lsdb router
配置静态路由,并将其引入到ospf
组网图:
将s1 引入到ospf中
R1:
ip route-static 4.4.4.0 255.255.255.0 192.168.1.1
ospf
import-route static
还要再s1上配置一条返回路由
s1:
ip route-static 0.0.0.0 0.0.0.0 192.168.1.2
实验6 传输层
TCP
TCP三次握手、四次挥手
TCP基本分析
-
发送端:send300k
-
接收端: 休眠时间、计数器阈值都设为 0
TCP拥塞实验
-
发送端:send300k
-
接收端: 休眠时间 5000、计数器阈值都设为 10
慢启动、拥塞避免及拥塞处理
在路由器上配置端口转发速率为 10Mbps
[Router]interface g0/0
[Router-Gigabit0/0]qos lr outbound cir 10000
-
发送端:send6m
-
接收端: 休眠时间0 、计数器阈值都设为0
pcA一点击发送后,立刻shutdown路由器的一个端口
然后再undo shutdown
在路由器上配置端口转发速率为 80Kbps
[Router]interface g0/0
[Router-Gigabit0/0]qos lr outbound cir 10000
-
发送端:send100k
-
接收端: 休眠时间0 、计数器阈值都设为0
pcA一点击发送后,立刻shutdown路由器的一个端口
然后再undo shutdown
快重传和快恢复
-
发送端:send300k
-
接收端: 休眠时间 5000、计数器阈值都设为 10
UDP
UDPTest软件
实验7 应用层
DNS
实验8 BGP实验
v5版本
# 基本配置 v5
bgp 100
peer 2.2.2.1 as-number 100
peer 1.1.1.2 as-number 200
peer 3.1.1.2 next-hop-local
network 5.5.5.5 255.255.255.255
ping -a 5.5.5.5 4.4.4.4
# v7
bgp 100
peer 2.2.2.1 as-number 100
peer 1.1.1.2 as-number 200
address-family ipv4 unicast
peer 2.2.2.1 enable
peer 1.1.1.2 enable
peer 3.1.1.2 next-hope-local
network 5.5.5.5 255.255.255.255
debug bgp event
terminal debugging
reset bgp all
bgp路由聚合
bgp 100
aggregate 192.168.0.0 255.255.240.0
undo aggregrate 192.168.0.0 255.255.240.0
aggregate 192.168.0.0 255.255.240 detail-suppressed
----------------------------------------------------
v7
bgp 100
address-family ipv4 unicast
aggregate 192.168.0.0 255.255.240.0
bgp查看路由表
bgp 100
import-route direct
dis bgp routing-table