实验拓扑
拓扑分析
Access交换机配置直接可以当作二层交换机,只需要划分vlan10、vlan20两个vlan即可。
SW2 g0/0/22 不需要配IP地址,配置成trunk类型。并且创建vlan10 vlan20 ,分别给这两个vlan配置虚接口IP:Vlanif10 192.168.10.254 24,Vlanif20 192.168.20.254 24
SW2 g0/0/24 不需要配IP地址,只能把G0/0/24加入到vlan99,vlan99配置IP地址接口类型Access,同样需要给vlan99配置虚接口:Vlanif99 192.168.99.1,用于和路由器(R1)的g0/0/0通讯。
配置步骤
PC配置IP、子掩码、网关
SW1上二层交换机上划分VLAN,并把相应的PC接口加入
SW1、SW2之间的两个端口配置Trunk
SW2上面配置创建VLAN10/20/99,配置VTP,并把24口加入到vlan99,最后加一条静态路由指向网关。
R1配置接口信息,添加静态路由
R2配置接口信息,添加静态路由
SW1 Access接入交换机配置
Access交换机我们可以当他是二层交换机
Thedeviceisrunning!sys Entersystemview,returnuserviewwithCtrl+Z. [Huawei]sysAccess [Access]undoinfo-centerenable#关闭消息提示,这个很烦人 Info:Informationcenterisdisabled. [Access]vlanbatch1020 Info:Thisoperationmaytakeafewseconds.Pleasewaitforamoment...done. [Access]intg0/0/1 [Access-GigabitEthernet0/0/1] [Access-GigabitEthernet0/0/1]portlink-typeaccess [Access-GigabitEthernet0/0/1]portdefaultvlan10 [Access-GigabitEthernet0/0/1]intg0/0/2 [Access-GigabitEthernet0/0/2]portlink-typeaccess [Access-GigabitEthernet0/0/2]portdefaultvlan20 [Access-GigabitEthernet0/0/2]q [Access]intg0/0/22 [Access-GigabitEthernet0/0/22]portlink-typetrunk#配置22为trunk [Access-GigabitEthernet0/0/22]porttrunkallow-passvlan1020#允许vlan10和20通过 [Access-GigabitEthernet0/0/22]q [Access]Userinterfacecon0isavailable
SW2三层交换机的配置
Thedeviceisrunning!sys Entersystemview,returnuserviewwithCtrl+Z. [Huawei]syssw2 [sw2] [sw2]undoinfo-centerenable#关闭消息提示 Info:Informationcenterisdisabled. [sw2] [sw2]vlanbatch1020 Info:Thisoperationmaytakeafewseconds.Pleasewaitforamoment...done. [sw2]intg0/0/22 [sw2-GigabitEthernet0/0/22]portlink-typetrunk [sw2-GigabitEthernet0/0/22]porttrallvlan1020 [sw2-GigabitEthernet0/0/22]porttrunkallow-passvlan1020 [sw2-GigabitEthernet0/0/22]q [sw2]interfaceVlanif10#进入vlan10 [sw2-Vlanif10]ipadd192.168.10.25424#给vlan10虚接口配置IP192.168.10.254 [sw2-Vlanif10]q [sw2]interfaceVlanif20 [sw2-Vlanif20]ipadd192.168.20.25424#给vlan20虚接口配置IP192.168.20.254 [sw2-Vlanif20]q [sw2]vlan99#创建vlan99 [sw2-vlan99]q [sw2]intg0/0/24 [sw2-GigabitEthernet0/0/24]portlink-typeaccess#g0/0/24需要配成access 来源:网络威廉希尔官方网站 干货圈 [sw2-GigabitEthernet0/0/24]portdefaultvlan99#g0/0/24加入vlan99 [sw2-GigabitEthernet0/0/24]q [sw2]interfaceVlanif99 [sw2-Vlanif99]ipadd192.168.99.124#给Vlan99虚接口配置IP192.168.99.1 [sw2-Vlanif99]q [sw2]iproute-static0.0.0.00.0.0.0192.168.99.2#加入静态路由只想网关 PleasePressENTER.
R1路由器配置
Thedeviceisrunning!sys Entersystemview,returnuserviewwithCtrl+Z. [Huawei]sysR1 [R1]undoinfo-centerenable Info:Informationcenterisdisabled. [R1]intg0/0/0 [R1-GigabitEthernet0/0/0]ipadd192.168.99.224 [R1-GigabitEthernet0/0/0]q [R1]iproute-static192.168.10.024192.168.99.1#加入静态路由 [R1]iproute-static192.168.20.024192.168.99.1#加入静态路由 [R1]iproute-static192.168.30.02410.10.30.2#加入静态路由 [R1]displayiprouting-table#查看路由表 RouteFlags:R-relay,D-downloadtofib ------------------------------------------------------------------------------ RoutingTables:Public Destinations:13Routes:13 Destination/MaskProtoPreCostFlagsNextHopInterface 10.10.30.0/24Direct00D10.10.30.1GigabitEthernet0/0/1 10.10.30.1/32Direct00D127.0.0.1GigabitEthernet0/0/1 10.10.30.255/32Direct00D127.0.0.1GigabitEthernet0/0/1 127.0.0.0/8Direct00D127.0.0.1InLoopBack0 127.0.0.1/32Direct00D127.0.0.1InLoopBack0 127.255.255.255/32Direct00D127.0.0.1InLoopBack0 `192.168.10.0/24`Static600RD192.168.99.1GigabitEthernet0/0/0 `192.168.20.0/24`Static600RD192.168.99.1GigabitEthernet0/0/0 `192.168.30.0/24`Static600RD10.10.30.2GigabitEthernet0/0/1 #上面这3条是我们加的 192.168.99.0/24Direct00D192.168.99.2GigabitEthernet0/0/0 192.168.99.2/32Direct00D127.0.0.1GigabitEthernet0/0/0 192.168.99.255/32Direct00D127.0.0.1GigabitEthernet0/0/0 255.255.255.255/32Direct00D127.0.0.1InLoopBack0 [R1]
R2路由器配置
sys Entersystemview,returnuserviewwithCtrl+Z. [Huawei]sysR2 [R2] [R2]intg0/0/0 [R2-GigabitEthernet0/0/0]ipadd10.10.30.224 [R2-GigabitEthernet0/0/0]q [R2]iproute-static0.0.0.00.0.0.010.10.30.1 [R2] [R2]intg0/0/1 [R2-GigabitEthernet0/0/1]ipadd192.168.30.25424 [R2-GigabitEthernet0/0/1]
验证结果
用PC1ping PC3
PC>ping192.168.30.1 Ping192.168.30.1:32databytes,PressCtrl_Ctobreak Requesttimeout! From192.168.30.1:bytes=32seq=2ttl=125time=63ms From192.168.30.1:bytes=32seq=3ttl=125time=47ms From192.168.30.1:bytes=32seq=4ttl=125time=62ms From192.168.30.1:bytes=32seq=5ttl=125time=47ms ---192.168.30.1pingstatistics--- 5packet(s)transmitted 4packet(s)received 20.00%packetloss round-tripmin/avg/max=0/54/63ms
用PC2ping PC3
PC>ping192.168.30.1 Ping192.168.30.1:32databytes,PressCtrl_Ctobreak From192.168.30.1:bytes=32seq=1ttl=125time=62ms From192.168.30.1:bytes=32seq=2ttl=125time=47ms From192.168.30.1:bytes=32seq=3ttl=125time=62ms From192.168.30.1:bytes=32seq=4ttl=125time=47ms From192.168.30.1:bytes=32seq=5ttl=125time=63ms ---192.168.30.1pingstatistics--- 5packet(s)transmitted 5packet(s)received 0.00%packetloss round-tripmin/avg/max=47/56/63ms PC>
审核编辑:刘清
-
交换机
+关注
关注
21文章
2639浏览量
99593 -
路由器
+关注
关注
22文章
3729浏览量
113747 -
VLAN威廉希尔官方网站
+关注
关注
0文章
45浏览量
6380 -
VTP
+关注
关注
0文章
4浏览量
2296
原文标题:华为路由器:通过三层交换机实现全网互通及访问外网
文章出处:【微信号:网络威廉希尔官方网站 干货圈,微信公众号:网络威廉希尔官方网站 干货圈】欢迎添加关注!文章转载请注明出处。
发布评论请先 登录
相关推荐
评论