对应的思科实验配置方法:路由和交换基础实验(12)——静态路由(浮动+默认)+单臂路由
使用RIPV1,使得五台pc互通。
1.交换机1:
Switch>enable
Switch#configure
Switch(config)#vlan 10
Switch(config-vlan)#int fastEthernet0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#int fastEthernet0/2
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#int fastEthernet0/3
Switch(config-if)#switchport mode trunk
Switch(config-if)#end
2交换机2:
Switch>enable
Switch#configure
Switch(config)#vlan 20
Switch(config-vlan)#int fastEthernet0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
Switch(config-if)#int fastEthernet0/2
Switch(config-if)#switchport mode trunk
Switch(config-if)#end
3.交换机3:
Switch>enable
Switch#configure
Switch(config)#vlan 30
Switch(config-vlan)#vlan 40
Switch(config-vlan)#int fastEthernet0/2
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 30
Switch(config-if)#int fastEthernet0/3
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 40
Switch(config-if)#int fastEthernet0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#end
4.三层交换机:
Switch>enable
Switch#configure
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#int fastEthernet0/1
Switch(config-if)#switchport trunk encapsulation dot1Q
Switch(config-if)#switchport mode trunk
Switch(config-if)#int fastEthernet0/2
Switch(config-if)#switchport trunk encapsulation dot1Q
Switch(config-if)#switchport mode trunk
Switch(config-if)#int vlan 10
Switch(config-if)#ip address 192.168.10.254 255.255.255.0
Switch(config-if)#int vlan 20
Switch(config-if)#ip address 192.168.20.254 255.255.255.0
Switch(config-if)#ip routing
Switch(config-if)#int fastEthernet0/3
Switch(config-if)#no switchport
Switch(config-if)#ip address 10.1.12.1 255.255.255.0
Switch(config)#router rip
Switch(config-router)#network 192.168.10.0
Switch(config-router)#network 192.168.20.0
Switch(config-router)#network 10.1.12.0
Switch(config-router)#end
5.路由器0:
Router>ena
Router#configure
Router(config)#int fastEthernet0/0
Router(config-if)#ip address 10.1.12.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int fastEthernet0/1
Router(config-if)#ip address 10.1.23.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int s0/1/0
Router(config-if)#ip address 3.3.3.1 255.255.255.0
Router(config-if)#no shutdown
Router(config)#router rip
Router(config-router)#network 10.1.12.0
Router(config-router)#network 10.1.23.0
Router(config-router)#network 3.3.3.0
6.路由器1:
Router>enable
Router#configure
Router(config)#int fastEthernet0/0
Router(config-if)#ip address 10.1.23.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int fastEthernet0/1
Router(config-if)#ip address 10.1.34.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int s0/1/0
Router(config-if)#ip address 3.3.3.2 255.255.255.0
Router(config-if)#no shutdown
Router(config)#router rip
Router(config-router)#network 10.1.23.0
Router(config-router)#network 10.1.34.0
Router(config-router)#network 3.3.3.0
Router(config)#end
7.路由器2:
Router>enable
Router#configure
Router(config)#int fastEthernet0/0
Router(config-if)#ip address 10.1.34.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int fastEthernet0/1
Router(config-if)#no shutdown
Router(config-if)#int fastEthernet0/1.30
Router(config-subif)#encapsulation dot1Q 30
Router(config-subif)#ip address 192.168.30.254 255.255.255.0
Router(config-subif)#int fastEthernet0/1.40
Router(config-subif)#encapsulation dot1Q 40
Router(config-subif)#ip address 192.168.40.254 255.255.255.0
Router(config-subif)#no shutdown
Router(config)#router rip
Router(config-router)#network 10.1.34.0
Router(config-router)#network 192.168.30.0
Router(config-router)#network 192.168.40.0
查看每台设备的路由表:
1.三层交换机:
R 3.0.0.0/8 [120/1] via 10.1.12.2, 00:00:21, FastEthernet0/3
10.0.0.0/24 is subnetted, 3 subnets
C 10.1.12.0 is directly connected, FastEthernet0/3
R 10.1.23.0 [120/1] via 10.1.12.2, 00:00:21, FastEthernet0/3
R 10.1.34.0 [120/2] via 10.1.12.2, 00:00:21, FastEthernet0/3
C 192.168.10.0/24 is directly connected, Vlan10
C 192.168.20.0/24 is directly connected, Vlan20
R 192.168.30.0/24 [120/3] via 10.1.12.2, 00:00:21, FastEthernet0/3
R 192.168.40.0/24 [120/3] via 10.1.12.2, 00:00:21, FastEthernet0/3
2.路由器0:
C 3.3.3.0 is directly connected, Serial0/1/0
10.0.0.0/24 is subnetted, 3 subnets
C 10.1.12.0 is directly connected, FastEthernet0/0
C 10.1.23.0 is directly connected, FastEthernet0/1
R 10.1.34.0 [120/1] via 10.1.23.2, 00:00:01, FastEthernet0/1
R 192.168.10.0/24 [120/1] via 10.1.12.1, 00:00:04, FastEthernet0/0
R 192.168.20.0/24 [120/1] via 10.1.12.1, 00:00:04, FastEthernet0/0
R 192.168.30.0/24 [120/2] via 10.1.23.2, 00:00:01, FastEthernet0/1
[120/2] via 3.3.3.2, 00:00:01, Serial0/1/0
R 192.168.40.0/24 [120/2] via 10.1.23.2, 00:00:01, FastEthernet0/1
[120/2] via 3.3.3.2, 00:00:01, Serial0/1/0
3.路由器1:
C 3.3.3.0 is directly connected, Serial0/1/0
10.0.0.0/24 is subnetted, 3 subnets
R 10.1.12.0 [120/1] via 10.1.23.1, 00:00:06, FastEthernet0/0
C 10.1.23.0 is directly connected, FastEthernet0/0
C 10.1.34.0 is directly connected, FastEthernet0/1
R 192.168.10.0/24 [120/2] via 10.1.23.1, 00:00:06, FastEthernet0/0
[120/2] via 3.3.3.1, 00:00:06, Serial0/1/0
R 192.168.20.0/24 [120/2] via 10.1.23.1, 00:00:06, FastEthernet0/0
[120/2] via 3.3.3.1, 00:00:06, Serial0/1/0
R 192.168.30.0/24 [120/1] via 10.1.34.2, 00:00:27, FastEthernet0/1
R 192.168.40.0/24 [120/1] via 10.1.34.2, 00:00:27, FastEthernet0/1
4.路由器2:
R 3.0.0.0/8 [120/1] via 10.1.34.1, 00:00:08, FastEthernet0/0
10.0.0.0/24 is subnetted, 3 subnets
R 10.1.12.0 [120/2] via 10.1.34.1, 00:00:08, FastEthernet0/0
R 10.1.23.0 [120/1] via 10.1.34.1, 00:00:08, FastEthernet0/0
C 10.1.34.0 is directly connected, FastEthernet0/0
R 192.168.10.0/24 [120/3] via 10.1.34.1, 00:00:08, FastEthernet0/0
R 192.168.20.0/24 [120/3] via 10.1.34.1, 00:00:08, FastEthernet0/0
C 192.168.30.0/24 is directly connected, FastEthernet0/1.30
C 192.168.40.0/24 is directly connected, FastEthernet0/1.40