局域网的组建(局域网搭建教程)1、局域网技术 局域网(LAN)是指在某一区域内由多台计算机互联成的计算机组。 一般是方圆几千米以内。局域网可以实现文件管理、软件共享、打印机共享、工作组内的日程安排、电子邮件和传真通信服务等功能。局域网是封闭型的,可以由办公室观众的两台计算机组成,也可以由一个公司的上千台计算组成。 2、所用到的硬件及知识点:该实验用到4台路由器、3台交换机、5台PC机。VLAN划分,TRUNK,RIPV2。 3、拓扑图: (1)PC地址表: (2)端口分配交换机 (3)接口分配表路由器 4、局域网具体配置 (1)PC机的配置 注:PC2、PC3、PC4、PC5、PC6、PC7配置相同 (2)设交换机主机名 例: Switch1: Switchgt;enable Switchconfigureterminal Switch(config)hostnames1s1为所设置的交换机名称 S1(config)exit Router1: Routergt;enable Routerconfigureterminal Router(config)hostnameR1s1为所设置的交换机名称 R1(config)exit 注:路由器R2,R3,R4与R1设置相同。交换机S2,S3,S4,S5与S1的设置相同 (3)VLAN设置 例:S2 S2(config)interfaceFastEthernet02 S2(configif)switchportmodetrunk将f02转换成trunk s2(configif)noshutdown s2(configif)exit s2(config)interfaceFastEthernet01 s2(configif)noshutdowns2(configif)exit s2(config)vlan60创建VLAN60 S2(configvlan)intervlan60 s2(configif)interfaceFastEthernet01 s2(configif)switchportaccessvlan60加入VLAN60 s2(configif)noshutdown 注:如果交换机与交换机,交换机与路由器相连要强制转换为trunk。 若交换机与PC则不需要。S1,S3,S4如s2配置。 (4)路由器设置 R1: R1(config)interfaceFastEthernet00 R1(configif)noshutdown R1(configif)exit R1(config)interfaceserial030 R1(config)ipaddress200。0。0。2255。255。255。0写入IP R1(configif)noshutdown R1(configif)exit R1(config)interfaceFastEthernet00。40 R1(configsubif)encapsulationdot1q40封装子接口到VLAN40 R1(configsubif)ipaddress200。30。40。1255。255。255。0 R1(configsubif)exit R1(config)interfaceFastEthernet00。50 R1(configsubif)encapsulationdot1q50 R1(configsubif)ipaddress200。30。50。1255。255。255。0 R1(configsubif)exit R2(config)interfaceFastEthernet00。60 R2(configsubif)encapsulationdot1q60 R2(configsubif)ipaddress201。30。60。1255。255。255。0 R2(configsubif)exitR3(config)interfaceFastEthernet00。60 R3(configsubif)encapsulationdot1q61 R3(configsubif)ipaddress202。30。61。1255。255。255。0 R3(configsubif)exit R3(config)interfaceFastEthernet00。70 R3(configsubif)encapsulationdot1q70 R3(configsubif)ipaddress202。30。70。1255。255。255。0 R3(configsubif)exit R3(config)interfaceFastEthernet00。71 R3(configsubif)encapsulationdot1q71 R3(configsubif)ipaddress202。30。71。1255。255。255。0 R3(configsubif)exit R1(config)routerrip R1(configrouter)version2版本 R1(configrouter)network200。0。0。0转发的网络 R1(configrouter)network200。30。40。0 R1(configrouter)network200。30。50。0 R1(configrouter)exit 注: R2转发的网络 R2(configrouter)network200。0。0。0 R2(configrouter)network210。0。0。0 R2(configrouter)network201。30。60。0 R3转发的网络 R3(configrouter)network210。0。0。0 R3(configrouter)network220。0。0。0 R3(configrouter)network202。30。61。0 R3(configrouter)network202。30。70。0 R3(configrouter)network202。30。71。0 R4转发的网络 R4(configrouter)network220。0。0。0 (5)时钟设置 比如R2中的s030 R2(config)interfaceserial030 R2(configif)ipaddress200。0。0。3255。255。255。0 R2(configif)clockrate64000 R2(configif)noshutdown 5、测试 PC1为VLAN40,PC2为VLAN50,PC3为VLAN60,PC4为VLAN61,PC5和PC6同属于VLAN70,PC7为VLAN71 (1)同一VLAN之间的测试 PC5(200。30。70。2)和PC6(200。30。70。3)之间的测试 (2)不同网段之间的测试 1、PC1(200。30。40。2)和PC2(200。30。50。2) 先到相应的网段200。30。50。0,再根据路由表进行转发。 2、PC1(200。30。40。2)和PC3(201。30。60。2) 先到相应的网段201。30。60。0,再根据路由表进行转发。 3、PC6(202。30。70。3)和PC7(202。30。71。3) 先到相应的网段202。30。71。0,再根据路由表进行转发。 注:其它的测试如上图所示,均可Ping通。 5、举例R3中的配置 R3gt;enable R3showrun Buildingconfiguration。。。 Currentconfiguration:1081bytes ! version12。4 noservicetimestampslogdatetimemsec noservicetimestampsdebugdatetimemsec noservicepasswordencryption ! hostnameR3 ! ipnameserver0。0。0。0 ! interfaceFastEthernet00 noipaddress duplexauto speedauto ! interfaceFastEthernet00。61 encapsulationdot1Q61 ipaddress202。30。61。1255。255。255。0 ! interfaceFastEthernet00。70 encapsulationdot1Q70 ipaddress202。30。70。1255。255。255。0 ! interfaceFastEthernet00。71 encapsulationdot1Q71 ipaddress202。30。71。1255。255。255。0 ! interfaceFastEthernet01 noipaddress duplexauto speedauto shutdown ! interfaceSerial020 noipaddress shutdown ! interfaceSerial021 noipaddress shutdown ! interfaceSerial030 ipaddress210。0。0。3255。255。255。0 ! interfaceSerial031 ipaddress220。0。0。3255。255。255。0 ! interfaceVlan1 noipaddress shutdown ! routerrip version2 network202。30。61。0 network202。30。70。0 network202。30。71。0 network210。0。0。0 network220。0。0。0 ! ipclassless ! linecon0 linevty04 login ! end S1showrunningconfig Buildingconfiguration。。。 Currentconfiguration:1088bytes ! version12。1 noservicetimestampslogdatetimemsec noservicetimestampsdebugdatetimemsec noservicepasswordencryption ! hostnameS1 ! interfaceFastEthernet01 switchportaccessvlan40 ! interfaceFastEthernet02 switchportaccessvlan50 ! interfaceFastEthernet03 switchportmodetrunk ! interfaceVlan1 noipaddress shutdown ! interfaceVlan40 noipaddress ! interfaceVlan50 noipaddress linecon0 ! linevty04 login linevty515 login ! end 6、总结与心得 本次所做的实验,所运用到的知识均为我们上几个星期所配置过的实验。如RIP、VLAN、子网的划分等等。通过各种路由和交换技术,我们可以组建更为复杂的局域网,本次的实验只是一个简化局域网,但从这次的实验中,我们可以充分的了解到,VLAN技术可以使网段的分配和管理变得更加方便,灵活。 收藏举报11条评论