路由器
- 原理:
- 规划网段(路由是隔离网段的)
- 思科路由器
- 静态路由协议缺点:
- 1、配置麻烦
- 2、在下一跳找不准
- 静态路由协议优点:
- 不占用CPU和内存资源
- 静态路由配置
- 拓扑图:
- 1、配置每个节点的IP地址
- R0:
- Router(config)#interfacef0/0
- Router(config-if)#noshutdown
- Router(config-if)#ipaddress 192.168.10.1 255.255.255.0
- Router(config-if)#exit
- Router(config)#interfacef0/1
- Router(config-if)#ipaddress 192.168.20.1 255.255.255.0
- Router(config-if)#noshutdown
- R1:
- Router(config)#interfacef0/0
- Router(config-if)#noshutdown
- Router(config-if)#ipaddress 192.168.20.2 255.255.255.0
- Router(config-if)#exit
- Router(config)#interfacef0/1
- Router(config-if)#noshutdown
- Router(config-if)#ipaddress 192.168.30.1 255.255.255.0
- Router(config-if)#exit
- R2:
- Router(config)#interfacef0/0
- Router(config-if)#noshut
- Router(config-if)#ipaddress 192.168.30.2 255.255.255.0
- Router(config-if)#exit
- Router(config)#interfacef0/1
- Router(config-if)#noshutdown
- Router(config-if)#ipaddress 192.168.40.1 255.255.255.0
- R0:
- 增加下一跳地址
- R0:
- ip route 192.168.30.0255.255.255.0 192.168.20.2
- ip route 192.168.40.0 255.255.255.0 192.168.20.2
- R1:
- ip route 192.168.10.0255.255.255.0 192.168.20.1
- ip route 192.168.40.0 255.255.255.0 192.168.30.2
- R3:
- ip route 192.168.10.0255.255.255.0 192.168.30.1
- ip route 192.168.20.0 255.255.255.0 192.168.30.1
- R0:
- 拓扑图:
- 动态路由协议(RIP)
- 1、配置每个节点IP地址
- 和静态路由第一步一致
- 2添加rip(查看自已的路由表,然后把自已带C的网段添加rip就可以了)
- R0:
- Router#show ip route
- C 192.168.10.0/24 isdirectly connected, FastEthernet0/0
- C 192.168.20.0/24 isdirectly connected, FastEthernet0/1
- Router#conf t
- Router(config)#routerrip
- Router(config-router)#network192.168.10.0
- Router(config-router)#network192.168.20.0
- R1:
- Router#show ip route
- C 192.168.20.0/24 isdirectly connected, FastEthernet0/0
- C 192.168.30.0/24 isdirectly connected, FastEthernet0/1
- Router#conf t
- Router(config)#routerrip
- Router(config-router)#network192.168.20.0
- Router(config-router)#network192.168.30.0
- R2:
- Router#show ip route
- C 192.168.30.0/24 isdirectly connected, FastEthernet0/0
- C 192.168.40.0/24 isdirectly connected, FastEthernet0/1
- Router#conf t
- Router(config)#routerrip
- Router(config-router)#network192.168.30.0
- Router(config-router)#network192.168.40.0
- R0:
- 1、配置每个节点IP地址
- 静态路由协议缺点:
- 不管是静路由协议还是动态路由协议最终的目的都是为了让每台三层设备都有所有的网段
- 华为路由器
- 拓扑图:
- 动态路由和静态路由配置:
- 配置节点IP
- R2:
- [Huawei]interface e0/0/0
- [Huawei-Ethernet0/0/0]undo shutdown
- [Huawei-Ethernet0/0/0]ip address 10.1.1.2 255.255.255.0
- [Huawei-Ethernet0/0/0]quit
- [Huawei]interface e0/0/1
- [Huawei-Ethernet0/0/1]undo shutdown
- [Huawei-Ethernet0/0/1]ip address 192.168.10.1 255.255.255.0
- R3:
- [Huawei]interface e0/0/1
- [Huawei-Ethernet0/0/1]undo shutdown
- [Huawei-Ethernet0/0/1]ip address 10.1.2.2 255.255.255.0
- [Huawei-Ethernet0/0/1]quit
- [Huawei]interface e0/0/0
- [Huawei-Ethernet0/0/0]undo shutdown
- [Huawei-Ethernet0/0/0]ip address 192.168.20.2 255.255.255.0
- R1:
- [Huawei]interface e0/0/0
- [Huawei-Ethernet0/0/0]undo shutdown
- [Huawei-Ethernet0/0/0]ip address 192.168.10.2 255.255.255.0
- [Huawei-Ethernet0/0/0]quit
- [Huawei]interface e0/0/1
- [Huawei-Ethernet0/0/1]undo shutdown
- [Huawei-Ethernet0/0/1]ip address 192.168.20.1 255.255.255.0
- [Huawei-Ethernet0/0/1]quit
- R2:
- 添加静态路由
- R1:
- ip route-static 10.1.1.0 255.255.255.0 192.168.10.1
- ip route-static 10.1.2.0 255.255.255.0 192.168.20.2
- R2:
- ip route-static192.168.20.0 255.255.255.0 192.168.10.2
- ip route-static 10.1.2.0 255.255.255.0 192.168.10.2
- R3:
- ip route-static192.168.10.0 255.255.255.0 192.168.20.1
- ip route-static 10.1.1.0 255.255.255.0 192.168.20.1
- R1:
- 添加RIP(动态路由协议)
- R1:
- [Huawei]rip 1
- [Huawei-rip-1]network192.168.10.0
- [Huawei-rip-1]network192.168.20.0
- R2:
- [Huawei]rip 1
- [Huawei-rip-1]network 192.168.10.0
- [Huawei-rip-1]network 10.1.1.0
- R3:
- [Huawei]rip 1
- [Huawei-rip-1]network192.168.20.0
- [Huawei-rip-1]network 10.1.2.0
- R1:
- 配置节点IP
- 拓扑图: