【工具】GNS3

article/2025/9/28 10:47:38
  • 参考
    1. CCIE 工程师社区 - https://ccie.lol/blog/2016/07/01/gns3-iou-installation-guide/
    2. 皮皮的小car
      1. GNS3介绍及基础环境搭建 - https://www.bilibili.com/video/BV1Vq4y1v7kL/
    3. _sev_June
      1. GNS3完整安装系列① 相关软件准备 - https://www.bilibili.com/video/BV1H7411m7R9/
      2. GNS3完整安装系列② GNS3VM的导入 - https://www.bilibili.com/video/BV1H7411m7ub/
      3. GNS3完整安装系列③ 镜像的导入及使用 - https://www.bilibili.com/video/BV1H7411m7Lv/
    4. Sam小哥哥的奇妙冒险
      1. GNS3-下载安装和首次启动 - https://www.bilibili.com/video/BV1bS4y117Cr/
      2. GNS3-IOS镜像下载和导入(手工) - https://www.bilibili.com/video/BV1894y1Z7tA/
      3. GNS3-IOS镜像下载和导入(自动) - https://www.bilibili.com/video/BV1s44y1V7LZ/
      4. GNS3-基础命令行 - https://www.bilibili.com/video/BV1oF411u7FQ/
    5. GNS3安装和使用教程 - https://blog.csdn.net/zhangpeterx/article/details/86407065, https://github.com/last2win/gns3-intro (大学实验指导,一堆坑只能当面跟你说的那种)

在这里插入图片描述 在这里插入图片描述

GNS3是一款具有图形化界面可以运行在多平台(windows、linux、macos)的网络虚拟软件。GNS3可以用于虚拟体验Cisco真实的IOS或者是检验将要在真实的路由器上部署实施的相关配置。

GNS能力:

  1. 和wireshark配合进行抓包实验
  2. 与虚拟机或本地机器桥接或将多台机器进行桥接,搭建大型实验环境
  3. 除了模拟IOS外,还支持模拟ASA,甚至模拟N9kv等

💡早期的模拟器

  1. Dynamips(小凡模拟器)
  2. packet tracer
  3. BOSON NETSIM

文章目录

      • 安装GNS3
      • 导入GNS3VM(虚拟镜像Server)
        • # 添加gns3-vm服务(自动)
        • # 添加gns3-vm服务(手工)
      • 导入IOS/IOU
        • # 添加路由器3660模板(手工)
        • # 添加交换机3660模板(手工)
        • # 添加路由器3745模板(自动)
      • 基础命令行
        • # 权限
        • # 查看设备信息(show)
        • # 配置模式(config)
        • # do命令
        • # 查看MAC地址表
        • # 查看ARP缓存表
        • # 查看route路由表
        • # 案例
          • 路由器配置
          • 交换机的配置
          • 连通测试

安装GNS3

💡相关软件的介绍

  • 客户端 ── gns3-all-in-one https://gns3.com/software/download
  • 抓包(数据包捕获程序) ── npcap https://npcap.com/ 💡使用教程 todo

通过gns3-all-in-one安装“客户端”(desktop)、npcap。一路下一步既可。
在这里插入图片描述

💡这里选NO
在这里插入图片描述

💡先不打开GNS3(有关于GNS3VM的初始化向导设置),先完成GNS3 VM设置

导入GNS3VM(虚拟镜像Server)

💡相关软件的介绍

  • vm ── gns3-vm https://gns3.com/software/download-vm
  • 虚拟机 ── vmware

GNS3 VM是一个专门用于网络虚拟化的操作系统的虚拟机镜像。

# 添加gns3-vm服务(自动)

  1. 安装vmware
  2. 将gns3-vm拖入vmware既可

在这里插入图片描述
在这里插入图片描述

  1. 开机(默认nat)
    在这里插入图片描述
    在这里插入图片描述

  2. 打开GNS3,进入“设置向导”
    在这里插入图片描述

    1. 选择在虚拟机上运行
      在这里插入图片描述
    2. (默认)本地服务配置
      在这里插入图片描述
    3. ⚠️设置GNS3 VM。这里选中在VMware中设置号的GNS3 VM
      在这里插入图片描述
      💡设置好后,可以在edit》preferences中查看
      在这里插入图片描述

设置好后,GNS3 VM就会跟随GNS3启动、停止

# 添加gns3-vm服务(手工)

也可以把vm当作server进行连接

  1. 在gun3 desktop中添加server
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
  2. 添加成功后可以在summary中看到
    在这里插入图片描述

导入IOS/IOU

💡 IOS和IOU的区别

  • IOS ── Internetwork Operating System(互联网操作系统)是思科公司为其网络设备开发的操作维护系统。
    用户通过命令运行人机界面对网络设备进行功能设置,提供的功能大致为以下几点:
    1. 网络设备及连接端口的功能首选项设置
    2. 运行网络协议与网络功能设备之间数据传输安全管理设置
  • IOU ── IOS on Unix,思科官方基于 Linux(debian) 的 IOS 操作系统,可以模拟真实交换机和路由器操作系统,一般学习交换技术或者 CCIE LAB 会用到。

💡IOS下载

  • IOS下载备份仓库 https://ccie.lol/blog/2016/07/03/cisco-ios-image-download/

  • 【官方】3660版本对比 - https://www.cisco.com/c/en/us/td/docs/ios/12_2/12_2x/12_2xa/release/notes/rn3600xa.html?dtid=osscdc000283
    建议下载老版本,如:cisco 3660 IOS jo9o3s-mz (体积小、效率高、运行速度快、能满足一般实验需求)

    Feature解释
    Enterprise企业所需基础功能
    FW防火墙
    IDS PlusIDS增强型
    IPSec 3DESVPN

    💡但是我看论坛上分享的都是c3660-a3jk9s-mz,那就用这个呗

    在这里插入图片描述

# 添加路由器3660模板(手工)

手工导入 Preference》Dynamips》IOS routers》Run this IOS router on the GNS3 VM

(💡网络设备运行在GNS3VM上会效率更高、更加稳定。这也是为啥要安装GNS3VM的原因)

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

选择插槽插入的模块。通常实验中路由器至少保持4个物理接口

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

将路由器启动后,就可以进入路由器后台

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

# 添加交换机3660模板(手工)

用默认的交换机模板有各种问题,因此我们用路由器模拟交换机

在这里插入图片描述

步骤和添加交换机模板一样。不同的是需要在设置平台的时候勾选“This is an EtherSwitch router”,把路由器当作交换机使用

在这里插入图片描述

在插槽中可以看到,已经自动添加了16口以太网交换机模块

在这里插入图片描述

在这里插入图片描述

# 添加路由器3745模板(自动)

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

如果提示没有镜像,可以到这里下载https://ccie.lol/blog/2016/07/03/cisco-ios-image-download/

在这里插入图片描述

(如果没有默认模板镜像文件)或者可以导入一个新模板

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

名字可以右键在“Configure template”中修改

在这里插入图片描述

基础命令行

# 权限

# ── root权限
> ── 普通用户,通过“enable”命令提升权限

💡在控制台中,任何命令都可以使用前缀简写,e.g. interface可简写为int(前提是前缀唯一)

# 查看设备信息(show)

show xx xxe.g. R1#show ip interface
FastEthernet0/0 is administratively down, line protocol is downInternet protocol processing disabled
FastEthernet0/1 is administratively down, line protocol is downInternet protocol processing disabled
FastEthernet1/0 is administratively down, line protocol is downInternet protocol processing disabled
FastEthernet2/0 is administratively down, line protocol is downInternet protocol processing disabledR1#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  administratively down down
FastEthernet0/1            unassigned      YES unset  administratively down down
FastEthernet1/0            unassigned      YES unset  administratively down down
FastEthernet2/0            unassigned      YES unset  administratively down down

# 配置模式(config)

# 进入配置模式
configure terminal
# 进入配置模式(简写)
conf t
# 退出
exit
end# 进入接口(interface)配置
# R1 ── 设备名
# config ── 配置模式
# # ── 标识root权限,这个符号后的才是命令
# interface ── 
R1(config)#interface fastEthernet 0/0

# do命令

# 使命令在特权模式下运行
do <命令>e.g.# 在config模式下,使用#特权模式的命令
R1(config)#show ip int^
% Invalid input detected at '^' marker.R1(config)#do show ip int
FastEthernet0/0 is administratively down, line protocol is downInternet protocol processing disabled
FastEthernet0/1 is administratively down, line protocol is downInternet protocol processing disabled
FastEthernet1/0 is administratively down, line protocol is downInternet protocol processing disabled
FastEthernet2/0 is administratively down, line protocol is downInternet protocol processing disabled

# 查看MAC地址表

💡 Linux 路由表(RIB表、FIB表)、ARP表、MAC表整理 - https://zhuanlan.zhihu.com/p/415032187

查看mac表 (数据链路层、单位=数据帧)

💡mac表在交换机上

show mace.g.# 💡cisco交换机
ESW1#show mac
Destination Address  Address Type  VLAN  Destination Port
-------------------  ------------  ----  --------------------
cc02.7fd7.0000          Self          1     Vlan1
cc01.754c.0000          Dynamic      12     FastEthernet1/10
cc01.754c.0001          Dynamic      13     FastEthernet1/11
cc05.803b.0000          Dynamic      12     FastEthernet1/12
cc04.061f.f100          Dynamic       1     FastEthernet1/2
cc04.061f.f101          Dynamic       1     FastEthernet1/3
cc04.061f.f102          Dynamic       1     FastEthernet1/0
cc04.061f.f103          Dynamic       1     FastEthernet1/0解释
vlan ── 区分不同主机到不同群组
address ── mac地址
dynamic ── 非静态配置,是数据帧进来时动态配置的
port ── 数据帧进来时的端口

# 查看ARP缓存表

💡arp cache表在路由器、终端(pc)上

# 💡cisco路由器
show arpe.g.R1#show arp
Protocol  Address          Age (min)  Hardware Addr   Type   Interface
Internet  13.13.13.1              -   cc01.754c.0001  ARPA   FastEthernet0/1
Internet  12.12.12.1              -   cc01.754c.0000  ARPA   FastEthernet0/0
Internet  13.13.13.3            167   cc06.805b.0000  ARPA   FastEthernet0/1
Internet  12.12.12.2            168   cc05.803b.0000  ARPA   FastEthernet0/0
R1## 💡windows
C:\Users\lawsssscat>arp -a接口: 169.254.82.62 --- 0x5Internet 地址         物理地址              类型169.254.255.255       ff-ff-ff-ff-ff-ff     静态224.0.0.22            01-00-5e-00-00-16     静态224.0.0.251           01-00-5e-00-00-fb     静态224.0.0.252           01-00-5e-00-00-fc     静态239.255.255.250       01-00-5e-7f-ff-fa     静态255.255.255.255       ff-ff-ff-ff-ff-ff     静态接口: 192.168.206.1 --- 0xcInternet 地址         物理地址              类型192.168.206.254       00-50-56-e4-a8-27     动态192.168.206.255       ff-ff-ff-ff-ff-ff     静态224.0.0.22            01-00-5e-00-00-16     静态224.0.0.251           01-00-5e-00-00-fb     静态224.0.0.252           01-00-5e-00-00-fc     静态239.255.255.250       01-00-5e-7f-ff-fa     静态255.255.255.255       ff-ff-ff-ff-ff-ff     静态接口: 192.168.1.130 --- 0x16Internet 地址         物理地址              类型192.168.1.21          01-e0-61-9b-01-92     动态192.168.1.24          88-c3-22-45-31-3c     动态192.168.1.61          90-09-44-64-81-63     动态192.168.1.110         e8-a0-cd-3c-98-68     动态192.168.1.186         04-ed-33-e8-b4-67     动态192.168.1.255         ff-ff-ff-ff-ff-ff     静态224.0.0.22            01-00-5e-00-00-16     静态224.0.0.251           01-00-5e-00-00-fb     静态224.0.0.252           01-00-5e-00-00-fc     静态239.255.255.250       01-00-5e-7f-ff-fa     静态255.255.255.255       ff-ff-ff-ff-ff-ff     静态# 💡ubuntu
$ arp
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.1.130            ether   04:ed:33:e8:b4:67   C                     ens33
192.168.1.2              ether   88:c3:97:45:59:3c   C                     ens33
smartdns                 ether   00:e0:66:9b:34:92   C                     ens33
$ arp -a
? (192.168.1.130) at 04:ed:33:e8:b4:67 [ether] on ens33
? (192.168.1.2) at 88:c3:97:45:59:3c [ether] on ens33
smartdns (192.168.1.1) at 00:e0:66:9b:34:92 [ether] on ens33

# 查看route路由表

在这里插入图片描述

# 💡cisco路由器
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2ia - IS-IS inter area, * - candidate default, U - per-user static routeo - ODR, P - periodic downloaded static routeGateway of last resort is not set1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback012.0.0.0/24 is subnetted, 1 subnets
C       12.12.12.0 is directly connected, FastEthernet0/013.0.0.0/24 is subnetted, 1 subnets
C       13.13.13.0 is directly connected, FastEthernet0/1# openwrt路由器
$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         172.10.3.4      0.0.0.0         UG    0      0        0 pppoe-wan
172.10.3.4      *               255.255.255.255 UH    0      0        0 pppoe-wan
192.168.1.0     *               255.255.255.0   U     0      0        0 br-lan

# 案例

R1、R2、R3分别以三种形式连接

在这里插入图片描述

💡做链路捆绑,所以交换机上一个方向接两跳线

💡交换机用路由器模拟的,0号模块是路由模块,1号没模块才是交换机模块,所有交换机从1号模块开始连接

路由器配置

配置R1

# ============================ 初始状态R1#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  administratively down down
FastEthernet0/1            unassigned      YES unset  administratively down down
FastEthernet1/0            unassigned      YES unset  administratively down down
FastEthernet2/0            unassigned      YES unset  administratively down down# ============================ 配置回环地址 lo0: 1.1.1.1/32R1#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#interface loopback 0
R1(config-if)#
*Mar  1 00:07:02.683: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R1(config-if)#do ip interface brief
ip interface brief^
% Invalid input detected at '^' marker.R1(config-if)#do show  ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  administratively down down
FastEthernet0/1            unassigned      YES unset  administratively down down
FastEthernet1/0            unassigned      YES unset  administratively down down
FastEthernet2/0            unassigned      YES unset  administratively down down
Loopback0                  unassigned      YES unset  up                    up  
R1(config-if)#ip address 1.1.1.1 255.255.255.255
R1(config-if)#exit
R1(config)#do show ip int br
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  administratively down down
FastEthernet0/1            unassigned      YES unset  administratively down down
FastEthernet1/0            unassigned      YES unset  administratively down down
FastEthernet2/0            unassigned      YES unset  administratively down down
Loopback0                  1.1.1.1         YES manual up                    up  
R1(config)#do ping ip 1.1.1.1Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms# ============================ 配置 f0/0: 12.12.12.1/24R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 12.12.12.1 255.255.255.0
R1(config-if)#do show ip int br
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            12.12.12.1      YES manual administratively down down ⚠️ip有了,但状态还是down
FastEthernet0/1            unassigned      YES unset  administratively down down
FastEthernet1/0            unassigned      YES unset  administratively down down
FastEthernet2/0            unassigned      YES unset  administratively down down
Loopback0                  1.1.1.1         YES manual up                    up  
R1(config-if)#no shutdown
R1(config-if)#
*Mar  1 00:42:36.803: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:42:37.803: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#do show ip int br
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            12.12.12.1      YES manual up                    up  
FastEthernet0/1            unassigned      YES unset  administratively down down
FastEthernet1/0            unassigned      YES unset  administratively down down
FastEthernet2/0            unassigned      YES unset  administratively down down
Loopback0                  1.1.1.1         YES manual up                    up  # ============================ 配置 f0/1: 13.13.13.1/24R1(config-if)#int f0/1
R1(config-if)#ip add 13.13.13.1 255.255.255.0
R1(config-if)#no shutdown
*Mar  1 00:44:27.867: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:44:28.867: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#do show ip int br
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            12.12.12.1      YES manual up                    up  
FastEthernet0/1            13.13.13.1      YES manual up                    up  
FastEthernet1/0            unassigned      YES unset  administratively down down
FastEthernet2/0            unassigned      YES unset  administratively down down
Loopback0                  1.1.1.1         YES manual up                    up  # ============================ 检查配置R1(config-if)#exit
R1(config)#exit
R1#
*Mar  1 00:47:28.835: %SYS-5-CONFIG_I: Configured from console by console
R1#sh running-config | ?append    Append redirected output to URL (URLs supporting append operationonly)begin     Begin with the line that matchesexclude   Exclude lines that matchinclude   Include lines that matchredirect  Redirect output to URLsection   Filter a section of outputtee       Copy output to URL
R1#sh running-config | section FastE
interface FastEthernet0/0ip address 12.12.12.1 255.255.255.0duplex autospeed auto
interface FastEthernet0/1ip address 13.13.13.1 255.255.255.0duplex autospeed auto
interface FastEthernet1/0no ip addressshutdownduplex autospeed auto
interface FastEthernet2/0no ip addressshutdownduplex autospeed auto
R1#sh running-config | section Loop
interface Loopback0ip address 1.1.1.1 255.255.255.255# ============================ ⚠️写入配置R1#write
Building configuration...
[OK]
R1#

同理,配置R2、R3

R2

conf t
int lo0
ip add 2.2.2.2 255.255.255.255
int f0/0
ip add 12.12.12.2 255.255.255.0
no shut
int f0/1
ip add 23.23.23.2 255.255.255.0
no shut
end
wr

R2

conf t
int lo0
ip add 2.2.2.2 255.255.255.255
int f0/0
ip add 12.12.12.2 255.255.255.0
no shut
int f0/1
ip add 23.23.23.2 255.255.255.0
no shut
end
wr

R3

💡 R3比较特殊,有两个子接口(子接口用“.”标识)。而且是模拟trunk的口,所以要告诉这个子接口匹配什么样的802.1q的vlan标签,所以要指定一个encapsulation(封装)命令

R3#show ip interface  brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  administratively down down
FastEthernet0/1            unassigned      YES unset  administratively down down
FastEthernet1/0            unassigned      YES unset  administratively down down
FastEthernet2/0            unassigned      YES unset  administratively down down
R3#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.# ======================== 配置 f0/0.13R3(config)#interface fastEthernet 0/0.13
R3(config-subif)#?
Interface configuration commands:
...encapsulation   Set encapsulation type for an interface
...
R3(config-subif)#encapsulation ?dot1Q  IEEE 802.1Q Virtual LANisl    Inter Switch Link - Virtual LAN encapsulation
R3(config-subif)#do show ip inter brie
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  administratively down down
FastEthernet0/0.13         unassigned      YES unset  administratively down down
FastEthernet0/1            unassigned      YES unset  administratively down down
FastEthernet1/0            unassigned      YES unset  administratively down down
FastEthernet2/0            unassigned      YES unset  administratively down down
R3(config-subif)#ip add 13.13.13.3 255.255.255.0
R3(config-subif)#do show ip inter brie
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  administratively down down
FastEthernet0/0.13         13.13.13.3      YES manual administratively down down
FastEthernet0/1            unassigned      YES unset  administratively down down
FastEthernet1/0            unassigned      YES unset  administratively down down
FastEthernet2/0            unassigned      YES unset  administratively down down
R3(config-subif)#no shutdown ⚠️在只接口上开启接口是不生效的,需要到主接口上开启
R3(config-subif)#do show ip inter brie
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  administratively down down
FastEthernet0/0.13         13.13.13.3      YES manual administratively down down
FastEthernet0/1            unassigned      YES unset  administratively down down
FastEthernet1/0            unassigned      YES unset  administratively down down
FastEthernet2/0            unassigned      YES unset  administratively down down# ======================== 配置 f0/0.23int f0/0.23
encapsulation dot1Q 23
no shutdown
ip add 23.23.23.3 255.255.255.0# ======================== 开启接口 f0/0R3(config-subif)#int f0/0
R3(config-if)#no shut
R3(config-if)#do show ip inter brie
*Mar  1 04:00:07.739: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 04:00:08.739: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R3(config-if)#do show ip inter brie
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  up                    up
FastEthernet0/0.13         13.13.13.3      YES manual up                    up
FastEthernet0/0.23         23.23.23.3      YES manual up                    up
FastEthernet0/1            unassigned      YES unset  administratively down down
FastEthernet1/0            unassigned      YES unset  administratively down down
FastEthernet2/0            unassigned      YES unset  administratively down down# ======================== 开启回环接口R3(config-if)#int lo0
R3(config-if)#
*Mar  1 04:01:58.294: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R3(config-if)#ip  add 3.3.3.3 255.255.255.255# ======================== 写出
R3#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  up                    up
FastEthernet0/0.13         13.13.13.3      YES manual up                    up
FastEthernet0/0.23         23.23.23.3      YES manual up                    up
FastEthernet0/1            unassigned      YES unset  administratively down down
FastEthernet1/0            unassigned      YES unset  administratively down down
FastEthernet2/0            unassigned      YES unset  administratively down down
Loopback0                  3.3.3.3         YES manual up                    up
R3#write
Building configuration...
[OK]
交换机的配置
  • 三个交换机之间是互联的
  • 它们之间用trunk连接
  • 每个交换机都有若干个接口和路由器对接

💡我们知道,GNS3的交换机是用路由器上的交换机模块模拟出来的,所以其配置和标准的交换机略微不同

首先,我们在设备中将vlan创建

SW1

# ========================= 设置vlanESW1#vlan database
ESW1(vlan)#vlan 12
VLAN 12 added:Name: VLAN0012
ESW1(vlan)#vlan 13
VLAN 13 added:Name: VLAN0013
ESW1(vlan)#vlan 23
VLAN 23 added:Name: VLAN0023
ESW1(vlan)#exit
APPLY completed.
Exiting....
ESW1## ========================= 设置vlan连接ESW1#configure t
Enter configuration commands, one per line.  End with CNTL/Z.
ESW1(config)#int f1/10
ESW1(config-if)#switchport access vlan 12
ESW1(config-if)#int f1/11
ESW1(config-if)#switchport access vlan 13
ESW1(config-if)#int f1/12
ESW1(config-if)#switchport access vlan 12# ========================= 查看修改的配置ESW1(config-if)#do sh run interface f1/10
Building configuration...Current configuration : 85 bytes
!
interface FastEthernet1/10switchport access vlan 12duplex fullspeed 100
end⚠️上面命令等于“sh running-config | section 1/10”,但是更快
ESW1(config-if)#do sh running-config | section 1/10
interface FastEthernet1/10switchport access vlan 12duplex fullspeed 100# ========================= 设置其他连线为trunkESW1(config-if)#do sh run int f1/0
Building configuration...Current configuration : 57 bytes
!
interface FastEthernet1/0duplex fullspeed 100
endESW1(config-if)#int f1/0
ESW1(config-if)#switchport mode trunk
ESW1(config-if)#do sh run int f1/0
Building configuration...Current configuration : 80 bytes
!
interface FastEthernet1/0switchport mode trunkduplex fullspeed 100
end# ==== 批量设置ESW1(config-if)#int range f1/1 - 3
ESW1(config-if-range)#switchport mode trunk
ESW1(config-if-range)#
*Mar  1 04:43:44.334: %DTP-5-TRUNKPORTON: Port Fa1/1 has become dot1q trunk
*Mar  1 04:45:03.118: %DTP-5-TRUNKPORTON: Port Fa1/2 has become dot1q trunk# ========================= 查看vlan配置情况
ESW1#show vlan-switchVLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/4, Fa1/5, Fa1/6, Fa1/7Fa1/8, Fa1/9, Fa1/13, Fa1/14Fa1/15
12   VLAN0012                         active    Fa1/10, Fa1/12
13   VLAN0013                         active    Fa1/11
23   VLAN0023                         active
1002 fddi-default                     active
1003 token-ring-default               active
1004 fddinet-default                  active
1005 trnet-default                    activeVLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        1002   1003
12   enet  100012     1500  -      -      -        -    -        0      0
13   enet  100013     1500  -      -      -        -    -        0      0
23   enet  100023     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0
1005 trnet 101005     1500  -      -      1        ibm  -        0      0# ========================= 查看trunk配置情况ESW1#show interfaces trunkPort      Mode         Encapsulation  Status        Native vlan
Fa1/0     on           802.1q         trunking      1
Fa1/1     on           802.1q         trunking      1
Fa1/2     on           802.1q         trunking      1
Fa1/3     on           802.1q         trunking      1Port      Vlans allowed on trunk
Fa1/0     1-1005
Fa1/1     1-1005
Fa1/2     1-1005
Fa1/3     1-1005Port      Vlans allowed and active in management domain
Fa1/0     1,12-13,23
Fa1/1     1,12-13,23
Fa1/2     1,12-13,23
Fa1/3     1,12-13,23Port      Vlans in spanning tree forwarding state and not pruned
Fa1/0     1,12-13,23
Fa1/1     1,12-13,23
Fa1/2     1,12-13,23
Fa1/3     1,12-13,23ESW2#write
Building configuration...
[OK]

SW2

vlan database
vlan 12
vlan 13
vlan 23
exitconfigure t
int f1/12
switchport access vlan 23
int f1/13
switchport mode trunkint range f1/0 - 3
switchport mode trunk
end
write

SW3

int range f1/0 - 3
switchport mode trunk
end
write
连通测试

路由器、交换机都配置好了,就应该可以ping通了

R1#ping ip 12.12.12.2Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.12.12.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 16/28/40 msR1#ping ip 13.13.13.3Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 13.13.13.3, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 12/35/88 ms
R2#ping ip 23.23.23.3Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.23.23.3, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 12/19/24 ms

http://chatgpt.dhexx.cn/article/icx7X48c.shtml

相关文章

GNS3(1.下载与安装)

1.1下载GNS3 在浏览器输入https://gns3.com&#xff0c;点击免费下载链接&#xff0c;如果没有在GNS3网站上注册&#xff0c;先创建一个帐户&#xff0c;然后点击创建帐户并继续&#xff0c;然后选择下载版本。 1.2安装GNS3 双击GNS3-2.1.4-all-in-one.exe 文件运行&#xf…

gns3 1.4.0b3 gns3vm使用笔记

1. 更改eth0的IP为静态 默认eth0是仅主机模式,用来做IOU/VM/QEMU/VPCS等的server&#xff0c;默认为DHCP模式&#xff0c;为了使用方便需要更改为和自己本机VMNET1同网段的静态地址。(eth1为nat模式&#xff0c;dhcp模式,连接外网升级用&#xff0c;不用改。) 1. 用箭头或者…

GNS3快捷安装指南

点赞后看&#xff0c;养成习惯 喜欢的话 可以点个关注哟 你们的点赞支持对博主们来说很重要哦 &#xff01;&#xff01;&#xff01; 为方便您的阅读&#xff0c;可戳下方蓝字&#xff0c;快速跳转 00 前情提要01 文件说明02 安装步骤1.虚拟机安装GNS3 VM2.本机安装GNS3软件3…

GNS3使用简介

文章目录 GNS3打开GNS3配置通用设置IOS routers设置 GNS3打开 配置完成后进入主界面。 GNS3配置 通用设置 通过点击Edit->Preferences打开设置界面。 如上图&#xff0c;为通用设置&#xff0c;My projects和My binary images分别是我的工程和路由IOS的默认保存路径。 C…

gns3使用简要教程(gns3-wireshark捕获教程)

1.安装 可以去官网去下载&#xff1a;官网 也可以去&#xff1a;CSDN下载链接 安装的过程中附加选项可以都选&#xff0c;会安装wireshark&#xff0c;solarwinds等等&#xff0c;如果已经安装&#xff0c;可以根据提示取消。 2.安装ios 安装完抽后&#xff0c;打开软件会出…

手把手教你安装GNS3

一、为什么安装GNS3 简单说来它是dynamips的一个图形前端&#xff0c;相比直接使用dynamips这样的虚拟软件要更容易上手和更具有可操作性。更重要的一点是很多Cisco实验在cisco packet tracer上无法实现或完成的实验在GNS3上可以很好的完成。 二、安装环境 1.系统版本&#…

GNS3安装图文教程

GNS3安装步骤 首先各位应该都有已经下载好的GNS3文件吧如图&#xff0c;双击图中红框标记的文件就行&#xff0c;之后会出现一系列的傻瓜式安装步骤&#xff0c;一直点击下一步安装就行。注意&#xff01;到这一步的时候&#xff0c;别全选勾&#xff01;&#xff01;&#xf…

手把手带你安装GNS3。我的天,太详细了!

目录&#xff1a; 1.安装GNS3软件 2.安装GNS3工具 3.安装IOS路由器镜像 4.调整Idle值&#xff0c;降低CPU使用率 5.安装CRT和破解 6.GNS软件设置 7.CRT文字设置 ---------------------------------------------------------------------------------------------------…

最新版GNS3安装详解,小白也可以独立完成哦!!

一、准备工作 请各位提前安装好CRT和Wireshark软件以及GNS3所要使用到的镜像文件&#xff0c;GNS3支持虚拟机模式&#xff0c;所以在安装GNS3前&#xff0c;请确保你的电脑上安装了虚拟机软件VMware&#xff0c;推荐安装VMware workstation 16.2.4。 安装GNS3虚拟机 VMware安…

组播域GNS3与eNSP桥接以及GNS3的使用教程

文章目录 一、拓扑二、使用SecureCRT登录eNSP里的设备三、使用SecureCRT登录GNS3里的设备四、GNS3的使用教程五、组播域GNS3与eNSP桥接 一、拓扑 二、使用SecureCRT登录eNSP里的设备 使用SecureCRT登录eNSP模拟器里的设备 选中设备–>单击鼠标右键–>设置–>查看串口…

转载:GNS3安装和使用教程

文章目录 使用 GNS3 软件模拟 IOS 指南 一、 准备工作二、 GNS3 虚拟机安装三、 GNS3 软件安装四、 首次运行初始化五、 主界面介绍六、 添加设备八、 配置设备九、 连接设备十、 设置合适的 Idle-PC 值十二、 增加网络云十三、 保存配置十四、 二层交换机十五、 用路由器模拟…

GNS3 使用

查MAC地址表 搭建环境 使用路由器替代交换机 PC1 2 3 分别连接 fastEthernet 1/0 1/1 1/2 初始化 配置路由器 配置PC1 PC2 PC3 启动项目后&#xff0c;配置一下3个PC的ip&#xff0c;分别为192.168.1.10、192.168.1.20、192.168.1.30 操作 查看R1的mac 地址表&#xff0…

学习GNS3的使用

学习GNS3的使用 了解GNS3的使用方法&#xff0c;能够用GN3建立和模拟网络模型&#xff0c;并且将GNS3关联wireshark&#xff0c;进行抓包。 选项区 这些按钮&#xff0c;比如 是用来创建、打开工程用的&#xff1b; 用来显示连接端口&#xff1b; 用来打开所有设备的con…

GNS3使用详解

转载自&#xff1a; &#xfeff;&#xfeff; http://huaxin.blog.51cto.com/903026/475784 今天我们来讲解下gns3的详细使用方法&#xff0c;gns3是思科的一款模拟器软件&#xff0c;他是基于真实的思科ios来模拟的&#xff0c;所以从这个角度来讲他就是一台真实的思科设备&…

GNS3安装及实验中应用

GNS3安装及实验中应用 一、简介&#xff1a; GNS在网络实验中会经常用到&#xff0c;例如两个虚拟机&#xff0c;一个在VMnet1&#xff0c;一个在VMnet2&#xff0c;正常来说这两个主机是ping不通的&#xff0c;但是你在GNS中给两个主机间连接一个路由器&#xff0c;并对路由器…

GNS3新手安装教程

GNS3 IOU模拟器的配置【超详细&#xff01;&#xff01;&#xff01;】 版本GNS3 2.1.8&#xff08;附带免费软件及配套工具&#xff09; 1、首先下载GNS3&#xff0c;下载完成后按软件指引进行安装。 2、安装并运行对应的虚拟机文件 3、将虚拟机连接上GNS3上 首先点击左上角…

网络工具之GNS3安装及使用

一、GNS3简介 GNS3是一款具有图形化界面可以运行在多平台&#xff08;包括Windows, Linux, and MacOS等&#xff09;的网络虚拟软件。Cisco网络设备管理员或是想要通过CCNA,CCNP,CCIE等Cisco认证考试的相关人士可以通过它来完成相关的实验模拟操作。同时它也可以用于虚拟体验Ci…

GNS3安装教程

最近在学习CCNA&#xff0c;自己也试着搭建一个开发环境。这里简单记录一下安装过程。 官网&#xff0c;注册登录一下 先下载虚拟机的ova文件&#xff0c;没有虚拟机的下一个VMware Workstation&#xff0c;接着按蓝色的Download&#xff0c;选择下载windows版本 安装GN…

GNS3安装过程(详细)

GNS3安装过程&#xff08;详细&#xff09; 安装准备&#xff1a;GNS3安装包&#xff0c;CRT安装包&#xff0c;Wireshak安装包 安装包可自行百度下载 一&#xff1a;GNS3安装 这里我们用的是思科模拟器&#xff1a; 1.首先&#xff0c;需要需要软件包&#xff0c;这边我们用…

GNS3最新版安装教程

GNS3最新版安装教程 最新版2.2.18 一、GNS3最新版下载 进入GNS3官网下载最新版软件安装包程序。下载之前要先注册账号登录。 如下&#xff0c;点击windows下载&#xff0c;同时点击网页下端 download the GNS3 VM 下载好俩个安装文件 二、GNS3 VMware虚拟机安装 将下载的…