2018-7-18
配置网络环境
配置交换机1
Switch>en
Switch#
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#
%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/1 (1), with SW1 FastEthernet0/2 (10).
Switch(config)#vlan 10
Switch(config-vlan)#lan 20
^
% Invalid input detected at '^' marker.
Switch(config-vlan)#vlan 20
Switch(config-vlan)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
Switch(config-if)#int range fa0/1-2
Switch(config-if-range)#sw ac vlan 20
Switch(config-if-range)#
配置交换机2
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#ho SW1
SW1(config)#no ip domain lo
SW1(config)#no ip domain lookup
SW1(config)#
SW1(config)#line c 0
SW1(config-line)#no ex
SW1(config-line)#no exec-timeout
SW1(config-line)#log
SW1(config-line)#logg ss
SW1(config-line)#logg s
SW1(config-line)#do wr
Building configuration...
[OK]
SW1(config-line)#
SW1(config-line)#exit
SW1(config)#
SW1(config)#vlan 10
SW1(config-vlan)#vlan 20
SW1(config-vlan)#do show vlan b
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, 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, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig0/1, Gig0/2
10 VLAN0010 active
20 VLAN0020 active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
SW1(config-vlan)#int fa0/1
SW1(config-if)#sw ac vlan 10
SW1(config-if)#do wr
Building configuration...
[OK]
SW1(config-if)#int fa0/2
SW1(config-if)#sw ac vlan 10
SW1(config-if)#do wr
互ping
Packet Tracer PC Command Line 1.0
C:\>ping 192.168.1.1
Pinging 192.168.1.1 with 32 bytes of data:
Reply from 192.168.1.1: bytes=32 time=3ms TTL=128
Reply from 192.168.1.1: bytes=32 time<1ms TTL=128
Reply from 192.168.1.1: bytes=32 time<1ms TTL=128
Reply from 192.168.1.1: bytes=32 time=1ms TTL=128
Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 3ms, Average = 1ms
*路由器之间的接口配置推荐使用trunk
(只适用于中小型企业)
第一步 配置交换机
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#no ip domain loo
Switch(config)#line c 0
Switch(config-line)#no exec-timeout
Switch(config-line)#exit
Switch(config)#ho sw1
sw1(config)#vlan 10
sw1(config-vlan)#vlan 20
sw1(config-vlan)#int fa0/3
sw1(config-if)#sw ac vlan 10
sw1(config-if)#int fa 0/2
sw1(config-if)#sw ac vlan 20
sw1(config-if)#int fa 0/1
sw1(config-if)#sw tr en d
sw1(config-if)#sw mo tr
第二步 配置路由器
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#no ip domain loo
Switch(config)#line c 0
Switch(config-line)#no e
Switch(config-line)#no exec-timeout
Switch(config-line)#exit
Switch(config)#ho sw1
sw1(config)#vlan 10
sw1(config-vlan)#vlan 20
sw1(config-vlan)#int fa0/3
sw1(config-if)#sw ac vlan 10
sw1(config-if)#ip add 192.168.10.1
^
% Invalid input detected at '^' marker.
sw1(config-if)#ip add 192.168.10.
^
% Invalid input detected at '^' marker.
sw1(config-if)#int fa 0/2
sw1(config-if)#sw ac valn 20
^
% Invalid input detected at '^' marker.
sw1(config-if)#sw ac vlan 20
sw1(config-if)#int fa 0/1
sw1(config-if)#sw mo tr
Command rejected: An interface whose trunk encapsulation is "Auto" can not be configured to "trunk" mode.
sw1(config-if)#sw tr en d
sw1(config-if)#sw mo tr
sw1(config-if)#
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#HO R1
R1(config)#int fa0/0
R1(config-if)#sw tr
R1(config-if)#no sh
R1(config)#int fa0/0.100
R1(config-subif)#int fa0/0
R1(config-if)#sw mo tr
R1(config-if)#exit
R1(config)#int fa0/0.100
R1(config-subif)#en dot1Q 10
R1(config-subif)#ip add 192.168.1.254 255.255.255.0
R1(config-subif)#exit
R1(config)#int fa0/0.200
R1(config-subif)#en dot1Q 20
R1(config-subif)#ip add 192.168.2.254 255.255.255.0
R1(config-subif)#exit
例:A----B----C-----D 四个路由器 A发送报文至D。
VTP
VTP Trunking Protocol:
宣告VLAN信息
同步VLAN信息
转发VLAN信息
支持多种网路类型:以太网,FDDI,令牌环
添加、删除、修改VLAN
宣告VLAN信息
同步VLAN信息
转发VLAN信息
VLAN信息保存在NVRAM中
不能添加、删除、修改VLAN
同步VLAN信息
转发VLAN信息
VLAN信息不保存在NVRAM中
添加、删除、修改VLAN
同步VLAN信息
转发VLAN信息
VLAN信息保存在NVRAM中