目的:三路由器实现全网互通
拓扑:
实现192.168.1.1与 192.168.4.1 互通
1. 配置pc1 ip 地址 192.168.1.1
2. 配置S1地址及网关
S1(config-if)#ip address 192.168.1.100 255.255.255.0
S1(config-if)#no shutdown
S1(config)#ip default-gateway 192.168.1.254
3. 配置路由 R3 0/0地址 192.168.1.254/24 配置0/1 地址 192.168.2.1/24
R3(config)#interface fastEthernet 0/0
R3(config-if)#ip address 192.168.1.254 255.255.255.0
R3(config-if)#no shutdown
R3(config)#interface fastEthernet 0/1
R3(config-if)#ip address 192.168.2.1 255.255.255.0
R3(config-if)#no shutdown
4. 设置静态路由
Router(config)#ip route 192.168.3.0 255.255.255.0192.168.2.2
Router(config)#ip route 192.168.4.0 255.255.255.0192.168.2.2
4.设置R1路由信息及静态路由
R1(config)#interface fastEthernet 0/1
R1(config-if)#ip address 192.168.2.2 255.255.255.0
R1(config-if)#exit
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 192.168.3.2 255.255.255.0
静态路由
R1(config)#ip route 192.168.1.0 255.255.255.0192.168.2.1
R1(config)#ip route 192.168.4.0 255.255.255.0192.168.3.1
5.设置R2地址及静态路由
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 192.168.3.1 255.255.255.0
R2(config-if)#no shutdown
R2(config)#interface fastEthernet 0/1
R2(config-if)#ip address 192.168.4.254 255.255.255.0
R2(config-if)#no shutdown
静态路由
R2(config)#ip route 192.168.2.0 255.255.255.0192.168.3.2
R2(config)#ip route 192.168.1.0 255.255.255.0192.168.3.2
6.设置S2地址及默认网关
Switch(config)#interface vlan 1
Switch(config-if)#ip address 192.168.4.100255.255.255.0
Switch(config-if)#no shutdown
Switch(config)#ip default-gateway 192.168.4.254
Switch(config-if)#no shutdown
转载于:https://blog.51cto.com/315805980/1555292