NAT 实验

NAT 实验

一.实验拓扑图

在这里插入图片描述

实验目的

1.按照图示配置 IP 地址
2.私网 A 通过 R1 接入到互联网,私网 B 通过 R3 接入到互联网
3.私网 A 内部存在 Vlan10 和 Vlan20,通过 R1 上单臂路由访问外部网络
4.私网 A 通过 NAPT 使 Vlan10 和 Vlan20 都能够使用 R1 的公网地址访问互联网
5.私网 B 通过在 R3 上配置 EASY IP 访问互联网

  1. 私网 A 配置 NAT SERVER 把 FTPA 的 FTP 服务发布到公网,使 PCB 可以访问

二.实验步骤

1.按照图示配置 IP 地址(略)
2.私网 A 内部存在 Vlan10 和 Vlan20,通过 R1 上单臂路由访问外部网络
在SWA上配置vlan
[SWA]vlan 10
[SWA-vlan10]port g1/0/1
[SWA-vlan10]vlan 20
[SWA-vlan20]port g1/0/2
[SWA-vlan20]int g1/0/3
[SWA-GigabitEthernet1/0/3]port link-type trunk 
[SWA-GigabitEthernet1/0/3]port trunk permit vlan 10 20
[SWA-GigabitEthernet1/0/3]quit
[SWA]
R1上配置单臂路由
[R1]int g0/0.1
[R1-GigabitEthernet0/0.1]%Jul 14 20:14:04:407 2025 R1 IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet0/0.1 changed to up.
%Jul 14 20:14:04:408 2025 R1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet0/0.1 changed to up.[R1-GigabitEthernet0/0.1]vlan-type dot1q vid 10
[R1-GigabitEthernet0/0.1]%Jul 14 20:14:35:506 2025 R1 IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet0/0.1 changed to down.
%Jul 14 20:14:35:507 2025 R1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet0/0.1 changed to down.
%Jul 14 20:14:35:507 2025 R1 IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet0/0.1 changed to up.
%Jul 14 20:14:35:508 2025 R1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet0/0.1 changed to up.[R1-GigabitEthernet0/0.1]ip address 192.168.1.254 24
[R1-GigabitEthernet0/0.1]int g0/0.2
[R1-GigabitEthernet0/0.2]%Jul 14 20:15:01:367 2025 R1 IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet0/0.2 changed to up.
%Jul 14 20:15:01:368 2025 R1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet0/0.2 changed to up.[R1-GigabitEthernet0/0.2]vlan-type  dot1q vid 20
[R1-GigabitEthernet0/0.2]%Jul 14 20:15:18:631 2025 R1 IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet0/0.2 changed to down.
%Jul 14 20:15:18:632 2025 R1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet0/0.2 changed to down.
%Jul 14 20:15:18:632 2025 R1 IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet0/0.2 changed to up.
%Jul 14 20:15:18:632 2025 R1 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet0/0.2 changed to up.[R1-GigabitEthernet0/0.2]ip address 192.168.2.254 24
[R1-GigabitEthernet0/0.2]
[R1-GigabitEthernet0/0.2]quit
[R1]dis ip int b
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       --                 --           --
GE0/0.1             up       up       192.168.1.254/24   --           --
GE0/0.2             up       up       192.168.2.254/24   --           --
GE0/1               up       up       100.1.1.1/24       --           --
GE0/2               down     down     --                 --           --
GE5/0               down     down     --                 --           --
GE5/1               down     down     --                 --           --
GE6/0               down     down     --                 --           --
GE6/1               down     down     --                 --           --
Ser1/0              down     down     --                 --           --
Ser2/0              down     down     --                 --           --
Ser3/0              down     down     --                 --           --
Ser4/0              down     down     --                 --           --
[R2]dis ip int b
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       100.1.1.2/24       --           --
GE0/1               up       up       100.2.2.2/24       --           --
GE0/2               down     down     --                 --           --
GE5/0               down     down     --                 --           --
GE5/1               down     down     --                 --           --
GE6/0               down     down     --                 --           --
GE6/1               down     down     --                 --           --
Ser1/0              down     down     --                 --           --
Ser2/0              down     down     --                 --           --
Ser3/0              down     down     --                 --           --
Ser4/0              down     down     --                 --           --
[R3]dis ip int b
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       100.2.2.3/24       --           --
GE0/1               up       up       192.168.1.3/24     --           --
GE0/2               down     down     --                 --           --
GE5/0               down     down     --                 --           --
GE5/1               down     down     --                 --           --
GE6/0               down     down     --                 --           --
GE6/1               down     down     --                 --           --
Ser1/0              down     down     --                 --           --
Ser2/0              down     down     --                 --           --
Ser3/0              down     down     --                 --           --
Ser4/0              down     down     --                 --           --
[FTP-A]dis ip int b
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       192.168.1.1/24     --           --
GE0/1               down     down     --                 --           --
GE0/2               down     down     --                 --           --
GE5/0               down     down     --                 --           --
GE5/1               down     down     --                 --           --
GE6/0               down     down     --                 --           --
GE6/1               down     down     --                 --           --
Ser1/0              down     down     --                 --           --
Ser2/0              down     down     --                 --           --
Ser3/0              down     down     --                 --           --
Ser4/0              down     down     --                 --           --
[PC-A]dis ip int b
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       192.168.2.1/24     --           --
GE0/1               down     down     --                 --           --
GE0/2               down     down     --                 --           --
GE5/0               down     down     --                 --           --
GE5/1               down     down     --                 --           --
GE6/0               down     down     --                 --           --
GE6/1               down     down     --                 --           --
Ser1/0              down     down     --                 --           --
Ser2/0              down     down     --                 --           --
Ser3/0              down     down     --                 --           --
Ser4/0              down     down     --                 --           --
[PC-B]dis ip int b
*down: administratively down
(s): spoofing  (l): loopback
Interface           Physical Protocol IP address/Mask    VPN instance Description  
GE0/0               up       up       192.168.1.4/24     --           --
GE0/1               down     down     --                 --           --
GE0/2               down     down     --                 --           --
GE5/0               down     down     --                 --           --
GE5/1               down     down     --                 --           --
GE6/0               down     down     --                 --           --
GE6/1               down     down     --                 --           --
Ser1/0              down     down     --                 --           --
Ser2/0              down     down     --                 --           --
Ser3/0              down     down     --                 --           --
Ser4/0              down     down     --                 --           --
测试PC-A和FTP-A是否能和R1互通
[PC-A]ping 192.168.2.254
Ping 192.168.2.254 (192.168.2.254): 56 data bytes, press CTRL+C to break
56 bytes from 192.168.2.254: icmp_seq=0 ttl=255 time=5.224 ms
56 bytes from 192.168.2.254: icmp_seq=1 ttl=255 time=9.641 ms
56 bytes from 192.168.2.254: icmp_seq=2 ttl=255 time=2.589 ms
56 bytes from 192.168.2.254: icmp_seq=3 ttl=255 time=2.158 ms
56 bytes from 192.168.2.254: icmp_seq=4 ttl=255 time=2.086 ms--- Ping statistics for 192.168.2.254 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 2.086/4.340/9.641/2.891 ms
[PC-A]%Jul 14 20:29:13:266 2025 PC-A PING/6/PING_STATISTICS: Ping statistics for 192.168.2.254: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 2.086/4.340/9.641/2.891 ms.
[FTP-A]ping 192.168.1.254
Ping 192.168.1.254 (192.168.1.254): 56 data bytes, press CTRL+C to break
56 bytes from 192.168.1.254: icmp_seq=0 ttl=255 time=2.710 ms
56 bytes from 192.168.1.254: icmp_seq=1 ttl=255 time=4.101 ms
56 bytes from 192.168.1.254: icmp_seq=2 ttl=255 time=2.409 ms
56 bytes from 192.168.1.254: icmp_seq=3 ttl=255 time=0.970 ms
56 bytes from 192.168.1.254: icmp_seq=4 ttl=255 time=3.003 ms--- Ping statistics for 192.168.1.254 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.970/2.639/4.101/1.011 ms
[FTP-A]%Jul 14 20:29:01:192 2025 FTP-A PING/6/PING_STATISTICS: Ping statistics for 192.168.1.254: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 0.970/2.639/4.101/1.011 ms.
[FTP-A]ping 192.168.2.1
Ping 192.168.2.1 (192.168.2.1): 56 data bytes, press CTRL+C to break
Request time out
Request time out
Request time out
Request time out
Request time out--- Ping statistics for 192.168.2.1 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
[FTP-A]%Jul 14 20:45:58:759 2025 FTP-A PING/6/PING_STATISTICS: Ping statistics for 192.168.2.1: 5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss.

但是我们会发现FTP-A ping PC-A是不通的,因为我们这两台设备上缺少网关

[FTP-A]ip route-static 0.0.0.0 0 192.168.1.254
[FTP-A]dis th
#sysname FTP-A
#system-working-mode standardxbar load-singlepassword-recovery enablelpu-type f-series
#scheduler logfile size 16
#ip route-static 0.0.0.0 0 192.168.1.254
#domain default enable system
#
return
[PC-A]ip route-static 0.0.0.0 0 192.168.2.254
[PC-A]dis th
#sysname PC-A
#system-working-mode standardxbar load-singlepassword-recovery enablelpu-type f-series
#scheduler logfile size 16
#ip route-static 0.0.0.0 0 192.168.2.254
#domain default enable system
#
return
测试效果
[FTP-A]ping 192.168.2.1
Ping 192.168.2.1 (192.168.2.1): 56 data bytes, press CTRL+C to break
56 bytes from 192.168.2.1: icmp_seq=0 ttl=254 time=3.135 ms
56 bytes from 192.168.2.1: icmp_seq=1 ttl=254 time=4.829 ms
56 bytes from 192.168.2.1: icmp_seq=2 ttl=254 time=5.019 ms
56 bytes from 192.168.2.1: icmp_seq=3 ttl=254 time=5.016 ms
56 bytes from 192.168.2.1: icmp_seq=4 ttl=254 time=5.156 ms--- Ping statistics for 192.168.2.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 3.135/4.631/5.156/0.755 ms
[FTP-A]%Jul 14 20:57:29:430 2025 FTP-A PING/6/PING_STATISTICS: Ping statistics for 192.168.2.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 3.135/4.631/5.156/0.755 ms.
[PC-A]ping 192.168.1.1
Ping 192.168.1.1 (192.168.1.1): 56 data bytes, press CTRL+C to break
56 bytes from 192.168.1.1: icmp_seq=0 ttl=254 time=4.138 ms
56 bytes from 192.168.1.1: icmp_seq=1 ttl=254 time=5.219 ms
56 bytes from 192.168.1.1: icmp_seq=2 ttl=254 time=4.126 ms
56 bytes from 192.168.1.1: icmp_seq=3 ttl=254 time=4.564 ms
56 bytes from 192.168.1.1: icmp_seq=4 ttl=254 time=4.192 ms--- Ping statistics for 192.168.1.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 4.126/4.448/5.219/0.418 ms
[PC-A]%Jul 14 20:58:42:261 2025 PC-A PING/6/PING_STATISTICS: Ping statistics for 192.168.1.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 4.126/4.448/5.219/0.418 ms.

现在,私域 A已经全部互通

3.R1 和 R3 上配置默认路由指向公网
[R1]ip route-static 0.0.0.0 0 100.1.1.2
[R3]ip route-static 0.0.0.0 0 100.2.2.2
再次查看效果
[R1]ping 100.1.1.2
Ping 100.1.1.2 (100.1.1.2): 56 data bytes, press CTRL+C to break
56 bytes from 100.1.1.2: icmp_seq=0 ttl=255 time=1.399 ms
56 bytes from 100.1.1.2: icmp_seq=1 ttl=255 time=1.215 ms
56 bytes from 100.1.1.2: icmp_seq=2 ttl=255 time=1.958 ms
56 bytes from 100.1.1.2: icmp_seq=3 ttl=255 time=1.285 ms
56 bytes from 100.1.1.2: icmp_seq=4 ttl=255 time=1.145 ms--- Ping statistics for 100.1.1.2 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.145/1.400/1.958/0.291 ms
[R1]%Jul 14 21:09:56:772 2025 R1 PING/6/PING_STATISTICS: Ping statistics for 100.1.1.2: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.145/1.400/1.958/0.291 ms.[R1]
[R1]ping 100.2.2.3
Ping 100.2.2.3 (100.2.2.3): 56 data bytes, press CTRL+C to break
56 bytes from 100.2.2.3: icmp_seq=0 ttl=254 time=2.265 ms
56 bytes from 100.2.2.3: icmp_seq=1 ttl=254 time=3.000 ms
56 bytes from 100.2.2.3: icmp_seq=2 ttl=254 time=1.827 ms
56 bytes from 100.2.2.3: icmp_seq=3 ttl=254 time=1.757 ms
56 bytes from 100.2.2.3: icmp_seq=4 ttl=254 time=2.346 ms--- Ping statistics for 100.2.2.3 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.757/2.239/3.000/0.446 ms
[R1]%Jul 14 21:13:23:081 2025 R1 PING/6/PING_STATISTICS: Ping statistics for 100.2.2.3: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.757/2.239/3.000/0.446 ms.

R1和R3能通

[FTP-A]ping 100.1.1.1
Ping 100.1.1.1 (100.1.1.1): 56 data bytes, press CTRL+C to break
56 bytes from 100.1.1.1: icmp_seq=0 ttl=255 time=1.228 ms
56 bytes from 100.1.1.1: icmp_seq=1 ttl=255 time=2.460 ms
56 bytes from 100.1.1.1: icmp_seq=2 ttl=255 time=3.195 ms
56 bytes from 100.1.1.1: icmp_seq=3 ttl=255 time=2.988 ms
56 bytes from 100.1.1.1: icmp_seq=4 ttl=255 time=3.005 ms--- Ping statistics for 100.1.1.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.228/2.575/3.195/0.717 ms
[FTP-A]%Jul 14 21:05:06:410 2025 FTP-A PING/6/PING_STATISTICS: Ping statistics for 100.1.1.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.228/2.575/3.195/0.717 ms.[FTP-A]
[FTP-A]
[FTP-A]ping 100.1.1.2
Ping 100.1.1.2 (100.1.1.2): 56 data bytes, press CTRL+C to break
Request time out
Request time out
Request time out
Request time out
Request time out--- Ping statistics for 100.1.1.2 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
[FTP-A]%Jul 14 21:11:35:248 2025 FTP-A PING/6/PING_STATISTICS: Ping statistics for 100.1.1.2: 5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss.

FTP-A能通到R1不能通到R2

[PC-B]ping 192.168.1.3
Ping 192.168.1.3 (192.168.1.3): 56 data bytes, press CTRL+C to break
56 bytes from 192.168.1.3: icmp_seq=0 ttl=255 time=1.007 ms
56 bytes from 192.168.1.3: icmp_seq=1 ttl=255 time=1.457 ms
56 bytes from 192.168.1.3: icmp_seq=2 ttl=255 time=1.316 ms
56 bytes from 192.168.1.3: icmp_seq=3 ttl=255 time=1.588 ms
56 bytes from 192.168.1.3: icmp_seq=4 ttl=255 time=1.359 ms--- Ping statistics for 192.168.1.3 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.007/1.345/1.588/0.193 ms
[PC-B]%Jul 14 21:12:03:771 2025 PC-B PING/6/PING_STATISTICS: Ping statistics for 192.168.1.3: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.007/1.345/1.588/0.193 ms.[PC-B]
[PC-B]ping 100.2.2.2
Ping 100.2.2.2 (100.2.2.2): 56 data bytes, press CTRL+C to break
Request time out
Request time out
Request time out--- Ping statistics for 100.2.2.2 ---
4 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
[PC-B]%Jul 14 21:15:55:413 2025 PC-B PING/6/PING_STATISTICS: Ping statistics for 100.2.2.2: 4 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss.

PC-B能通到R3不能通到R2

[R1]ping 192.168.1.4
Ping 192.168.1.4 (192.168.1.4): 56 data bytes, press CTRL+C to break
Request time out
Request time out
Request time out
Request time out
Request time out--- Ping statistics for 192.168.1.4 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
%Jul 14 21:19:45:794 2025 R1 PING/6/PING_STATISTICS: Ping statistics for 192.168.1.4: 5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss.
[R1]

R1不能通到PC-B,那么证明私域 A 内部能互通,私域 B 内部能互通,公网内部也能互通,但这三个区域不能彼此互通

4.私网 A 通过 NAPT 使 Vlan10 和 Vlan20 都能够使用 R1 的公网地址访问互联网

分析:根据需求得知,ACL 需要配置允许 192.168.1.0/24 和 192.168.2.0/24 网段;私网 A 只有 1 个公网地址可用,意味着创建的 NAT 地址池起始和结束地址就都是 100.1.1.1

(1)R1 上创建基本 ACL,允许 192.168.1.0/24 和 192.168.2.0/24 网段
[R1]acl basic 2000
[R1-acl-ipv4-basic-2000]rule permit  source 192.168.1.0 0.0.0.255
[R1-acl-ipv4-basic-2000]rule permit  source 192.168.2.0 0.0.0.255
[R1-acl-ipv4-basic-2000]dis th
#
acl basic 2000rule 0 permit source 192.168.1.0 0.0.0.255rule 5 permit source 192.168.2.0 0.0.0.255
#
return

ACL是命中条件,命中之后再转给NAT

(2)R1 上创建 NAT 地址池,设置公网地址
[R1]nat address-group 1
[R1-address-group-1]address 100.1.1.1 100.1.1.1
[R1-address-group-1]dis th
#
nat address-group 1address 100.1.1.1 100.1.1.1
#
return
(3)在 R1 的公网接口上配置 NAPT
[R1]int g0/1
[R1-GigabitEthernet0/1]nat outbound 2000 address-group 1
(4)在 PCA 上 Ping R3 的公网地址,测试是否可以访问互联网
[FTP-A]ping 100.1.1.2
Ping 100.1.1.2 (100.1.1.2): 56 data bytes, press CTRL+C to break
56 bytes from 100.1.1.2: icmp_seq=0 ttl=254 time=5.735 ms
56 bytes from 100.1.1.2: icmp_seq=1 ttl=254 time=2.421 ms
56 bytes from 100.1.1.2: icmp_seq=2 ttl=254 time=3.432 ms
56 bytes from 100.1.1.2: icmp_seq=3 ttl=254 time=1.527 ms
56 bytes from 100.1.1.2: icmp_seq=4 ttl=254 time=1.910 ms--- Ping statistics for 100.1.1.2 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.527/3.005/5.735/1.507 ms
[FTP-A]%Jul 14 21:39:17:542 2025 FTP-A PING/6/PING_STATISTICS: Ping statistics for 100.1.1.2: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.527/3.005/5.735/1.507 ms.
5.私网 B 通过在 R3 上配置 EASY IP 访问互联网

分析:根据需求得知,ACL 需要配置允许 192.168.1.0/24 网段;使用 EASY IP,就无需配置 NAT 地址池,直接在公网接口上配置即可,EASY IP 会自动识别公网接口的 IP 地址

(1)R3 上创建基本 ACL,允许 192.168.1.0/24 网段
[R3]acl basic 2000
[R3-acl-ipv4-basic-2000]rule permit  source 192.168.1.0 0.0.0.255
[R3-acl-ipv4-basic-2000]dis th
#
acl basic 2000rule 0 permit source 192.168.1.0 0.0.0.255
#
return
(2)在 R3 的公网接口上配置 EASY IP
[R3]int g0/0
[R3-GigabitEthernet0/0]nat outbound 2000
(3)先确保PC-B有网关(配置静态路由模拟网关)然后在 PCB 上 Ping R1 的公网地址,测试是否可以访问互联网
[PC-B]ip route-static 0.0.0.0 0 192.168.1.3
[PC-B]ping 100.2.2.2
Ping 100.2.2.2 (100.2.2.2): 56 data bytes, press CTRL+C to break
56 bytes from 100.2.2.2: icmp_seq=0 ttl=254 time=2.477 ms
56 bytes from 100.2.2.2: icmp_seq=1 ttl=254 time=1.338 ms
56 bytes from 100.2.2.2: icmp_seq=2 ttl=254 time=1.327 ms
56 bytes from 100.2.2.2: icmp_seq=3 ttl=254 time=2.726 ms
56 bytes from 100.2.2.2: icmp_seq=4 ttl=254 time=1.691 ms--- Ping statistics for 100.2.2.2 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.327/1.912/2.726/0.584 ms
[PC-B]%Jul 14 21:44:00:757 2025 PC-B PING/6/PING_STATISTICS: Ping statistics for 100.2.2.2: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.327/1.912/2.726/0.584 ms.

现在是私域 A 和私域 B 可以与公网互通,但是私域 A 和私域 B 彼此不能互通

6.私网 A 配置 NAT SERVER 把 FTPA 的 FTP 服务发布到公网,使 PCB 可以访问

根据需求得知,需要发布 FTPA 的 FTP 服务,也就是把 R1 的公网地址的 20 和 21 端口映射到 FTPA 的私网地址

(1)在FTP-A配置FTP服务:
[FTP-A]ftp server enable 
[FTP-A]local-user stw class manage 
New local user added.
[FTP-A-luser-manage-stw]password simple 123456.com
[FTP-A-luser-manage-stw]service-type ftp
[FTP-A-luser-manage-stw]authorization-attribute user-role level-15
[FTP-A-luser-manage-stw]quit
(2)在 R1 的公网接口上配置 NAT SERVER,映射端口 20 和 21
[R1]int g0/1
[R1-GigabitEthernet0/1]nat server protocol tcp global current-interface 20 21 in
side 192.168.1.1 20 21
[R1-GigabitEthernet0/1]dis th
#
interface GigabitEthernet0/1port link-mode routecombo enable copperip address 100.1.1.1 255.255.255.0nat outbound 2000 address-group 1nat server protocol tcp global current-interface 20 21 inside 192.168.1.1 20 21
#
return
(3)在 PCB 上测试是否能够通过 R1 的公网地址访问 FTPA 的 FTP 服务
<PC-B>ping 192.168.1.1
Ping 192.168.1.1 (192.168.1.1): 56 data bytes, press CTRL+C to break
Request time out
Request time out
Request time out
Request time out
Request time out--- Ping statistics for 192.168.1.1 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
<PC-B>%Jul 14 22:00:30:541 2025 PC-B PING/6/PING_STATISTICS: Ping statistics for 192.168.1.1: 5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss.<PC-B>
<PC-B>ping 100.1.1.1
Ping 100.1.1.1 (100.1.1.1): 56 data bytes, press CTRL+C to break
56 bytes from 100.1.1.1: icmp_seq=0 ttl=253 time=3.378 ms
56 bytes from 100.1.1.1: icmp_seq=1 ttl=253 time=4.650 ms
56 bytes from 100.1.1.1: icmp_seq=2 ttl=253 time=4.081 ms
56 bytes from 100.1.1.1: icmp_seq=3 ttl=253 time=3.655 ms
56 bytes from 100.1.1.1: icmp_seq=4 ttl=253 time=3.828 ms--- Ping statistics for 100.1.1.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 3.378/3.918/4.650/0.432 ms
<PC-B>%Jul 14 22:00:39:090 2025 PC-B PING/6/PING_STATISTICS: Ping statistics for 100.1.1.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 3.378/3.918/4.650/0.432 ms.<PC-B>
<PC-B>ftp 100.1.1.1
Press CTRL+C to abort.
Connected to 100.1.1.1 (100.1.1.1).
220 FTP service ready.
User (100.1.1.1:(none)): stw
331 Password required for stw.
Password: 
230 User logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> 

不能 ping 通FTP-A但是可以 ping 通R1,说明PC-B的ftp需要在100.1.1.1上获取到

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/web/89263.shtml
繁体地址,请注明出处:http://hk.pswp.cn/web/89263.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

buuctf——web刷题第三页

第三页 目录 [FBCTF2019]RCEService [0CTF 2016]piapiapia [Zer0pts2020]Can you guess it? [WUSTCTF2020]颜值成绩查询 [SUCTF 2019]Pythonginx [MRCTF2020]套娃 [CSCCTF 2019 Qual]FlaskLight [watevrCTF-2019]Cookie Store [WUSTCTF2020]CV Maker [红明谷CTF 202…

前后端分离项目中的接口设计与调用流程——以高仙机器人集成为例

一、背景介绍在前后端分离项目开发中&#xff0c;前端页面需要频繁调用后端接口获取数据。在高仙机器人对接项目中&#xff0c;我们采用了若依&#xff08;RuoYi&#xff09;框架&#xff0c;前端通过统一的 API 封装与后端进行数据交互&#xff0c;而后端再对接高仙官方的 OPE…

【第五节】部署http接口到ubuntu server上的docker内

描述清楚需求&#xff0c;让deepseek帮我们写一个demo&#xff0c;文件结构如下 FLASK_API_001 ├── app.py └── Dockerfile └── requirements.txtapp.pyfrom flask import Flask, jsonify, requestapp Flask(__name__)# 根路由 app.route(/) def home():return "…

在 IntelliJ IDEA 中添加框架支持的解决方案(没有出现Add Framework Support)

在 IntelliJ IDEA 中添加框架支持的解决方案 问题背景 版本变化&#xff1a;在 IntelliJ IDEA 2023.2 及更高版本中&#xff0c;项目右键菜单中的 “Add Framework Support” 选项已被移除。 常见需求&#xff1a;为 Java 项目添加框架支持&#xff08;如 Maven、Spring 等&am…

北京-4年功能测试2年空窗-报培训班学测开-第五十天

咦&#xff0c;昨天路上写一半就到家了&#xff0c;后来想早点睡就忘了还要发了&#xff0c;现在赶紧补上昨天是最后一节课(我们将一整天的课称为一节&#xff09;&#xff0c;这就结课了昨天讲了简历编写&#xff0c;面试要准备的内容&#xff0c;还有redis和docker也没有什么…

华为鸿蒙HarmonyOpenEye项目:开眼App的鸿蒙实现之旅

华为鸿蒙HarmonyOpenEye项目&#xff1a;开眼App的鸿蒙实现之旅 引言 在当今移动应用开发的浪潮中&#xff0c;鸿蒙系统凭借其独特的分布式能力和高效的开发框架&#xff0c;吸引了众多开发者的目光。今天要给大家介绍的是一个基于华为鸿蒙系统开发的开眼App项目——HarmonyO…

代码随想录day36dp4

文章目录1049.最后一块石头的重量II494.目标和474.一和零1049.最后一块石头的重量II 题目链接 文章讲解 class Solution { public:int lastStoneWeightII(vector<int>& stones) {// 1. 确定 DP 数组及下标的含义&#xff1a;// dp[i][j] 表示考虑前 i 块石头&#…

Python 爬虫实战指南:按关键字搜索商品

在电商领域&#xff0c;按关键字搜索商品并获取其详情信息是一项常见的需求。无论是进行市场调研、竞品分析还是用户体验优化&#xff0c;能够快速准确地获取商品信息都至关重要。1688 作为国内领先的 B2B 电商平台&#xff0c;提供了丰富的商品资源。本文将详细介绍如何使用 P…

【源力觉醒 创作者计划】百度AI的开放新篇章:文心4.5本地化部署指南与未来生态战略展望

百度AI的开放新篇章&#xff1a;文心4.5本地化部署指南与未来生态战略展望 一起来玩转文心大模型吧&#x1f449;文心大模型免费下载地址&#xff1a;https://ai.gitcode.com/theme/1939325484087291906 &#x1f31f; 嗨&#xff0c;我是IRpickstars&#xff01; &#x1f30…

测试工作中的质量门禁管理

一、前言 测试阶段的质量门禁设计要考虑几个维度,首先是研发流程的阶段划分,每个阶段都要有明确的准入准出标准;其次要考虑不同测试类型的特点,比如功能测试和性能测试的验收标准肯定不同;最后还要平衡质量要求和项目进度。 在单元测试阶段,可以设置通过率和覆盖率的阈值…

线上分享:解码eVTOL安全基因,构建安全飞行生态

随着城市空中交通&#xff08;UAM&#xff09;快速发展&#xff0c;电动垂直起降飞行器&#xff08;eVTOL&#xff09;面临严格的安全与可靠性要求&#xff0c;需满足全球适航标准及全生命周期分析。安全与可靠的飞行系统成为行业关注的焦点。在此背景下&#xff0c;本期线上分…

C回调函数基础用法

&#x1f4cc; 定义&#xff1a;回调函数是通过函数指针传递给另一个函数的函数&#xff0c;这个被传进去的函数将在某个时刻被“回调”调用。换句话说&#xff1a;你定义一个函数 A把函数 A 的地址&#xff08;即函数指针&#xff09;作为参数传给函数 B函数 B 在合适的时机调…

手撕设计模式之消息推送系统——桥接模式

手撕设计模式之消息推送系统——桥接模式 1.业务需求 ​ 大家好&#xff0c;我是菠菜啊&#xff0c;好久不见&#xff0c;今天给大家带来的是——桥接模式。老规矩&#xff0c;在介绍这期内容前&#xff0c;我们先来看看这样的需求&#xff1a;我们现在要做一个消息推送系统&…

Java 大厂面试题 -- JVM 垃圾回收机制大揭秘:从原理到实战的全维度优化

最近佳作推荐&#xff1a; Java 大厂面试题 – JVM 面试题全解析&#xff1a;横扫大厂面试&#xff08;New&#xff09; Java 大厂面试题 – 从菜鸟到大神&#xff1a;JVM 实战技巧让你收获满满&#xff08;New&#xff09; Java 大厂面试题 – JVM 与云原生的完美融合&#xf…

图机器学习(9)——图正则化算法

图机器学习&#xff08;9&#xff09;——图正则化算法1. 图正则化方法2. 流形正则化与半监督嵌入3. 神经图学习4. Planetoid1. 图正则化方法 浅层嵌入方法已经证明&#xff0c;通过编码数据点间的拓扑关系可以构建更鲁棒的分类器来处理半监督任务。本质上&#xff0c;网络信息…

视频动态范围技术演进:从SDR到HDR的影像革命

一、动态范围技术基础认知 1.1 人眼视觉特性与动态范围 人眼的动态感知范围可达106:1&#xff08;0.0001-105 cd/m&#xff09;&#xff0c;远超传统显示设备能力。视网膜通过虹膜调节&#xff08;物理孔径&#xff09;与光化学反应&#xff08;光敏蛋白分解&#xff09;实现16…

基于LAMP环境的校园论坛项目

1.配置本地仓库a.修改主机名为自己姓名全拼[rootserver ~]# hostnamectl set-hostname jun [rootserver ~]# bash [rootjun ~]# 运行结果图如下图所示&#xff1a;b.光盘挂载到/mnt目录下[rootjun yum.repos.d]# mount /dev/sr0 /mnt mount: /mnt: WARNING: source write-prote…

在物联网系统中时序数据库和关系型数据库如何使用?

在物联网系统中&#xff0c;时序数据库&#xff08;TSDB&#xff09;和关系型数据库&#xff08;RDBMS&#xff09;的存储顺序设计需要根据数据特性、业务需求和系统架构综合考虑。以下是典型的设计方案和逻辑顺序&#xff1a;1. 常见存储顺序方案 方案一&#xff1a;先写时序数…

django安装、跨域、缓存、令牌、路由、中间件等配置

注意&#xff1a;如果是使用 PyCharm 编程工具就不用创建虚拟化&#xff0c;直接打开 PyCharm 选择新建的目录直接调过下面的步骤11. 项目初始化如果不是用 PyCharm 编辑器就需要手动创建虚拟环境在项目目录cmd&#xff0c;自定义名称的虚拟环境# 激活虚拟环境 python -m venv …

时间的弧线,逻辑的航道——标准单元延迟(cell delay)的根与源

时序弧 在这篇文章中&#xff0c;我们将讨论影响标准单元延迟的因素。在开始讨论之前&#xff0c;我们需要先了解一下什么是时序弧 (Timing Arcs)&#xff1a; 时序弧 (Timing Arcs)&#xff1a; 时序弧代表了信号从一个输入流向一个输出的方向。它存在于组合逻辑和时序逻辑中&…