设为首页 收藏本站
查看: 1220|回复: 0

[经验分享] Cisco Packet Tracer 之 三层交换机使用路由协议实验

[复制链接]

尚未签到

发表于 2018-7-20 09:07:10 | 显示全部楼层 |阅读模式
  实验环境:
DSC0000.jpg

  实验目的:(两间公司之间的VLAN互通)
  1、在B公司里配置三层交换机,把FA0/1 FA0/2  FA0/3 设置为TRUNK端口。
  2、在B公司的三层交换机,创建VTP,并且创建VLAN20  VLAN30  VLAN40 VLAN100,并设置相应的IP地址。
  3、在B公司的三层交换机,创建各VLAN的IP地址池。
  4、在B公司的二层交换机,设置VTP CLIENT。
  5、在B公司里,按图把各个PC加入到相应的VLAN口中,并查看是否可以获取IP地址。
  6、在B公司的三层交换机里启用路由功能IP ROUTING,并测试公司内部各网段是否互通。
  备注:以上步骤A公司的操作省略。
  7、在两间公司的专线端口上关闭交换功能,并设置相应的IP地址。
  8、先测试两公司之间的VLAN是否可互通。
  9、因各VLAN不是直连,所以必须要在各公司的三层交换机添加相应的路由协议。
  10、测试两个网段之间的PC是否可以互通。
  实验步骤:
  1、在B公司里配置三层交换机,把FA0/1 FA0/2  FA0/3 设置为TRUNK端口。
  CoreSWB(config)#int fa0/1
  CoreSWB(config-if)#switchport trunk encapsulation dot1q
  CoreSWB(config-if)#switchport mode trunk
  CoreSWB(config)#int fa0/2
  CoreSWB(config-if)#switchport trunk encapsulation dot1q
  CoreSWB(config-if)#switchport mode trunk
  CoreSWB(config)#int fa0/3
  CoreSWB(config-if)#switchport trunk encapsulation dot1q
  CoreSWB(config-if)#switchport mode trunk
  2、在B公司的三层交换机,创建VTP,并且创建VLAN20  VLAN30  VLAN40 VLAN100,并设置相应的IP地址。
  CoreSWB(vlan)#vtp domain senya
  Changing VTP domain name from NULL to senya
  CoreSWB(vlan)#vtp server
  Device mode already VTP SERVER.
  CoreSWB#conf t
  Enter configuration commands, one per line.  End with CNTL/Z.
  CoreSWB(config)#vlan 20
  CoreSWB(config-vlan)#exit
  CoreSWB(config)#vlan 30
  CoreSWB(config-vlan)#exit
  CoreSWB(config)#vlan 40
  CoreSWB(config-vlan)#exit
  CoreSWB(config)#vlan 100
  CoreSWB(config-vlan)#exit
  CoreSWB(config)#int vlan20
  CoreSWB(config-if)#ip add 192.168.20.1 255.255.255.0
  CoreSWB(config-if)#exit
  CoreSWB(config)#int vlan30
  CoreSWB(config-if)#ip add 192.168.30.1 255.255.255.0
  CoreSWB(config-if)#exit
  CoreSWB(config)#int vlan40
  CoreSWB(config-if)#
  %LINK-5-CHANGED: Interface Vlan40, changed state to up
  %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan40, changed state to up
  CoreSWB(config-if)#ip add 192.168.40.1 255.255.255.0
  CoreSWB(config-if)#exit
  CoreSWB(config-if)#exit
  3、在B公司的三层交换机,创建各VLAN的IP地址池。
  CoreSWB(config)#ip dhcp pool vlan20
  CoreSWB(dhcp-config)#network 192.168.20.0 255.255.255.0
  CoreSWB(dhcp-config)#default-router 192.168.20.1
  CoreSWB(dhcp-config)#exit
  CoreSWB(config)#ip dhcp pool vlan30
  CoreSWB(dhcp-config)#network 192.168.30.0 255.255.255.0
  CoreSWB(dhcp-config)#default-router 192.168.30.1
  CoreSWB(dhcp-config)#exit
  CoreSWB(config)#ip dhcp pool vlan40
  CoreSWB(dhcp-config)#network 192.168.40.0 255.255.255.0
  CoreSWB(dhcp-config)#default-router 192.168.40.1
  CoreSWB(dhcp-config)#exit
  4、在B公司的二层交换机,设置VTP CLIENT。(只显示一个交换机的操作步骤)
  Switch#vlan database
  % Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.
  Switch(vlan)#vtp domain senya
  Domain name already set to senya.
  Switch(vlan)#vtp client
  Setting device to VTP CLIENT mode.
  Switch(vlan)#exit
  APPLY completed.
  Switch#show vlan
  VLAN Name                             Status    Ports
  ---- -------------------------------- --------- -------------------------------
  1    default                          active    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, Fa0/16, Fa0/17
  Fa0/18, Fa0/19, Fa0/20, Fa0/21
  Fa0/22, Fa0/23, Fa0/24
  20   VLAN0020                         active
  30   VLAN0030                         active
  40   VLAN0040                         active
  100  VLAN0100                         active
  1002 fddi-default                     act/unsup
  1003 token-ring-default               act/unsup
  1004 fddinet-default                  act/unsup
  1005 trnet-default                    act/unsup
  VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
  ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
  1    enet  100001     1500  -      -      -        -    -        0      0
  20   enet  100020     1500  -      -      -        -    -        0      0
  5、在B公司里,按图把各个PC加入到相应的VLAN口中,并查看是否可以获取IP地址。(其它交换机操作省略)
  Switch#conf t
  Enter configuration commands, one per line.  End with CNTL/Z.
  Switch(config)#int fa0/2
  Switch(config-if)#switchport mode access
  Switch(config-if)#switchport access vlan 20
DSC0001.jpg

DSC0002.jpg

DSC0003.jpg

  6、在B公司的三层交换机里启用路由功能IP ROUTING,并测试公司内部各网段是否互通。
  在没有IP ROUTING的情况下如下:
DSC0004.jpg

  在三层交换机启用IP ROUTING后,如下:
DSC0005.jpg

  7、在两间公司的专线端口上关闭交换功能,并设置相应的IP地址和测试是否能PING通。
  A公司:
  CoreSW(config)#int fa0/4
  CoreSW(config-if)#no switchport
  CoreSW(config-if)#ip add 192.168.100.1 255.255.255.0
  B公司:
  CoreSWB(config)#int fa0/5
  CoreSWB(config-if)#no switchport
  CoreSWB(config-if)#ip add 192.168.100.2 255.255.255.0
  两公司之间互通:
  CoreSW#PING 192.168.100.2
  Type escape sequence to abort.
  Sending 5, 100-byte ICMP Echos to 192.168.100.2, timeout is 2 seconds:
  !!!!!
  Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms
  8、先测试两公司之间的VLAN是否可互通。
DSC0006.jpg

  CoreSW#show ip route
  Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
  D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
  N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
  E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
  i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
  * - candidate default, U - per-user static route, o - ODR
  P - periodic downloaded static route
  Gateway of last resort is not set
  C    192.168.2.0/24 is directly connected, Vlan2
  C    192.168.3.0/24 is directly connected, Vlan3
  C    192.168.4.0/24 is directly connected, Vlan4
  C    192.168.100.0/24 is directly connected, FastEthernet0/4
  9、因各VLAN不是直连,所以必须要在各公司的三层交换机添加相应的路由协议。
  A公司添加B公司的VLAN网段信息如下:
  CoreSW#conf t
  Enter configuration commands, one per line.  End with CNTL/Z.
  CoreSW(config)#router rip
  CoreSW(config-router)#ver 2
  CoreSW(config-router)#no au
  CoreSW(config-router)#net 192.168.2.0
  CoreSW(config-router)#net 192.168.3.0
  CoreSW(config-router)#net 192.168.4.0
  CoreSW(config-router)#net 192.168.100.0
  B公司添加A公司的VLAN网段信息如下:
  CoreSWB#conf t
  Enter configuration commands, one per line.  End with CNTL/Z.
  CoreSWB(config)#router rip
  CoreSWB(config-router)#ver 2
  CoreSWB(config-router)#no au
  CoreSWB(config-router)#net 192.168.20.0
  CoreSWB(config-router)#net 192.168.30.0
  CoreSWB(config-router)#net 192.168.40.0
  CoreSWB(config-router)#net 192.168.100.0
  RIP协议是把自己本网段的VLAN宣告到别的交换机上。
  A公司三层交换机的路由表情况:
  CoreSW#show ip route
  Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
  D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
  N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
  E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
  i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
  * - candidate default, U - per-user static route, o - ODR
  P - periodic downloaded static route
  Gateway of last resort is not set
  C    192.168.2.0/24 is directly connected, Vlan2
  C    192.168.3.0/24 is directly connected, Vlan3
  C    192.168.4.0/24 is directly connected, Vlan4
  R    192.168.20.0/24 [120/1] via 192.168.100.2, 00:00:25, FastEthernet0/4
  R    192.168.30.0/24 [120/1] via 192.168.100.2, 00:00:25, FastEthernet0/4
  R    192.168.40.0/24 [120/1] via 192.168.100.2, 00:00:25, FastEthernet0/4
  C    192.168.100.0/24 is directly connected, FastEthernet0/4
  B公司的路由表情况如下:
  CoreSWB#
  CoreSWB#show ip route
  Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
  D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
  N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
  E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
  i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
  * - candidate default, U - per-user static route, o - ODR
  P - periodic downloaded static route
  Gateway of last resort is not set
  R    192.168.2.0/24 [120/1] via 192.168.100.1, 00:00:10, FastEthernet0/4
  R    192.168.3.0/24 [120/1] via 192.168.100.1, 00:00:10, FastEthernet0/4
  R    192.168.4.0/24 [120/1] via 192.168.100.1, 00:00:10, FastEthernet0/4
  C    192.168.20.0/24 is directly connected, Vlan20
  C    192.168.30.0/24 is directly connected, Vlan30
  C    192.168.40.0/24 is directly connected, Vlan40
  C    192.168.100.0/24 is directly connected, FastEthernet0/4
  10、测试两个网段之间的PC是否可以互通。
DSC0007.jpg

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-538986-1-1.html 上篇帖子: 关于Cisco 交换机权限等级 华为交换机权限等级 下篇帖子: Cisco Packet Tracer 之 EtherChannel 增加链路带宽和冗余性
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表