记录每日所学
一、静态路由
静态路由: 静态路由指由用户或网络管理员手工配置的路由信息。静态路由信息在缺省情况下是私有的,不会传递给其他的路由器。静态路由一般适用于比较简单的网络环境
优点:
- 运行稳定
- 节省设备链路的开销
缺点:
- 对大型网络来说,工作量较大,拓扑一旦发生了改变,维护量变大
建议:小型网络使用静态路由、中大型网络使用动态路由协议
实验:
R1配置:
undo terminal monitor
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]user-interface console 0
[R1-ui-console0]idle-timeout 0 0
[R1-ui-console0]int g0/0/0
[R1-GigabitEthernet0/0/0]ip address 10.1.1.1 24
[R1-GigabitEthernet0/0/0]undo shutdown
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]qu
[R1]int LoopBack 0
[R1-LoopBack0]ip address 1.1.1.1 32
[R1-LoopBack0]qu
[R1]ip route-static 10.1.2.0 24 10.1.1.2
[R1]ip route-static 3.3.3.3 32 10.1.1.2
[R1]qu
save
R2配置:
undo terminal monitor
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]user-interface console 0
[R2-ui-console0]idle-timeout 0 0
[R2-ui-console0]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 10.1.1.2 24
[R2-GigabitEthernet0/0/0]undo shut
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 10.1.2.1 24
[R2-GigabitEthernet0/0/1]undo shut
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R2-GigabitEthernet0/0/1]qu
[R2]ip route-static 1.1.1.1 32 10.1.1.1
[R2]ip route-static 3.3.3.3 32 10.1.2.2
R3配置:
undo terminal monitor
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R3
[R3]int LoopBack 0
[R3-LoopBack0]ip address 3.3.3.3 32
[R3-LoopBack0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip address 10.1.2.2 24
[R3-GigabitEthernet0/0/1]undo shut
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R3-GigabitEthernet0/0/1]qu
[R3]ip route-static 10.1.1.0 24 10.1.2.1
[R3]ip route-static 1.1.1.1 32 10.1.2.1
[R3]qu
save
测试:
二、默认路由
默认路由:是静态路由的一种特殊形式,它属于静态路由中的一种,使用他的条件是,只能在末梢网络中使用。
默认路由——匹配的是所有网段
默认路由会大大简化路由器的配置,减轻管理员的工作负担,提高网络性能。
实验:
R1配置:
undo terminal monitor
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]user-interface console 0
[R1-ui-console0]idle-timeout 0 0
[R1-ui-console0]quit
[R1]ip route-static 0.0.0.0 0.0.0.0 10.1.1.2
R2配置保持不变
R3配置:
undo terminal monitor
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R3
[R3]user-interface console 0
[R3-ui-console0]idle-timeout 0 0
[R3]ip route-static 0.0.0.0 0.0.0.0 10.1.2.1
测试:
三、浮动路由
浮动路由:指配置两条静态路由,默认选择链路质量最优的作为主路径,当主路径发生故障时,有带宽较小的备份路由顶替,保持网络的不中断。
路由协议的优先级:
| 路由协议 | 优先级 |
|---|---|
| DIRECT | 0 |
| OSPF | 10 |
| IS-IS | 15 |
| STATI | 60 |
| RIP | 100 |
| OSPF ASE | 150 |
| OSPF NSSA | 150 |
| IBGP | 256 |
| EBGP | 256 |
实验:
R1配置:
[R1]int e0/0/0
[R1-Ethernet0/0/0]ip add
[R1-Ethernet0/0/0]ip address 10.1.3.1 24
[R1-Ethernet0/0/0]undo shutdown
Info: Interface Ethernet0/0/0 is not shutdown.
[R1-Ethernet0/0/0]qu
[R1]ip route-static 0.0.0.0 0.0.0.0 10.1.3.2 preference 61 //比静态路由优先级大一个
R2配置:
[R2]int e0/0/0
[R2-Ethernet0/0/0]ip address 10.1.3.2 24
[R2-Ethernet0/0/0]undo shutdown
Info: Interface Ethernet0/0/0 is not shutdown.
[R2-Ethernet0/0/0]qu
R2]ip route-static 1.1.1.1 32 10.1.3.1 preference 61
查看:
使用命令查看路由表
测试:
先关闭R1路由器上的GE0/0/0接口