利用 Cisco Packet Tracer 进行组网实验 1

安装和汉化

  1. 下载安装包官网下载地址:Cisco Packet Tracer
  2. 安装
  3. 汉化

Network Knowledge

这个思科的模拟器,我制作了相关汉化
Cisco-Packet-Tracer-Chinese

遵循项目中的 README.md 进行操作即可。

组建对等网

  • 画出基本的网络拓扑,然后进行配置。

    放置一台 2950-24 交换机,两台 PT-PC
    使用铜直通线连接交换机和电脑

  • 在配置页面配置 PC IP 地址

    分别为192.168.2.1/192.168.2.2/192.168.2.3

  • ping 测试

    在 PC1 中 ping PC2 和 PC3,查看是否能够通信

常见思科交换机命令:

1
2
3
4
enable # 进入特权模式
config -t # 进入全局配置模式 -t 表示进入特定模式
int f0/1 # 进入接口配置模式
exit # 退出当前模式

跨交换机VLAN通信

  • 画出基本的网络拓扑,然后进行配置。

    放置2台 2950-24 交换机,4台 PT-PC
    PC1PC2 连接到 Switch0PC3PC4 连接到 Switch1
    PCSwitch 之间使用铜直通线连接
    Switch 之间使用交叉线连接

  • 配置 PCIP 地址

    PC0192.168.2.1
    PC1192.168.3.1
    PC2192.168.2.2
    PC3192.168.3.2

  • ping 测试

    PC0 中 ping PC1PC2,查看是否能够通信

  • 配置 VLAN

    两台交换机分别配置 VLAN,并将 PC 分配到不同的 VLAN

    1
    2
    3
    4
    5
    enable
    config -t
    int f0/1
    switchport mode access # 设置端口模式为访问模式
    switchport access vlan 10 # 设置端口所属的 VLAN
    1
    2
    3
    int f0/2
    switchport mode access
    switchport access vlan 20
  • 配置 Trunk 端口

    两台交换机之间的连接端口配置为 Trunk 端口

    1
    2
    int f0/3
    switchport mode trunk

    有没有配置成功可以在图形界面上查看端口

  • ping 测试

    PC0 中 ping PC2,查看是否能够通信在 PC1 中 ping PC3,查看是否能够通信

  • 模拟测试

    PC0 中使用 ping 命令,在模拟器中查看数据包的传输过程(仅查看 ICMP 以提升效率)

trunk 端口是用来连接两台交换机的,可以传输多个 VLAN 的数据,而 access 端口只能传输一个 VLAN 的数据。

路由器和网关

  • 画出基本的网络拓扑,然后进行配置。

    放置1台 1841-Router,2台 PT-PC
    PC0PC1 使用铜交叉线连接到 Router

  • 配置 RouterIP 地址

    FastEthernet0/0 为 192.168.2.1
    FastEthernet0/1 为 192.168.3.1

  • 配置 PCIP 地址

    PC0192.168.2.2
    PC1192.168.3.2

  • 配置 PC 的 网关

    PC0 的网关为 192.168.2.1
    PC1 的网关为 192.168.3.1

  • ping 测试在 PC0 中 ping PC1,查看是否能够通信

路由器是用来连接不同网络的设备,可以实现不同网络之间的通信。网关(Gateway)是用来连接不同网络的设备,可以实现不同网络之间的通信。

单臂路由

  • 画出基本的网络拓扑,然后进行配置。

    放置一台 2950-24 交换机,两台 PT-PC
    使用铜直通线连接交换机和电脑

    PC0 连接到 Switch0f0/1 端口
    PC1 连接到 Switch0f0/2 端口
    Switch0f0/3 端口连接到 Router0f0/0 端口

  • 配置 PCIP 地址

    PC0: 192.168.1.1/24 网关 192.168.1.2
    PC1: 192.168.2.1/24 网关 192.168.2.2

  • 交换机划分 VLAN

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    enable
    config -t
    vlan 10
    name vlan10
    exit
    vlan 20
    name vlan20
    exit
    int f0/1
    switchport mode access
    switchport access vlan 10
    exit
    int f0/2
    switchport mode access
    switchport access vlan 20
    exit
    int f0/3
    switchport mode trunk
  • 配置路由

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    enable
    config -t
    int f0/0
    no shutdown
    exit
    int f0/0.1
    encapsulation dot1Q 10
    ip address 192.168.1.2 255.255.255.0
    exit
    int f0/0.2
    encapsulation dot1Q 20
    ip address 192.168.2.2 255.255.255.0
    exit
    ip routing
    show ip route
  • 模拟模式中使用 IMCP 协议进行 ping 测试

    PC0 ping
    PC1 ping

  • 实体环境中测试

多层交换机路由

  • 画出基本的网络拓扑,然后进行配置。

    放置两台 PT-PC,1台 3560-24PS 多层交换机使用铜直通线连接交换机和电脑

    PC0 连接到 MultilayerSwitch0f0/1 端口
    PC1 连接到 MultilayerSwitch0f0/2 端口

  • 配置 PCIP 地址

    PC0: 192.168.1.1/24 网关 192.168.1.2
    PC1: 192.168.2.1/24 网关 192.168.2.2

  • MultilayerSwitch0 配置

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    enable
    config -t
    int f0/1
    no switchport
    ip address 192.168.1.2 255.255.255.0
    exit
    int f0/2
    no switchport
    ip address 192.168.2.2 255.255.255.0
    exit
    ip routing
    exit
    show ip route
  • 模拟模式中使用 IMCP 协议进行 ping 测试

    PC0 ping
    PC1 ping

  • 实体环境中测试

静态NAT配置

  • 画出基本的网络拓扑,然后进行配置。

    放置一台 1841 路由器,3台 PT-PC,1台 2950-24 交换机使用铜交叉线连接 Router0PC0
    使用铜直通线连接 Switch0PC1, PC2

    PC0 连接到 Router0f0/0 端口
    PC1 连接到 Switch0f0/2 端口
    PC1 连接到 Switch0f0/3 端口
    Switch0f0/1 端口连接到 Router0f0/1 端口

  • 配置 PCIP 地址

    PC0: 20.20.20.1 网关 20.20.20.2
    PC1: 192.168.2.1 网关 192.168.2.2
    PC2: 192.168.3.1 网关 192.168.3.2

  • 交换机划分 VLAN

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    enable
    config -t
    vlan 10
    name vlan10
    exit
    vlan 20
    name vlan20
    exit
    int f0/1
    switchport mode trunk
    int f0/2
    switchport mode access
    switchport access vlan 10
    int f0/3
    switchport mode access
    switchport access vlan 20
    exit
  • 配置路由

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    enable
    config -t
    int f0/0
    ip address 20.20.20.2
    no shutdown
    exit
    int f0/1
    no shutdown
    exit
    int f0/1.1
    encapsulation dot1Q 10
    ip address 192.168.2.2 255.255.255.0
    exit
    int f0/1.2
    encapsulation dot1Q 20
    ip address 192.168.3.2 255.255.255.0
    exit
    ip routing
  • 在路由器配置静态NAT

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    int f0/0
    ip nat outside
    exit
    int f0/1
    ip nat inside
    exit
    ip nat inside source static 192.168.2.1 20.20.20.3
    ip nat inside source static 192.168.3.1 20.20.20.4
    exit
    show ip nat translations
  • 测试

    在内网任意一台 PC 上 ping 外网 PC0

注意事项1

  1. 交换机的 Trunk 端口用于连接两台交换机,可以传输多个 VLAN 的数据。

  2. 交换机的 Access 端口用于连接 PC,只能传输一个 VLAN 的数据。

  3. 通常,路由器的端口默认是关闭的,需要手动打开。

  4. 静态路由是在路由器上手动配置的路由,用于指定到达目的网络的下一跳地址。

  5. NAT 配置时,inside 表示内网,outside 表示外网

  6. 配置 NAT 时,insideIP 地址是内网 IP 地址,outsideIP 地址是外网 IP 地址