VLAN与单臂路由配置实例分析
实现小型企业局域网二层广播域VLAN隔离和三层全网全连通;掌握Vlan、Trunk、单臂路由的配置方法;分析小型企业局域网广播域大小及二层网络通信过程;分析PC1pingPC4的三层通信过程和二层通信过程;分析PC4pingSW4网管地址的三层通信过程和二层通信过程。拓扑图如下:
VLAN与单臂路由设置步骤
1、基本信息的配置
SW3的基本信息配置
- Switch>
- Switch>enable
- Switch#configureterminal
- Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
- Switch(config)#hostnameSW3
- SW3(config)#noipdomain-lookup
- SW3(config)#lineconsole0
- SW3(config-line)#loggingsynchronous
- SW3(config-line)#nologin
- SW3(config-line)#privilegelevel15
- SW3(config-line)#linevty04
- SW3(config-line)#nologin
- SW3(config-line)#privilegelevel15
- SW3(config-line)#exi
- SW3(config)#end
SW4的基本信息配置
- Switch>//普通模式
- Switch>enable//进入特权模式
- Switch#configureterminal//进入全局配置模式
- Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
- Switch(config)#hostnameSW4//配置主机命名
- SW4(config)#noipdomain-lookup//禁域名查找
- SW4(config)#lineconsole0//进入Console口线路模式
- SW4(config-line)#loggingsynchronous//Console信息显示自动换行
- SW4(config-line)#nologin//配置Console口登录不认证
- SW4(config-line)#privilegelevel15//配置Telnet登录为最高特权级别enable不需要密码
- SW4(config-line)#exi
- SW4(config)#linevty04
- SW4(config-line)#nologin
- SW4(config-line)#privilegelevel15
- SW4(config-line)#exi
- SW4(config)#end
RT5的基本信息配置
- Router>
- Router>enable
- Router#configureterminal
- Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
- Router(config)#hostnameRT5
- RT5(config)#noipdomain-lookup
- RT5(config)#lineconsole0
- RT5(config-line)#loggingsynchronous
- RT5(config-line)#nologin
- RT5(config-line)#privilegelevel15
- RT5(config-line)#exi
- RT5(config)#linevty04
- RT5(config-line)#nologin
- RT5(config-line)#privilegelevel15
- RT5(config-line)#exi
- RT5(config)#end
#p#
2、二层网络全局配置
SW3的Vlan配置
- SW3#vlandatabase//进入Vlan配置模式
- SW3(vlan)#vlan8//创建Vlan8、10、11
- VLAN8added:
- Name:VLAN0008
- SW3(vlan)#vlan10
- VLAN10added:
- Name:VLAN0010
- SW3(vlan)#vlan11
- VLAN11added:
- Name:VLAN0011
- SW3(vlan)#exi
- SW3#showvlan-switch//查看Vlan配置信息
- VLANNameStatusPorts
- ----------------------------------------------------------------------------
- 1defaultactiveFa0/0,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
- 8VLAN0008active
- 10VLAN0010active
- 11VLAN0011active
SW4的Vlan配置
- SW4#vlandatabase//进入Vlan配置模式
- SW4(vlan)#vlan8//创建Vlan8、10、11
- VLAN8added:
- Name:VLAN0008
- SW4(vlan)#vlan10
- VLAN10added:
- Name:VLAN0010
- SW4(vlan)#vlan11
- VLAN11added:
- Name:VLAN0011
- SW4(vlan)#exi
- SW4#showvlan-switch//查看Vlan配置信息
- VLANNameStatusPorts
- ----------------------------------------------------------------------------
- 1defaultactiveFa0/0,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
- 8VLAN0008active
- 10VLAN0010active
- 11VLAN0011active
#p#
3、二层链路调试
SW3的Access接口配置
- SW3#configureterminal
- Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
- SW3(config)#interfa0/10//进入接口fa0/10配置
- SW3(config-if)#switchportmodeaccess//配置接口为Access模式
- SW3(config-if)#switchportaccessvlan10//把接口划到Vlan10
- SW3(config-if)#exi
- SW3(config)#interfa0/11//进入接口f0/11配置
- SW3(config-if)#switchportmodeaccess//配置接口为Access模式
- SW3(config-if)#switchportaccessvlan11//把接口划到Vlan11
- SW3(config-if)#exi
SW4的Access接口配置
- SW4#
- SW4#configureterminal
- Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
- SW4(config)#interfa0/10
- SW4(config-if)#switchportmodeaccess
- SW4(config-if)#switchportaccessvlan10
- SW4(config-if)#exi
- SW4(config)#interfa0/11
- SW4(config-if)#switchportmodeaccess
- SW4(config-if)#switchportaccessvlan11
- SW4(config-if)#exi
SW3——SW4的Trunk链路调测
- SW3(config)#interfa0/3
- SW3(config-if)#switchporttrunkencapsulationdot1q//选择封装协议
- SW3(config-if)#switchportmodetrunk//配置接口模式为Trunk
- SW3(config-if)#switchporttrunkallowedvlanall//Trunk允许所有Vlan的信息通过
- SW3(config-if)#exi
- SW4(config)#interfa0/3
- SW4(config-if)#switchporttrunkencapsulationdot1q
- SW4(config-if)#switchportmodetrunk
- SW4(config-if)#switchporttrunkallowedvlanall
- SW4(config-if)#exi
#p#
4、二层设备网管地址配置
SW3的网管接口配置
- SW3#configureterminal
- Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
- SW3(config)#intervlan8//为SW3配置网管地址
- SW3(config-if)#ipaddress192.168.8.130255.255.255.128
- SW3(config-if)#noshutdown
- SW3(config-if)#exit
- SW3(config)#ipdefault-gateway192.168.8.129//为SW3配置网关
- SW3(config)#end
- SW3#showrun
SW4的网管接口配置
- SW4(config)#intervlan8//为SW4配置网管地址
- SW4(config-if)#ipaddress192.168.8.131255.255.255.128
- SW4(config-if)#noshutdown
- SW4(config-if)#exi
- SW4(config)#ipdefault-gateway192.168.8.129//为SW4配置网关
- SW4(config)#exi
- SW4#showipinterfacebrief//查看SW4上接口配置信息
- InterfaceIP-AddressOK?MethodStatusProtocol
- FastEthernet0/0unassignedYESunsetupdown
- FastEthernet0/1unassignedYESunsetupdown
- FastEthernet0/2unassignedYESunsetupdown
- FastEthernet0/3unassignedYESunsetupup
- FastEthernet0/4unassignedYESunsetupdown
- FastEthernet0/5unassignedYESunsetupdown
- FastEthernet0/6unassignedYESunsetupdown
- FastEthernet0/7unassignedYESunsetupdown
- FastEthernet0/8unassignedYESunsetupdown
- FastEthernet0/9unassignedYESunsetupdown
- FastEthernet0/10unassignedYESunsetupup
- SW4#showinterfacesstatus//查看SW4上接口的状态
- PortNameStatusVlanDuplexSpeedType
- Fa0/0notconnect1autoauto10/100BaseTX
- Fa0/1notconnect1autoauto10/100BaseTX
- Fa0/2notconnect1autoauto10/100BaseTX
- Fa0/3connectedtrunka-fulla-10010/100BaseTX
- Fa0/4notconnect1autoauto10/100BaseTX
- Fa0/5notconnect1autoauto10/100BaseTX
- Fa0/6notconnect1autoauto10/100BaseTX
- Fa0/7notconnect1autoauto10/100BaseTX
- Fa0/8notconnect1autoauto10/100BaseTX
- Fa0/9notconnect1autoauto10/100BaseTX
- Fa0/10connected10a-fulla-10010/100BaseTX
- Fa0/11connected11a-fulla-10010/100BaseTX
- Fa0/12notconnect1autoauto10/100BaseTX
- Fa0/13notconnect1autoauto10/100BaseTX
- Fa0/14notconnect1autoauto10/100BaseTX
- Fa0/15notconnect1autoauto10/100BaseTX
#p#
5、三层接口配置及链路测试
SW3的上连接口配置
- SW3(config)#interfa0/1
- SW3(config-if)#switchporttrunkencapsulationdot1q
- SW3(config-if)#switchportmodetrunk
- SW3(config-if)#switchporttrunkallowedvlanall
- SW3(config-if)#switchporttrunknativevlan8//将该Trunk接口的nativeVlan改为Vlan8
- SW3(config-if)#exi
- SW3(config)#end
- SW3#showipinterfacebrief//查看SW3上接口的配置信息
- InterfaceIP-AddressOK?MethodStatusProtocol
- FastEthernet0/0unassignedYESunsetupdown
- FastEthernet0/1unassignedYESunsetupup
- FastEthernet0/2unassignedYESunsetupdown
- FastEthernet0/3unassignedYESunsetupup
- FastEthernet0/4unassignedYESunsetupdown
- FastEthernet0/5unassignedYESunsetupdown
- FastEthernet0/6unassignedYESunsetupdown
- FastEthernet0/7unassignedYESunsetupdown
- FastEthernet0/8unassignedYESunsetupdown
- FastEthernet0/9unassignedYESunsetupdown
- FastEthernet0/10unassignedYESunsetupup
- FastEthernet0/11unassignedYESunsetupup
- SW3#showinterfacesstatus//查看SW3上接口的状态
- PortNameStatusVlanDuplexSpeedType
- Fa0/0notconnect1autoauto10/100BaseTX
- Fa0/1connectedtrunka-fulla-10010/100BaseTX
- Fa0/2notconnect1autoauto10/100BaseTX
- Fa0/3connectedtrunka-fulla-10010/100BaseTX
- Fa0/4notconnect1autoauto10/100BaseTX
- Fa0/5notconnect1autoauto10/100BaseTX
- Fa0/6notconnect1autoauto10/100BaseTX
- Fa0/7notconnect1autoauto10/100BaseTX
- Fa0/8notconnect1autoauto10/100BaseTX
- Fa0/9notconnect1autoauto10/100BaseTX
- Fa0/10connected10a-fulla-10010/100BaseTX
- Fa0/11connected11a-fulla-10010/100BaseTX
- Fa0/12notconnect1autoauto10/100BaseTX
- Fa0/13notconnect1autoauto10/100BaseTX
- Fa0/14notconnect1autoauto10/100BaseTX
- Fa0/15notconnect1autoauto10/100BaseTX
单臂路由配置
- RT5#configureterminal
- Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
- RT5(config)#intere0/0//主接口对应nativevlan
- RT5(config-if)#ipaddress192.168.8.129255.255.255.128
- RT5(config-if)#noshutdown//打开主接口
- RT5(config-if)#exi
- RT5(config)#intere0/0.10//创建子接口
- RT5(config-subif)#encapsulationdot1q10//封装dot1q,vlanid10,对应vlan10,vlan10的路由点。
- RT5(config-subif)#ipaddress192.168.10.1255.255.255.0
- RT5(config-subif)#noshutdown//打开子接口
- RT5(config-subif)#exi
- RT5(config)#intere0/0.11//创建子接口
- RT5(config-subif)#encapsulationdot1q11//封装dot1q,vlanid11,对应vlan11,vlan11的路由点
- RT5(config-subif)#ipaddress192.168.11.1255.255.255.0
- RT5(config-subif)#noshutdown//打开子接口
- RT5(config-subif)#end
- RT5#showipinterfacebrief//查看RT5上接口的简要配置信息
- InterfaceIP-AddressOK?MethodStatusProtocol
- Ethernet0/0192.168.8.129YESmanualupup
- Ethernet0/0.10192.168.10.1YESmanualupup
- Ethernet0/0.11192.168.11.1YESmanualupup
- Ethernet0/1unassignedYESunsetadministrativelydowndown
- Ethernet0/2unassignedYESunsetadministrativelydowndown
- Ethernet0/3unassignedYESunsetadministrativelydowndown
#p#
6、全网连通性测试
VLAN与单臂路由配置总结
VLAN与单臂路由配置成功实现,小型企业局域网二层广播域VLAN隔离和三层全网全连通,Vlan、Trunk、单臂路由的配置方法比较基础,大家较易理解;同时还希望大家掌握数据流的分析方法,这是我们学好网络的一个重要的过程。