setp 1
交换机配置如下
:(图中R2)
SW2#
vlan da
SW2(vlan)#
vlan 1
VLAN 1 modified:
SW2(vlan)#
vlan 2
VLAN 2 added:
Name: VLAN0002
SW2(vlan)#vlan 3
VLAN 3 added:
Name: VLAN0003
SW2(vlan)#
exit
APPLY completed.
Exiting....
SW2#conf t
SW2(config)#
int fa0/0
SW2(config-if)#
sw mod trun
SW2(config-if)#
no sh
*Mar
1 00:05:22.335: %DTP-5-TRUNKPORTON: Port Fa0/0 has become dot1q trunk
SW2(config-if)#
exit
SW2(config)#
int fa0/1
SW2(config-if)#
switchport mode access
SW2(config-if)#
sw access vlan 2
SW2(config-if)#
exit
SW2(config)#
int fa0/2
SW2(config-if)#
sw mod acc
SW2(config-if)#
sw acc vlan 3
SW2(config-if)#
exit
SW2(config)#
do show ip int b
Interface
IP-Address
OK? Method Status
Protocol
FastEthernet0/0
unassigned
YES unset
up
up
FastEthernet0/1
unassigned
YES unset
up
up
FastEthernet0/2
unassigned
YES unset
up
up
FastEthernet0/3
unassigned
YES unset
up
down
FastEthernet0/4
unassigned
YES unset
up
down
FastEthernet0/5
unassigned
YES unset
up
down
FastEthernet0/6
unassigned
YES unset
up
down
FastEthernet0/7
unassigned
YES unset
up
down
FastEthernet0/8
unassigned
YES unset
up
down
FastEthernet0/9
unassigned
YES unset
up
down
FastEthernet0/10
unassigned
YES unset
up
down
SW2(config)#
exit
SW2#
show vlan-switch br
VLAN Name
Status
Ports
---- -------------------------------- --------- -------------------------------
1
default
active
Fa0/3, Fa0/4, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14
Fa0/15
2
VLAN0002
active
Fa0/1
3
VLAN0003
active
Fa0/2
1002 fddi-default
active
1003 token-ring-default
active
1004 fddinet-default
active
1005 trnet-default
active
SW2#
show int trunk
Port
Mode
Encapsulation
Status
Native vlan
Fa0/0
on
802.1q
trunking
1
Port
Vlans allowed on trunk
Fa0/0
1-1005
Port
Vlans allowed and active in management domain
Fa0/0
1-3
Port
Vlans in spanning tree forwarding state and not pruned
Fa0/0
1-3
setp 2
路由器配置如下
:
R1(config)#
int fa0/0
R1(config-if)#
no sh
//
物理接口要
UP
R1(config-if)#
exit
R1(config)#
*Mar
1 00:06:59.023: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar
1 00:07:00.023: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config)#
do show ip int b
Interface
IP-Address
OK? Method Status
Protocol
FastEthernet0/0
unassigned
YES unset
up
up
R1(config)#
int fa0/0.2
R1(config-subif)#
ip add 192.168.20.254 255.255.255.0
//
要求先进行封装
% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.
R1(config-subif)#
encapsulation dot1Q 2
//
对应对相应的
vlan
R1(config-subif)#
ip add 192.168.20.254 255.255.255.0
R1(config-subif)#
no sh
R1(config-subif)#
int fa0/0.3
R1(config-subif)#
encapsulation dot1Q 3
R1(config-subif)#
ip add 192.168.30.254 255.255.255.0
R1(config-subif)#
no sh
R1#
show ip int b
Interface
IP-Address
OK? Method Status
Protocol
FastEthernet0/0
unassigned
YES unset
up
up
FastEthernet0/0.2
192.168.20.254
YES manual up
up
FastEthernet0/0.3
192.168.30.254
YES manual up
up