实验时间 2009年05月27日 13时~ 15时
实验人 子旭
实验名称 三层交换
实验目的
1、 VLAN之间的通信通过3层交换机来实现
2、 路由器为4个VLAN来分配IP地址
3、 PC1和PC2分别属于2个部门,能够得到IP地址
4、 PC1和PC2之间可以ping通。
实验拓扑
实验步骤 RA配置:
Router>en
Router#configure terminal
Router(config)#ho R1
R1(config)#line console 0
R1(config-line)#no exec-timeout
R1(config-line)#logging synchronous
R1(config-line)#exit
R1(config)#interface f0/0
R1(config-if)#ip address 1.1.1.2 255.0.0.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.1
R1(config)#ip dhcp pool 2
R1(dhcp-config)#network 192.168.2.0 /24
R1(dhcp-config)#default-router 192.168.2.1
R1(dhcp-config)#lease 7
R1(dhcp-config)#exit
R1(config)#ip dhcp pool 3
R1(dhcp-config)#default-router 192.168.3.1 /24
R1(dhcp-config)#default-router 192.168.3.1
R1(dhcp-config)#lease 7
R1(dhcp-config)#exit
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
|
S3(三层交换机)配置:
Router>enable
Router#config t
Router(config)#ho S3
S3(config)#no ip domain lookup
S3(config)#line console 0
S3(config-line)#no exec-timeout
S3(config-line)#logging synchronous
S3(config-line)#end
S3#vlan d
S3(vlan)#vlan 2
S3(vlan)#vlan 3
S3(vlan)#exit
S3(config)#inter f0/0
S3(config-if)#no switchport
S3(config-if)#ip address 1.1.1.1 255.0.0.0
S3(config-if)#no shut
S3(config-if)#exit
S3(config)#inter rang f0/1 - 2
S3(config-if)#sw mo tr
S3(config-if)#exit
S3(config)#ip routing
S3(config)#interface vlan 2
S3(config-if)#ip address 192.168.2.1 255.255.255.0
S3(config-if)#no shut
S3(config-if)#exit
S3(config)#interface vlan 3
S3(config-if)#ip address 192.168.3.1 255.255.255.0
S3(config-if)#no shut
S3(config-if)#exit
S3(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2
S3(config)#interface vlan 2
S3(config-if)#ip helper-address 1.1.1.2
S3(config-if)#exit
S3(config)#interface vlan 3
S3(config-if)#ip helper-address 1.1.1.2
S3(config-if)#exit
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
|
SA配置:
Router>en
Router#config t
Router(config)#ho Sa
Sa(config)#
Sa(config)#no ip domain lookup
Sa(config)#no ip routing
Sa(config)#line console 0
Sa(config-line)#no exec-timeout
Sa(config-line)#logg synchronous
Sa(config-line)#end
Sa#vlan d
Sa(vlan)#vlan 2
Sa(vlan)#exit
Sa#config t
Sa(config)#interface f0/0
Sa(config-if)#switchport access vlan 2
Sa(config-if)#exit
S3(config)#inter rang f0/1
S3(config-if)#sw mo tr
S3(config-if)#exit
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
|
SB配置:
Sb#config t
Sb(config)#no ip domain lookup
Sb(config)#no ip routing
Sb(config)#line console 0
Sb(config-line)#no exec-t
Sb(config-line)#logg synchronous
Sb(config-line)#end
Sb#vlan d
Sb(vlan)#vlan 3
Sb(vlan)#exit
Sb#config t
Sb(config)#interface f0/0
Sb(config-if)#switchport access vlan 3
Sb(config-if)#exit
S3(config)#inter rang f0/2
S3(config-if)#sw mo tr
S3(config-if)#exit
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
|
实验结论
二层设备在不同VLAN种通过三层交换做路由转发,由此能够让不同VLAN通信,同时也实现DHCP功能。
【编辑推荐】
- 高端交换机市场 思科同样面临激烈竞争
- 如何选择合适位置存放交换机配置文件
- 五个你从未用过的路由器与交换机功能