三层交换机实现和单臂路由同样的效果

前面我已经做过了路由器实现三层交换的实验,今天用三层交换机实现和单臂路由同样的效果

实验环境PT 5.3

拓扑:

 

 

三层交换机实现和单臂路由同样的效果_第1张图片

首先在交换机sw1上把VLAN创建好,把相应的端口所属VLAN分配好,最好把sw1 的fa0/1接口改成trunk模式

配置如下

no ip domain-lookup
!
!
interface FastEthernet0/1
 switchport mode trunk
!
interface FastEthernet1/1
 switchport access vlan 10
 switchport mode access
!
interface FastEthernet2/1
 switchport access vlan 20
 switchport mode access
!
interface FastEthernet3/1
!
interface FastEthernet4/1
!
interface FastEthernet5/1
!

下面该配置三层交换机C1了

首先和sw1一样创建VLAN ,注意这里一定要创建VLAN,不然下面的操作在路由表中是没有显示的,而且VLAN号

和刚才创建的一样。          然后将fa0/1的模式改成trunk模式。    最后给VLAN 分配IP地址,这也是不同于路由器的

主要一步。配置如下:

!
interface FastEthernet0/1
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
 no ip address
 shutdown
!
interface Vlan10
 ip address 192.168.1.1 255.255.255.0
!
interface Vlan20
 ip address 192.168.2.1 255.255.255.0
!

上面的配置好了还可以查看路由表

Switch#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, Vlan10
C    192.168.2.0/24 is directly connected, Vlan20

 

 

 

 

本文出自 “学习中” 博客,谢绝转载!

你可能感兴趣的:(职场,休闲,三层交换)