路由器配置:算法
Interface f0/0.100ide
//由于路由器只有一个以太网口,因此要配置子接口来链接不一样的vlanspa
encapsulation dot1Q 100 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />xml
//dot1q 后面对应的数字是对应交换机的vlan接口
Ip address 192.168.0.1 255.255.255.0ip
路由器配置:路由
Interface f0/0.200it
encapsulation dot1Q 200io
Ip address 192.168.0.1 255.255.255.0ast
交换机配置
Interface f0/1
switchport mode trunk
interface f0/2
switchport access vlan100
switchport mode access
no ip address
spanning-tree portfast
//把一个port设置了portfast,就是让那个port再也不使用STP的算法。
在STP中,port有5个状态:disable、blocking、listening、learning、forwarding。
只有forwarding状态,port才能发送用户数据。若是一个port一开始是没有接pc,一旦pc接上,就会经历blocking->listening->learing->forwarding,每一个状态的变化要经历一段时间,这样总共会有3个阶段时间,缺省的配置要50秒钟。这样从pc接上网线,到能发送用户数据,须要等50秒的时间,但若是设置了portfast,那就不须要等待这50秒了。
注意:这条命令通常在接入层使用,若是你下连的是一台PC机配置这条命令回解决DHCP的得到地址时间过长问题。若是你链接的是一台交换机,那么必定不能使用这条命令,不然会形成环路。
interface f0/3
switchport access vlan100
switchport mode access
no ip address
ok!这个技术其实很简单,使用中的话咱们根据企业不一样的需求能够增长项目,好比DHCP、ACL等等。