202513734.jpg

无论多少个vlan,以此类推进行配置即可

R1的配置

配置单臂路由

Router>enable

Router#configure t

Router#configure terminal

Router(config)#hostname RA

RA(config)#interface fastEthernet 0/0

RA(config-if)#no ip address

RA(config-if)#no shutdown

RA(config-if)#exit

RA(config)#interface fastEthernet 0/0.1

RA(config-subif)#encapsulation dot1Q 1

RA(config-subif)#ip address 192.168.1.1 255.255.255.0

RA(config)#interface fastEthernet 0/0.2

RA(config-subif)#encapsulation dot1Q 2

RA(config-subif)#ip address 192.168.2.1 255.255.255.0

RA(config)#interface fastEthernet 0/0.3

RA(config-subif)#encapsulation dot1Q 3

RA(config-subif)#ip address 192.168.3.1 255.255.255.0

存在多个vlan时类推

SA的配置

配置TRUNK(不变)

Switch>enable

Switch#configure terminal

Switch(config)#hostname SA

SA(config)#interface range fasterthernet 0/1-3

SA(config-if-range)#switchport mode trunk

SA(config-if-range)#exit

配置VTP(不变。可以修改名字和密码)

SA(config)#vtp mode server

SA(config)#vtp domain xinbin

SA(config)#vtp password xinbin

配置VLAN (存在多个vlan时自己添加)

SA(config)#vlan 2

SA(config-vlan)#exit

SA(config)#vlan 3

SA(config-vlan)#exit

SB的配置

配置TRUNK(不变)

Switch>enable

Switch#configure terminal

Switch(config)#hostname SB

SB(config)#interface range fasterthernet 0/1

SB(config-if-range)#switchport mode trunk

配置VTP(不变,可以修改名字和密码

SA(config)#vtp mode client

SA(config)#vtp domain xinbin

SA(config)#vtp password xinbin

配置VLAN(按情况划分)

SB(config)#interface range fasterthernet 0/8-14

SB(config-if-range)#switchport mode access

SB(config-if-range)#switchport access vlan 2

SB(config-if-range)#exit

SB(config)#interface range fasterthernet 0/15-23

SB(config-if-range)#switchport mode access

SB(config-if-range)#switchport access vlan 3

SB(config-if-range)#exit

SC的配置值

配置TRUNK(不变)

Switch>enable

Switch#configure terminal

Switch(config)#hostname SC

SC(config)#interface range fasterthernet 0/1

SC(config-if-range)#switchport mode trunk

配置VTP(不变,可以修改名字和密码)

SC(config)#vtp mode client

SC(config)#vtp domain xinbin

SC(config)#vtp password xinbin

配置VLAN(按情况划分)

SC(config)#interface range fasterthernet 0/8-14

SC(config-if-range)#switchport mode access

SC(config-if-range)#switchport access vlan 2

SC(config-if-range)#exit

SC(config)#interface range fasterthernet 0/15-23

SC(config-if-range)#switchport mode access

SC(config-if-range)#switchport access vlan 3

SC(config-if-range)#exit

Pc1的配置

Ip192.168.1.2

子网掩码:255.255.255.0

默认网关:192.168.1.1

Pc2的配置

Ip192.168.2.2

子网掩码:255.255.255.0

默认网关:192.168.2.1

Pc3的配置

Ip192.168.3.2

子网掩码:255.255.255.0

默认网关:192.168.3.1

Pc4的配置

Ip192.168.1.3

子网掩码:255.255.255.0

默认网关:192.168.1.1

Pc5的配置

Ip192.168.2.3

子网掩码:255.255.255.0

默认网关:192.168.2.1

Pc6的配置

Ip192.168.3.2

子网掩码:255.255.255.0

默认网关:192.168.3.1