拓扑图二
拓扑图一
1、首先分别配置三台pc机IP地址、子网掩码以及默认网关
2、分别在三台三层交换机中划分vlan并将相关端口划入vlan且设置管理IP地址
详细配置命令如下(以Switch1为例)
Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#host SW1
SW1(config)#ip routing//请用交换机路由功能(三层交换机)
SW1(config)#vlan 10
SW1(config-vlan)#name v10
SW1(config-vlan)#vlan 20
SW1(config-vlan)#name 20
SW1(config-vlan)#ex
SW1(config)#int f0/2
SW1(config-if)#swi mode acc
SW1(config-if)#swiaccvlan 10
SW1(config-if)#int f0/1
SW1(config-if)#swi mode acc
SW1(config-if)#swiaccvlan20
SW1(config-if)#ex
SW1(config)#intvlan 10
SW1(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
SW1(config-if)#ip add 192.168.1.1 255.255.255.0
SW1(config-if)#no shut
S1(config-if)#ex
SW1(config)#intvlan20
SW1(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
SW1(config-if)#ip add 192.168.2.1 255.255.255.0
SW1(config-if)#no shut
S1(config-if)#ex
3、分别设置两台路由器端口IP
配置如下:(以Router0为例)
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R1
R1(config)#int f0/0
R1(config-if)#ip add 192.168.2.2 255.255.255.0
R1(config-if)#no shut
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#int s1/0
R1(config-if)#ip add 192.168.3.1 255.255.255.0
R1(config-if)#no shut
%LINK-5-CHANGED: Interface Serial1/0, changed state to down
R1(config-if)#ex
4、分别在三台三层交换机和两台路由器上运行ospf
路由器:
R1(config)#route ospf 1
R1(config-router)#net 192.168.2.0 0.0.0.255 a 0
R1(config-router)#net 192.168.3.0 0.0.0.255 a 0
R1(config-router)#ex
三层交换机:
S1(config)#route ospf 1
S1(config-router)#net 192.168.1.0 0.0.0.255 a 0
S1(config-router)#net 192.168.2.0 0.0.0.255 a 0
S1(config-router)#ex
5、检验是否能实现全网互通:
S1(config)#do ping 192.168.7.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.7.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/11 ms
S1(config)#do ping 192.168.5.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.5.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/6/13 ms
拓扑图二:
1、启用三层交换机路由功能,分别在三台三层交换机中划分vlan并将相关端口划入vlan且设置管理IP地址,在设置loopback环回口。
配置如下:(以Switch4为例)
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#ip routing
Switch(config)#vlan 20
Switch(config-vlan)#name v20
Switch(config-vlan)#ex
Switch(config)#int f0/1
Switch(config-if)#swimoacc
Switch(config-if)#swiaccvlan 20
Switch(config-if)#ex
Switch(config)#intvlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#ip add 192.168.6.2 255.255.255.0
Switch(config-if)#no shut
Switch(config-if)#ex
Switch(config)#int lo 1
Switch(config-if)#
%LINK-5-CHANGED: Interface Loopback1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
Switch(config-if)#ip add 192.168.7.1 255.255.255.0
Switch(config-if)#ex
2、分别设置两台路由器端口IP(与拓扑图一配置相同)
3、分别在三台三层交换机和两台路由器上运行ospf(与拓扑图一配置相同)
4、测试三个环回口是否能相互ping通
S1(config)#do ping 192.168.7.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.7.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/11 ms
S1(config)#do ping 192.168.5.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.5.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/6/13 ms下载本文