R2的配置:
Router>
Router>en
Router#conf t
Router(config)#int s2/0
Router(config-if)#ip address 192.168.20.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int f0/0
Router(config-if)#ip address 192.168.10.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#hostname R2
R2(config)#do wr
R2(config)#router ospf 10
R2(config-router)#network 192.168.10.0 0.0.0.255
R2(config-router)#network 192.168.10.0 0.0.0.255 area 0
R2(config-router)#network 192.168.20.0 0.0.0.255 area 0
R2(config-router)#exit
R2(config)#do wr
R1的配置:
Router>en
Router#conf t
Router(config)#int f0/0
Router(config-if)#ip address 192.168.30.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
R!(config)#hostname R1
R1(config)#int s2/0
R1(config-if)#clock rate 64000
R1(config-if)#ip address 192.168.20.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#router ospf 10
R1(config-router)#network 192.168.20.0 0.0.0.255 are
R1(config-router)#network 192.168.20.0 0.0.0.255 area 0
R1(config-router)#network 192.168.30.0 0.0.0.255 area 0
R1(config-router)#exit
R1(config)#do wr
SW3的配置:
Switch>en
Switch#conf t
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#exit
Switch(config)#do wr
Building configuration...
[OK]
Switch(config)#ip routing
Switch(config)#int vlan 10
Switch(config-if)#ip address 192.168.50.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#int vlan 20
Switch(config-if)#ip address 192.168.40.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#int f0/1
Switch(config-if)#no switchport
Switch(config-if)#ip address 192.168.30.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#hostname SW3
SW3(config)#do wr
SW3(config)#router ospf 10
SW3(config-router)#network 192.168.30.0 0.0.0.255 Area 0
SW3(config-router)#network 192.168.40.0 0.0.0.255 Area 0
SW3(config-router)#network 192.168.50.0 0.0.0.255 Area 0
SW3(config-router)#exit
SW3(config)#do wr
SW3(config)#exit
SW1的配置:
Switch>en
Switch#conf t
Switch(config)#hostname R1
R1(config)#hostname SW1
SW1(config)#vlan 10
SW1(config-vlan)#vlan 20
SW1(config-vlan)#exit
SW1(config)#int f0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10
SW1(config-if)#exit
SW1(config)#int f0/3
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 20
SW1(config-if)#exit
SW1(config)#int f0/1
SW1(config-if)#switchport mode trunk
SW1(config-if)#exit
SW1(config)#do wr
SW2的配置:
Switch>en
Switch#conf t
Switch(config)#hostname SW2
SW2(config)#int f0/2
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 20
SW2(config-if)#exit
SW2(config)#vlan 10
SW2(config-vlan)#vlan 20
SW2(config-vlan)#exit
SW2(config)#int f0/2
SW2(config-if)#switchport mode access
W2(config-if)#switchport access vlan 20
SW2(config-if)#exit
SW2(config)#int f0/3
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 10
SW2(config-if)#exit
SW2(config)#int f0/1
SW2(config-if)#switchport mode trunk
SW2(config-if)#exit
SW2(config)#end
SW2#wr
转载于:https://blog.51cto.com/justlhl/1192110