您的位置:首页 > 其它

单臂路由与Vlan间路由亲密接触

2020-05-10 22:42 429 查看

路由器配置:

Interface f0/0.100

//因为路由器只有一个以太网口,所以要配置子接口来连接不同的vlan

encapsulation dot1Q 100 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

//dot1q 后面对应的数字是对应交换机的vlan

Ip address 192.168.0.1 255.255.255.0

路由器配置:

Interface f0/0.200

encapsulation dot1Q 200

Ip address 192.168.0.1 255.255.255.0

交换机配置

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等等。​​​​

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: