第八天 HCIA 149

今日授课内容:

1、ospf实验:单区域 多区域

第一步:基本配置 直连的连通性

第二步:每台设备配置router id(交换机无需任何配置) R1: [R1]ospf 1 router-id 1.1.1.1 ---该命令相当于两个含义 第一个含义就是启动OSPF协议 第二个指定router id为1.1.1.1

R2: [R2]ospf 1 router-id 2.2.2.2 ......

第三步:宣告我们接口网段 [R1]ospf 1 [R1-ospf-1]area 1 ----床架区域1 [R1-ospf-1-area-0.0.0.1]network 192.168.12.1 0.0.0.0 -----宣告 精确宣告 0.0.0.0就是反掩码

[R2]ospf 1 [R2-ospf-1]area 1 [R2-ospf-1-area-0.0.0.1]network 192.168.12.2 0.0.0.0 ------0.0.0.1代表是area 1 [R2-ospf-1-area-0.0.0.1]quit [R2-ospf-1]area 0 ------创建area 0 [R2-ospf-1-area-0.0.0.0]network 192.168.234.2 0.0.0.0

[R3]ospf 1 [R3-ospf-1]area 0 [R3-ospf-1-area-0.0.0.0]network 192.168.234.3 0.0.0.0

[R4]ospf 1 [R4-ospf-1]area 0 [R4-ospf-1-area-0.0.0.0]network 192.168.234.4 0.0.0.0 [R4-ospf-1-area-0.0.0.0]quit [R4-ospf-1]area 2 [R4-ospf-1-area-0.0.0.2]network 192.168.45.4 0.0.0.0

[R5]ospf 1 [R5-ospf-1]area 2 [R5-ospf-1-area-0.0.0.2]network 192.168.45.5 0.0.0.0

第四步:检查两个设备的关系是否建立成功 看到FULL之后才能建立成功 <R1>display ospf peer brief

 OSPF Process 1 with Router ID 1.1.1.1
	  Peer Statistic Information

Area Id Interface Neighbor id State
0.0.0.1 GigabitEthernet0/0/0 2.2.2.2 Full

<R1>、

[R2]display ospf peer brief

 OSPF Process 1 with Router ID 2.2.2.2
	  Peer Statistic Information

Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/1 3.3.3.3 Full
0.0.0.0 GigabitEthernet0/0/1 4.4.4.4 Full
0.0.0.1 GigabitEthernet0/0/0 1.1.1.1 Full

[R2]

第五步:宣告非必须的网段 设备的loopback接口地址

[R1]ospf 1 [R1-ospf-1]area 1 [R1-ospf-1-area-0.0.0.1]network 1.1.1.1 0.0.0.0

[R2]ospf 1 [R2-ospf-1]area 0 [R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0

[R3]ospf 1 [R3-ospf-1]area 0 [R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0

[R4]ospf 1 [R4-ospf-1]ar 0 [R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0

[R5]ospf 1 [R5-ospf-1]ar 2 [R5-ospf-1-area-0.0.0.2]network 5.5.5.5 0.0.0.0

检查 [R1]display ip routing-table protocol ospf Route Flags: R - relay, D - download to fib

Public routing table : OSPF Destinations : 6 Routes : 6

OSPF routing table status : <Active> Destinations : 6 Routes : 6

Destination/Mask Proto Pre Cost Flags NextHop Interface

    2.2.2.2/32  OSPF    10   1           D   192.168.12.2    GigabitEthernet

0/0/0 3.3.3.3/32 OSPF 10 2 D 192.168.12.2 GigabitEthernet 0/0/0 4.4.4.4/32 OSPF 10 2 D 192.168.12.2 GigabitEthernet 0/0/0 5.5.5.5/32 OSPF 10 3 D 192.168.12.2 GigabitEthernet 0/0/0 192.168.45.0/24 OSPF 10 3 D 192.168.12.2 GigabitEthernet 0/0/0 192.168.234.0/24 OSPF 10 2 D 192.168.12.2 GigabitEthernet 0/0/0

OSPF routing table status : <Inactive> Destinations : 0 Routes : 0

第六步:设置R2和R4的接口优先级 [R2]interface GigabitEthernet 0/0/1 [R2-GigabitEthernet0/0/1]ospf dr-priority 0

[R4]interface GigabitEthernet 0/0/0 [R4-GigabitEthernet0/0/0]ospf dr-priority 0

在R3上面检查 <R3>display ospf peer

 OSPF Process 1 with Router ID 3.3.3.3
	 Neighbors 

Area 0.0.0.0 interface 192.168.234.3(GigabitEthernet0/0/0)'s neighbors Router ID: 2.2.2.2 Address: 192.168.234.2
State: Full Mode:Nbr is Slave Priority: 0 DR: 192.168.234.3 BDR: None MTU: 0
Dead timer due in 33 sec Retrans timer interval: 5 Neighbor is up for 00:00:42
Authentication Sequence: [ 0 ]

Router ID: 4.4.4.4 Address: 192.168.234.4
State: Full Mode:Nbr is Master Priority: 0 DR: 192.168.234.3 BDR: None MTU: 0
Dead timer due in 33 sec Retrans timer interval: 4 Neighbor is up for 00:00:33
Authentication Sequence: [ 0 ]

第七步:认证 [R1]ospf 1 [R1-ospf-1]area 1 [R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 plain spoto

[R2]ospf 1 [R2-ospf-1]area 1 [R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 plain spoto

[R4]int g0/0/1 [R4-GigabitEthernet0/0/1]ospf authentication-mode simple cipher huawei

[R5]int g0/0/0 [R5-GigabitEthernet0/0/0]ospf authentication-mode simple cipher huawei

三张表 邻居表 <R1>display ospf peer brief

 OSPF Process 1 with Router ID 1.1.1.1
	  Peer Statistic Information

Area Id Interface Neighbor id State
0.0.0.1 GigabitEthernet0/0/0 2.2.2.2 Full

<R1>

数据库表 LSDB <R1>display ospf lsdb

 OSPF Process 1 with Router ID 1.1.1.1
	 Link State Database 

	         Area: 0.0.0.1

Type LinkState ID AdvRouter Age Len Sequence Metric Router 2.2.2.2 2.2.2.2 821 36 8000000A 1 Router 1.1.1.1 1.1.1.1 811 48 8000000F 1 Network 192.168.12.1 1.1.1.1 811 32 80000005 0 Sum-Net 192.168.45.0 2.2.2.2 791 28 80000001 2 Sum-Net 5.5.5.5 2.2.2.2 791 28 80000001 2 Sum-Net 3.3.3.3 2.2.2.2 802 28 80000001 1 Sum-Net 4.4.4.4 2.2.2.2 791 28 80000001 1 Sum-Net 2.2.2.2 2.2.2.2 1128 28 80000001 0 Sum-Net 192.168.234.0 2.2.2.2 1635 28 80000001 1

<R1>

路由表 <R1>display ip routing-table protocol ospf Route Flags: R - relay, D - download to fib

Public routing table : OSPF Destinations : 6 Routes : 6

OSPF routing table status : <Active> Destinations : 6 Routes : 6

Destination/Mask Proto Pre Cost Flags NextHop Interface

    2.2.2.2/32  OSPF    10   1           D   192.168.12.2    GigabitEthernet

0/0/0 3.3.3.3/32 OSPF 10 2 D 192.168.12.2 GigabitEthernet 0/0/0 4.4.4.4/32 OSPF 10 2 D 192.168.12.2 GigabitEthernet 0/0/0 5.5.5.5/32 OSPF 10 3 D 192.168.12.2 GigabitEthernet 0/0/0 192.168.45.0/24 OSPF 10 3 D 192.168.12.2 GigabitEthernet 0/0/0 192.168.234.0/24 OSPF 10 2 D 192.168.12.2 GigabitEthernet 0/0/0

OSPF routing table status : <Inactive> Destinations : 0 Routes : 0

<R1>

2、交换机的工作原理

最典型的2750

交换机当中有一个MAC地址表项 这个表项类似于路由表一样

交换机的三种行为: 转发 泛洪 丢弃

单播:一对一的形式 组播:一对多的形式 广播:一堆所有的形式

Display mac-address 查看交换机的地址表项

二层交换机封装和解封装只看MAC地址

交换机收到一个单播数据的时候 查找MAC地址表项:如果DMAC地址在MAC地址表项里面 执行转发操作 如果DMAC地址不在MAC地址表项里面 执行泛洪操作

交换机收到一个广播数据的时候 交换机直接从其他接口广播出去

泛洪和广播区别? 广播的一路到底 泛洪不一定是一路到底

交换机的原理 交换机通过解析数据包的里面源MAC地址 把源MAC和对应的接口放到MAC地址表项里面 这个表项里面的每一个条目的老化时间为300S 如果这个条目在300S之内能够重新被学习到 计时器被重新刷新

[SW1]display mac-address aging-time 查看老化时间

Aging time: 300 seconds

交换机的不足:

3、VLAN技术的实现