拓扑构成
拓扑:
配置过程
配置信息:R1
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface f0/0
R1(config-if)#no shut
R1(config-if)#interface f0/0.1
R1(config-subif)#encapsulation dot1Q 10
//后面的数字 1 代表是的侦听VLAN号为 10 的传输数据
*Mar 1 00:06:55.083: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
R1(config-subif)#ip address 192.168.10.254 255.255.255.0
R1(config-subif)#no shut
R1(config-subif)#
R1(config-subif)#interface f0/0.2
R1(config-subif)#encapsulation dot1Q 20
//后面的数字 1 代表是的侦听VLAN号为 10 的传输数据
R1(config-subif)#ip address 192.168.20.254 255.255.255.0
R1(config-subif)#no shut
R1(config-if)#end
R1#
*Mar 1 00:08:20.167: %SYS-5-CONFIG_I: Configured from console by console
R1#
R1#copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
R1#
R1#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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.10.0/24 is directly connected, FastEthernet0/0.1
C 192.168.20.0/24 is directly connected, FastEthernet0/0.2
R1#
配置信息:SW1
SW1#vlan database
SW1(vlan)#vlan 10
VLAN 10 added:
Name: VLAN0010
SW1(vlan)#vlan 20
VLAN 20 added:
Name: VLAN0020
SW1(vlan)#apply
APPLY completed.
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#
SW1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#no ip routing
SW1(config)#
SW1(config)#interface f0/0
SW1(config-if)#switchport mode trunk
*Mar 1 00:12:14.687: %DTP-5-TRUNKPORTON: Port Fa0/15 has become dot1q trunk
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#no shut
SW1(config-if)#exit
SW1(config)#
SW1(config)#interface f0/1
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10
SW1(config-if)#no shut
SW1(config-if)#exit
SW1(config)#
SW1(config)#interface f0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10
SW1(config-if)#no shut
SW1(config-if)#exit
SW1(config)#interface f0/3
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 20
SW1(config-if)#no shut
SW1(config-if)#exit
SW1(config)#
SW1(config)#interface f0/4
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 20
SW1(config-if)#no shut
SW1(config-if)#exit
SW1(config)#interface f0/15
SW1(config-if)#switchport mode trunk
*Mar 1 00:12:14.687: %DTP-5-TRUNKPORTON: Port Fa0/15 has become dot1q trunk
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#no shut
SW1(config-if)#end
SW1#
*Mar 1 00:15:50.355: %SYS-5-CONFIG_I: Configured from console by console
SW1#copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
SW1#
SW1#show vlan-switch
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14
10 VLAN0010 active Fa0/1, Fa0/2
20 VLAN0020 active Fa0/3, Fa0/4
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 1002 1003
10 enet 100010 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 1 1003
1003 tr 101003 1500 1005 0 - - srb 1 1002
1004 fdnet 101004 1500 - - 1 ibm - 0 0
1005 trnet 101005 1500 - - 1 ibm - 0 0
SW1#
配置信息:SW2
SW2#vlan database
SW2(vlan)#vlan 10
VLAN 10 added:
Name: VLAN0010
SW2(vlan)#vlan 20
VLAN 20 added:
Name: VLAN0020
SW2(vlan)#apply
APPLY completed.
SW2(vlan)#exit
APPLY completed.
Exiting....
SW2#
SW2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#no ip routing
SW2(config)#
SW2(config)#interface f0/0
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 10
SW2(config-if)#no shut
SW2(config-if)#exit
SW2(config)#
SW2(config)#interface f0/1
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 20
SW2(config-if)#no shut
SW2(config-if)#exit
SW2(config)#
SW2(config)#interface f0/15
SW2(config-if)#switchport mode trunk
*Mar 1 00:12:14.687: %DTP-5-TRUNKPORTON: Port Fa0/15 has become dot1q trunk
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#no shut
SW2(config-if)#end
SW2#
*Mar 1 00:15:50.355: %SYS-5-CONFIG_I: Configured from console by console
SW2#copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
SW2#
SW2#show vlan-switch
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/2, Fa0/3, Fa0/4, Fa0/5
Fa0/6, Fa0/7, Fa0/8, Fa0/9
Fa0/10, Fa0/11, Fa0/12, Fa0/13
Fa0/14
10 VLAN0010 active Fa0/0
20 VLAN0020 active Fa0/1
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 1002 1003
10 enet 100010 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 1 1003
1003 tr 101003 1500 1005 0 - - srb 1 1002
1004 fdnet 101004 1500 - - 1 ibm - 0 0
1005 trnet 101005 1500 - - 1 ibm - 0 0
SW2#
验证与测试
测试:PC-1
PC-1> ip 192.168.10.1 255.255.255.0 192.168.10.254
Checking for duplicate address...
PC1 : 192.168.10.1 255.255.255.0 gateway 192.168.10.254
PC-1> save
Saving startup configuration to startup.vpc
. done
PC-1> ping 192.168.10.254
84 bytes from 192.168.10.254 icmp_seq=1 ttl=255 time=30.032 ms
84 bytes from 192.168.10.254 icmp_seq=2 ttl=255 time=15.936 ms
84 bytes from 192.168.10.254 icmp_seq=3 ttl=255 time=15.954 ms
84 bytes from 192.168.10.254 icmp_seq=4 ttl=255 time=15.940 ms
84 bytes from 192.168.10.254 icmp_seq=5 ttl=255 time=14.991 ms
PC-1> ping 192.168.20.254
84 bytes from 192.168.20.254 icmp_seq=1 ttl=255 time=15.915 ms
84 bytes from 192.168.20.254 icmp_seq=2 ttl=255 time=14.971 ms
84 bytes from 192.168.20.254 icmp_seq=3 ttl=255 time=15.293 ms
84 bytes from 192.168.20.254 icmp_seq=4 ttl=255 time=15.415 ms
84 bytes from 192.168.20.254 icmp_seq=5 ttl=255 time=16.032 ms
PC-1>
测试:PC-2
PC-2> ip 192.168.10.2 255.255.255.0 192.168.10.254
Checking for duplicate address...
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.254
PC-2> save
Saving startup configuration to startup.vpc
. done
PC-2> ping 192.168.10.254
84 bytes from 192.168.10.254 icmp_seq=1 ttl=255 time=14.934 ms
84 bytes from 192.168.10.254 icmp_seq=2 ttl=255 time=14.952 ms
84 bytes from 192.168.10.254 icmp_seq=3 ttl=255 time=15.134 ms
84 bytes from 192.168.10.254 icmp_seq=4 ttl=255 time=15.940 ms
84 bytes from 192.168.10.254 icmp_seq=5 ttl=255 time=14.929 ms
PC-2> ping 192.168.20.254
84 bytes from 192.168.20.254 icmp_seq=1 ttl=255 time=15.720 ms
84 bytes from 192.168.20.254 icmp_seq=2 ttl=255 time=16.293 ms
84 bytes from 192.168.20.254 icmp_seq=3 ttl=255 time=16.051 ms
84 bytes from 192.168.20.254 icmp_seq=4 ttl=255 time=15.894 ms
84 bytes from 192.168.20.254 icmp_seq=5 ttl=255 time=15.761 ms
PC-2> ping 192.168.10.1
84 bytes from 192.168.10.1 icmp_seq=1 ttl=64 time=1.998 ms
84 bytes from 192.168.10.1 icmp_seq=2 ttl=64 time=0.969 ms
84 bytes from 192.168.10.1 icmp_seq=3 ttl=64 time=2.009 ms
84 bytes from 192.168.10.1 icmp_seq=4 ttl=64 time=1.960 ms
84 bytes from 192.168.10.1 icmp_seq=5 ttl=64 time=2.000 ms
PC-2>
测试:PC-3
PC-3> ip 192.168.20.1 255.255.255.0 192.168.20.254
Checking for duplicate address...
PC1 : 192.168.20.1 255.255.255.0 gateway 192.168.20.254
PC-3> save
Saving startup configuration to startup.vpc
. done
PC-3> ping 192.168.20.254
84 bytes from 192.168.20.254 icmp_seq=1 ttl=255 time=15.671 ms
84 bytes from 192.168.20.254 icmp_seq=2 ttl=255 time=15.425 ms
84 bytes from 192.168.20.254 icmp_seq=3 ttl=255 time=14.967 ms
84 bytes from 192.168.20.254 icmp_seq=4 ttl=255 time=15.886 ms
84 bytes from 192.168.20.254 icmp_seq=5 ttl=255 time=16.266 ms
PC-3> ping 192.168.10.254
84 bytes from 192.168.10.254 icmp_seq=1 ttl=255 time=15.863 ms
84 bytes from 192.168.10.254 icmp_seq=2 ttl=255 time=16.150 ms
84 bytes from 192.168.10.254 icmp_seq=3 ttl=255 time=14.825 ms
84 bytes from 192.168.10.254 icmp_seq=4 ttl=255 time=14.715 ms
84 bytes from 192.168.10.254 icmp_seq=5 ttl=255 time=15.019 ms
PC-3> ping 192.168.10.1
192.168.10.1 icmp_seq=1 timeout
192.168.10.1 icmp_seq=2 timeout
84 bytes from 192.168.10.1 icmp_seq=3 ttl=63 time=30.853 ms
84 bytes from 192.168.10.1 icmp_seq=4 ttl=63 time=30.859 ms
84 bytes from 192.168.10.1 icmp_seq=5 ttl=63 time=30.903 ms
PC-3>
测试:PC-4
PC-4> ip 192.168.20.2 255.255.255.0 192.168.20.254
Checking for duplicate address...
PC1 : 192.168.20.1 255.255.255.0 gateway 192.168.20.254
PC-4> save
Saving startup configuration to startup.vpc
. done
PC-4> ping 192.168.20.254
84 bytes from 192.168.20.254 icmp_seq=1 ttl=255 time=15.671 ms
84 bytes from 192.168.20.254 icmp_seq=2 ttl=255 time=15.425 ms
84 bytes from 192.168.20.254 icmp_seq=3 ttl=255 time=14.967 ms
84 bytes from 192.168.20.254 icmp_seq=4 ttl=255 time=15.886 ms
84 bytes from 192.168.20.254 icmp_seq=5 ttl=255 time=16.266 ms
PC-4> ping 192.168.10.254
84 bytes from 192.168.10.254 icmp_seq=1 ttl=255 time=15.863 ms
84 bytes from 192.168.10.254 icmp_seq=2 ttl=255 time=16.150 ms
84 bytes from 192.168.10.254 icmp_seq=3 ttl=255 time=14.825 ms
84 bytes from 192.168.10.254 icmp_seq=4 ttl=255 time=14.715 ms
84 bytes from 192.168.10.254 icmp_seq=5 ttl=255 time=15.019 ms
PC-4> ping 192.168.10.1
192.168.10.1 icmp_seq=1 timeout
192.168.10.1 icmp_seq=2 timeout
84 bytes from 192.168.10.1 icmp_seq=3 ttl=63 time=30.853 ms
84 bytes from 192.168.10.1 icmp_seq=4 ttl=63 time=30.859 ms
84 bytes from 192.168.10.1 icmp_seq=5 ttl=63 time=30.903 ms
PC-4>
测试:PC-5
PC-5> ip 192.168.10.3 255.255.255.0 192.168.10.254
Checking for duplicate address...
PC1 : 192.168.10.3 255.255.255.0 gateway 192.168.10.254
PC-5> save
Saving startup configuration to startup.vpc
. done
PC-5> ping 192.168.10.1
84 bytes from 192.168.10.1 icmp_seq=1 ttl=64 time=2.005 ms
84 bytes from 192.168.10.1 icmp_seq=2 ttl=64 time=3.002 ms
84 bytes from 192.168.10.1 icmp_seq=3 ttl=64 time=0.993 ms
84 bytes from 192.168.10.1 icmp_seq=4 ttl=64 time=2.999 ms
84 bytes from 192.168.10.1 icmp_seq=5 ttl=64 time=3.476 ms
PC-5> ping 192.168.20.1
192.168.20.1 icmp_seq=1 timeout
192.168.20.1 icmp_seq=2 timeout
84 bytes from 192.168.20.1 icmp_seq=3 ttl=63 time=31.916 ms
84 bytes from 192.168.20.1 icmp_seq=4 ttl=63 time=30.917 ms
84 bytes from 192.168.20.1 icmp_seq=5 ttl=63 time=31.011 ms
PC-5>
测试 :PC-6
PC-6> ip 192.168.20.3 255.255.255.0 192.168.20.254
Checking for duplicate address...
PC1 : 192.168.20.3 255.255.255.0 gateway 192.168.20.254
PC-6> save
Saving startup configuration to startup.vpc
. done
PC-6> ping 192.168.10.1
192.168.10.1 icmp_seq=1 timeout
192.168.10.1 icmp_seq=2 timeout
84 bytes from 192.168.10.1 icmp_seq=3 ttl=63 time=31.475 ms
84 bytes from 192.168.10.1 icmp_seq=4 ttl=63 time=31.468 ms
84 bytes from 192.168.10.1 icmp_seq=5 ttl=63 time=31.642 ms
PC-6> ping 192.168.20.1
84 bytes from 192.168.20.1 icmp_seq=1 ttl=64 time=3.454 ms
84 bytes from 192.168.20.1 icmp_seq=2 ttl=64 time=3.257 ms
84 bytes from 192.168.20.1 icmp_seq=3 ttl=64 time=1.998 ms
84 bytes from 192.168.20.1 icmp_seq=4 ttl=64 time=1.962 ms
84 bytes from 192.168.20.1 icmp_seq=5 ttl=64 time=2.998 ms
PC-6>
以上
就是本次实验有关利用”单臂路由子接口实现VLAN间通讯“的全部内容。