您的当前位置:首页利用单臂路由实验VLAN间的通信

利用单臂路由实验VLAN间的通信

来源:锐游网


(一)在三层交换机上划分VLAN添加端口

l3-2(config)# vlan 10

l3-2(config-vlan)#iname xiaoshou l3-2(config-vlan)#vlan 20 l3-2(config-vlan)#name jishu

l3-2(config-vlan)#exit

l3-2(config)#interface range fasteEthernet 0/6 – 10 “—”两端有空格

l3-2(config-if-rang)#switchport mode access 定义该接口VLAN成员类型(二层access) l3-2(config-if-rang) # switchport access vlan 10 将这个接口分配给一个VLAN l3-2(config-if-rang) # exit

(二)设置交换机之间的链路为TRUNK

l3-2(config)# interface fasteEthernet 0/1 l3-2(config-if)#switchport mode trunk l3-2(config-if)#exit

(三)在路由器上划分子接口,配置IP地址

router#configure terminal

router(config) #interface fasteEthernet 0/0

router(config-if) #no ip address 去掉路由器猪接口的IP地址

router(config-if) #no shutdown router(config-if) #exit

router(config) #interface fasteEthernet 0/0.10 进入子接口F0/0.10

router(config-subif) #encapsulation dot1Q 10 指定子接口F0/0.10对应VLAN 10,并配置干模式

router(config-subif) #ip address 192.168.10.1 255.255.255.0配置子接口F0/0.10的IP地址 router(config-subif) #exit

router(config) #interface fasteEthernet 0/0.20 进入子接口F0/0.20

router(config-subif) #encapsulation dot1Q 20 指定子接口F0/0.20对应VLAN 20,并配置干模式

router(config-subif) #ip address 192.168.20.1 255.255.255.0配置子接口F0/0.20的IP地址 router(config-subif) #exit

(四)查看路由器的路由表

router# show ip route查看路由表 router# show running-config产看配置

(五)注意事项

(1)再给路由器的子接口配置IP地址之前一定要先封装dot1q协议

(2)各个VLAN内的主机,要以相应的VLAN子接口的IP地址作为网关

因篇幅问题不能全部显示,请点此查看更多更全内容

Top