一、说明
利用Boson软件设计好拓扑图然后进行相应的配置,关键配置就是在子接口封装802.1q协议,实现简单的不同vlan之间的通信。
二、拓扑图
三、pc及接口地址的划分
[pc] |
IP地址 |
子网掩码 |
网关 |
pc1 |
192.168.1.10 |
255.255.255.0 |
192.168.1.1 |
pc2 |
192.168.2.10 |
255.255.255.0 |
192.168.2.1 |
pc3 |
192.168.1.20 |
255.255.255.0 |
192.168.1.1 |
pc4 |
192.168.2.10 |
255.255.255.0 |
192.168.2.1 |
[switch1] |
所属vlan |
模式 |
f0/1 |
2 |
access |
f0/2 |
3 |
access |
f0/10 |
(默认)1 |
trunk |
[switch2] |
所属vlan |
模式 |
f0/1 |
2 |
access |
f0/2 |
3 |
access |
f0/10 |
(默认)1 |
trunk |
f0/12 |
------- |
trunk |
路由器接口地址
router |
IP地址 |
子网掩码 |
f0/0 |
------------ |
------------- |
f0/0.1 |
192.168.1.1 |
255.255.255.0 |
f0/0.2 |
192.168.2.1 |
255.255.255.0 |
四、相应的配置命令代码(注:这是用show running-config得到的)
Switch:
2950A:
2950A#show running-config
!
Version 12.1
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname 2950A
!
!
!
ip subnet-zero
spanning-tree extend system-id
!
!
!
!
!
!
!
!
interface FastEthernet0/1
switchport mode access
switchport access vlan 2
!
interface FastEthernet0/2
switchport mode access
switchport access vlan 3
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
switchport mode trunk
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
vtp Server
vtp domain stone
!
interface Vlan 1
no ip address
no ip route-cache
!
vlan 2 name vlan2
vlan 3 name vlan3
!
ip classless
no ip http server
!
!
!
!
line con 0
transport input none
line aux 0
line vty 0 15
!
no scheduler allocate
end
2950B:
2950B#show running-config
!
Version 12.1
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname 2950B
!
!
!
ip subnet-zero
spanning-tree extend system-id
!
!
!
!
!
!
!
!
interface FastEthernet0/1
switchport mode access
switchport access vlan 2
!
interface FastEthernet0/2
switchport mode access
switchport access vlan 3
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
switchport mode trunk
!
interface FastEthernet0/11
!
interface FastEthernet0/12
switchport mode trunk
!
vtp Server
vtp domain stone
!
interface Vlan 1
no ip address
no ip route-cache
!
vlan 2 name vlan2
vlan 3 name vlan3
!
ip classless
no ip http server
!
!
!
!
line con 0
transport input none
line aux 0
line vty 0 15
!
no scheduler allocate
end
router:
R2620:
R2620#show running-config
Building configuration...
!
Version 12.1
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R2620
!
!
!
ip subnet-zero
!
!
!
!
!
!
!
!
interface Serial0/0
no ip address
no ip directed-broadcast
shutdown
!
interface FastEthernet0/0
no ip address
no ip directed-broadcast
!
interface FastEthernet0/0.1
encapsulation dot1q 2
ip address 192.168.1.1 255.255.255.0
!
interface FastEthernet0/0.2
encapsulation dot1q 3
ip address 192.168.2.1 255.255.255.0
!
!
ip classless
no ip http server
!
!
!
!
line con 0
transport input none
line aux 0
line vty 0 4
!
no scheduler allocate
end
五、结果与小结
学习是要有耐心的,持之以恒才能成功.