《配置三层交换机.docx》由会员分享,可在线阅读,更多相关《配置三层交换机.docx(9页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、三层交换机配置实例 2008-02-09 00:53:09标签:交换 交换机 配置 实例 推送到技术圈 今天我配置的实验有两大快,一是三层交换,二是单臂路由,三层交换主要来替换单臂路由,为什么我还要配呢,一些小公司,上网的人多,但又不想买三层设备,所以就要用到单臂路由. 这个拓扑图主要实现以下功能: 配置VTP域,减轻管理员工作量,配置PVST,避免环路的产生,做好DHCP中继,使不同vlan中PC能够动态获取IP地址,设置以太网通道,增加数据流量,三层交换机配置路由功能,使不同vlan 之间的通信, 大体配置和思路如下:1,IP规划:3550-1 vlan10 :192.168.1.1 25
2、5.255.255.0 3550-1 vlan20 :192.168.2.1 255.255.255.0 3550-1 vlan30 :192.168.3.1 255.255.255.0 3550-1 vlan40 :192.168.4.1 255.255.255.03550-2 vlan10 :192.168.1.2 255.255.255.0 3550-2 vlan20 :192.168.2.2 255.255.255.03550-2 vlan30 :192.168.3.2 255.255.255.03550-2 vlan40 :192.168.4.2 255.255.255.0 3550
3、-2 f0/7 192.168.5.1 255.255.255.0R1 f0/1 :192.168.5.2 255.255.255.0 R1 f0/2 :192.168.6.1 255.255.255.0 R2 f0/1 :192.168.6.2 255.255.255.0 R2 f0/2.1 :192.168.7.1 255.255.255.0 R2 f0/2.2 :192.168.8.1 255.255.255.0DHCP :192.168.1.3 255.255.255.0 192.168.1.1 PC1:192.168.2.3 255.255.255.0 192.168.2.1 PC2
4、:192.168.3.3 255.255.255.0 192.168.3.2PC3:192.168.4.3 255.255.255.0 192.168.4.2 PC4:192.168.7.2 255.255.255.0 192.168.7.1PC5:192.168.8.2 255.255.255.0 192.168.8.12,线缆规划:SW1的f0/1端口连接3550-1 f0/1端口f0/2端口连接3550-2 f0/1端口f0/3端口连接DHCP服务器,属于Vlan 1;SW2的f0/1端口连接3550-1 f0/2端口f0/2端口连接3550-2 f0/2端口f0/3端口连接PC1机,属
5、于Vlan 2;SW3的f0/1端口连接3550-1 f0/3端口f0/2端口连接3550-2 f0/3端口f0/3端口连接PC2机,属于Vlan 3;SW4的f0/1端口连接3550-1 f0/4端口f0/2端口连接3550-2 f0/4端口f0/3端口连接PC3机,属于Vlan 4;3550-1 f0/5 端口连接3550-2 f0/5 3550-1 f0/6 端口连接3550-2 f0/63550-2 f0/7 端口连接 R1 f0/1 R1 f0/2端口连接 R2 f0/1 R2 f0/2端口连接 SW5 f0/24SW5 f0/1 端口连接 PC4 SW5 f0/2 端口连接 PC5
6、3,VTP配置:VTP 的域名 VTP 的密码 VTP 的修剪 配置两台3550为VTP server 模式 配置其他交换机为client模式4,STP 配置:设置3550-1是Vlan1-Vlan2 的生成树根网桥 设置3550-2是Vlan3-Vlan4 的生成树根网桥在接入层交换机上配置速端口和上行速链路5,三层交换机的配置:在其中一台交换机上划分Vlan; 在三层交换机上配置各个Vlan的IP地址,配置两台三层交换机之间的以太网通道(EthernetChannel)配置3550-2交换机的路由接口 在三层交换机上配置RIP协议6,路由器的配置配置路由器接口的IP地址 配置路由器的RIP
7、协议在R2上配置单臂路由 7,配置SW5 在SW5上划分Vlan 将PC4;PC5添加进去好了,规划完了,下面我们开始命令行配置吧:3550-1的配置如下:配置交换机的三层路由功能3550-1#config terminal3550-1#ip routing / 启用三层路由功能配置VTP域:3550-1enable3550-1#config terminal3550-1#vtp domain benet / 创建VTP域3550-1#vtp password 123 / VTP域的密码3550-1#vtp pruning / 起用VTP修剪3550-1#vtp mode server / 配
8、置交换机为vtp server模式3550-1#exit / 返回下一级配置VLAN3550-1#vlan database / 进入vlan数据库3550-1#vlan 10 name vlan10 / 创建vlan 10 3550-1#vlan 20 name vlan20 / 创建vlan 20 3550-1#vlan 30 name vlan30 / 创建vlan 303550-1#vlan 40 name vlan40 / 创建vlan 403550-1#exit配置vlan IP地址:3550-1#config terminal 3550-1#interface vlan10 35
9、50-1#ip address 192.168.1.1 255.255.255.0 3550-1#exit3550-1#interface vlan203550-1#ip address 192.168.2.1 255.255.255.03550-1#exit3550-1#interface vlan303550-1#ip address 192.168.3.1 255.255.255.03550-1#exit3550-1#interface vlan403550-1#ip address 192.168.4.1 255.255.255.03550-1#exit配置RIP协议:3550-1#c
10、onfig terminal3550-1#ip routing3550-1#router rip3550-1#network 192.168.1.03550-1#network 192.168.2.03550-1#network 192.168.3.03550-1#network 192.168.4.0配置PVST:3550-1#spanning-tree vlan vlan10 root primary /配置vlan10的根网桥3550-1#spanning-tree vlan vlan20 root primary /配置vlan20的根网桥3550-1#spanning-tree vl
11、an vlan30 root secondary3550-1#spanning-tree vlan vlan40 root secondary3550-1#interface range fastEthernet 0/5 6 /进入一定端口 3550-1#channel-group 1 mode on /配置以太网通道配置DHCP中继:3550-1#interface vlan vlan103550-1#ip helper-address 192.168.1.33550-1#interface vlan vlan203550-1#ip helper-address 192.168.1.3355
12、0-2的配置如下:配置交换机的三层路由功能3550-2#config terminal 3550-2#ip routing 配置VTP域:3550-2enable3550-2#config terminal 3550-2#vtp domain benet 3550-2#vtp password 123 3550-2#vtp pruning 3550-2#vtp mode server 3550-2#exit 配置vlan IP地址:3550-2#config terminal 3550-2#interface vlan10 3550-2#ip address 192.168.1.2 255.2
13、55.255.0 3550-2#exit3550-2#interface vlan203550-2#ip address 192.168.2.2 255.255.255.03550-2#exit3550-2#interface vlan303550-2#ip address 192.168.3.2 255.255.255.03550-2#exit3550-2#interface vlan403550-2#ip address 192.168.4.2 255.255.255.03550-2#interface f0/73550-2#no switchport3550-2#ip address 1
14、92.168.5.1 255.255.255.03550-2#no shotdown3550-2#exit配置RIP协议:3550-2#config terminal3550-2#router rip3550-1#network 192.168.1.03550-1#network 192.168.2.03550-1#network 192.168.3.03550-1#network 192.168.4.03550-1#network 192.168.5.0配置PVST:3550-2#spanning-tree vlan vlan30 root primary 3550-2#spanning-t
15、ree vlan vlan40 root primary3550-2#spanning-tree vlan vlan10 root secondary3550-2#spanning-tree vlan vlan20 root secondary 3550-2#interface range fastEthernet 0/5 6 3550-2#channel-group 1 mode on 配置DHCP中继:3550-2#interface vlan vlan303550-2#ip helper-address 192.168.1.33550-2#interface vlan vlan40355
16、0-2#ip helper-address 192.168.1.3配置交换机:Sw1#config terminalSw1#vtp domain benetSw1#vtp password 123Sw1#vtp mode clientSw1#vtp pruningSw1#interface f0/1Sw1#switchport mode trunkSw1#exitSw1#interface f0/2Sw1#switchport mode trunkSw1#exitSw1#interface f0/3Sw1#switchport access vlan 10Sw1#spanning-tree p
17、ortfast /端口速链路Sw1#exitSw1#spanning-tree uplinkfast /上行速端口Sw2#config terminalSw2#vtp domain benetSw2#vtp password 123Sw2#vtp mode clientSw1#vtp pruningSw2#interface f0/1Sw2#switchport mode trunkSw2#exitSw2#interface f0/2Sw2#switchport mode trunkSw2#exitSw2#interface f0/3Sw2#switchport access vlan 20S
18、w2#spanning-tree portfast Sw2#exitSw2#spanning-tree uplinkfast Sw3#config terminalSw3#vtp domain benetSw3#vtp password 123Sw3#vtp mode clientSw1#vtp pruningSw3#interface f0/1Sw3#switchport mode trunkSw3#exitSw3#interface f0/2Sw3#switchport mode trunkSw3#exitSw3#interface f0/3Sw3#switchport access vl
19、an 30Sw3#spanning-tree portfastSw3#exitSw3#spanning-tree uplinkfast Sw4#config terminalSw4#vtp domain benetSw4#vtp password 123Sw4#vtp mode clientSw1#vtp pruningSw4#interface f0/1Sw4#switchport mode trunkSw4#exitSw4#interface f0/2Sw4#switchport mode trunkSw4#exitSw4#interface f0/3Sw4#switchport acce
20、ss vlan 40Sw4#spanning-tree portfast Sw4#exitSw4#spanning-tree uplinkfast Sw5 enableSw5#config terminalSw5#interface f0/24Sw5#switchport mode trunkSw5#endSw5#vlan databaseSw5#vlan 10 valn10Sw5#vlan 20 valn20Sw5#exitSw5#config terminalSw5#interface f0/1Sw5#switchport access vlan10Sw5#interface f0/2Sw
21、5#switchport access vlan20路由器的配置:R1enableR1#config terminalR1#interface f0/1R1#ip address 192.168.5.2 255.255.255.0R1#no shotdownR1#interface f0/2R1#ip address 192.168.6.1 255.255.255.0R1#no shotdownR1#exitR1#router ripR1#network 192.168.5.0R1#router ripR1#network 192.168.6.0R2enableR2#config termin
22、alR2#interface f0/1R2#ip address 192.168.6.2 255.255.255.0R1#no shotdownR1#exitR1#interface f0/2R1#no shotdownR1#exitR2#interface f0/2.1R2#ip address 192.168.7.1 255.255.255.0R2#encapsolution dot1 10R2#interface f0/2.2R2#ip address 192.168.8.1 255.255.255.0R2#encapsolution dot1 20R2#exitR2#router ri
23、pR2#network 192.168.6.0R2#router ripR2#network 192.168.7.0R2#router ripR2#network 192.168.8.0PC4: IP: 192.168.7.2 mask:255.255.255.0 default-gateway:192.168.7.1PC5: IP: 192.168.8.2 mask:255.255.255.0 default-gateway:192.168.8.1实验验收:在PC1/PC2/PC3/上动态获取DHCP服务器的地址资源在PC4/PC5上ping PC1/PC2/PC3/和DHCP服务器排错事使用的命令:show run /查看所有的配置show cdp entry * /查看cisco端口连接的设备show ip router /查看本地路由表show ip interface brief /查看端口的详细信息show vlan brief /查看vlan的详细信息show vtp status /查看VTP配置信息show ip cef /查看FIB表show adjacency detail /查看邻接关系表
限制150内