本文共 6733 字,大约阅读时间需要 22 分钟。
ip nat pool 1 10.1.2.2 10.1.2.3 netmask 255.255.255.0 type rotary //内网服务器地址池
ip nat inside destination list 1 pool 1 //目标NAT绑定
access-list 1 permit 192.168.1.2 //路由器外网接口IP地址
interface FastEthernet1/0
interface FastEthernet2/0
VMware Network Adapter-----桥接====>C1
VirtualBox Host-Only Network-----桥接====>C2
连接特定的 DNS 后缀 . . . . . . . : domain
本地链接 IPv6 地址. . . . . . . . : fe80::3836:3343:add:768f%13
IPv4 地址 . . . . . . . . . . . . : 192.168.1.100
子网掩码 . . . . . . . . . . . . : 255.255.255.0
默认网关. . . . . . . . . . . . . : 192.168.1.1
以太网适配器 VirtualBox Host-Only Network:
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : fe80::b5f2:e1a1:e34e:5847%23
IPv4 地址 . . . . . . . . . . . . : 10.1.2.5 ---------->对应虚拟机的C2
子网掩码 . . . . . . . . . . . . : 255.255.255.0
默认网关. . . . . . . . . . . . . : 10.1.2.1
以太网适配器 VMware Network Adapter VMnet1:
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : fe80::896:5b4c:a949:d0e3%30
IPv4 地址 . . . . . . . . . . . . : 10.1.2.4 ---------->对应虚拟机的C1
子网掩码 . . . . . . . . . . . . : 255.255.255.0
默认网关. . . . . . . . . . . . . : 10.1.2.1
在C3(真机)上登陆FTP:可以看到登陆到了10.1.2.2的FTP服务器上面!
C:\Users\lenovo>ftp 192.168.1.2
220 Microsoft FTP Service
用户(192.168.1.2:(none)): administrator
331 Password required for administrator.
230 User administrator logged in.
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
02-08-13 02:33PM 4 ftp1.txt
ftp: 收到 49 字节,用时 0.00秒 24.50千字节/秒。
Pro Inside global Inside local Outside local Outside global
tcp 192.168.1.2:21 10.1.2.2:21 192.168.1.100:54476 192.168.1.100:54476
在C3(真机)上再次登陆FTP:可以看到自动转换到了10.1.2.3的FTP服务器上面!
C:\Users\lenovo>ftp 192.168.1.2
220 Microsoft FTP Service 用户(192.168.1.2:(none)): administrator 331 Password required for administrator. 230 User administrator logged in. 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. 02-08-13 01:09PM 24 ftp2.txt
ftp: 收到 49 字节,用时 0.00秒 49000.00千字节/秒。
Pro Inside global Inside local Outside local Outside global
tcp 192.168.1.2:21 10.1.2.2:21 192.168.1.100:54476 192.168.1.100:54476
tcp 192.168.1.2:20 10.1.2.3:20 192.168.1.100:54484 192.168.1.100:54484
tcp 192.168.1.2:21 10.1.2.3:21 192.168.1.100:54483 192.168.1.100:54483
只有将FTP服务器的外网IP配置成路由器的外网接口才可以测试成功!配置成其它的IP就测试不成功。
Building configuration...
Current configuration : 1184 bytes
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
no ftp-server write-enable
interface FastEthernet1/0
ip address 10.1.2.1 255.255.255.0
interface FastEthernet2/0
ip address 192.168.1.2 255.255.255.0
ip nat pool 1 10.1.2.2 10.1.2.3 netmask 255.255.255.0 type rotary
ip nat inside destination list 1 pool 1
access-list 1 permit 192.168.1.0 0.0.0.255
Interface IP-Address OK? Method Status Protocol
Serial0/0 unassigned YES manual up down
Serial0/1 unassigned YES NVRAM administratively down down
Serial0/2 unassigned YES NVRAM administratively down down
Serial0/3 unassigned YES NVRAM administratively down down
FastEthernet1/0 10.1.2.1 YES NVRAM up up
FastEthernet2/0 192.168.1.2 YES manual up up
Building configuration...
Current configuration : 1342 bytes
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
no ftp-server write-enable
interface FastEthernet0/0
interface FastEthernet0/1
interface FastEthernet0/2
interface FastEthernet0/3
interface FastEthernet0/4
interface FastEthernet0/5
interface FastEthernet0/6
interface FastEthernet0/7
interface FastEthernet0/8
interface FastEthernet0/9
interface FastEthernet0/10
interface FastEthernet0/11
interface FastEthernet0/12
interface FastEthernet0/13
interface FastEthernet0/14
interface FastEthernet0/15
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset up up
FastEthernet0/1 unassigned YES unset up up
FastEthernet0/2 unassigned YES unset up up
FastEthernet0/3 unassigned YES unset administratively down down
FastEthernet0/4 unassigned YES unset administratively down down
FastEthernet0/5 unassigned YES unset administratively down down
FastEthernet0/6 unassigned YES unset administratively down down
FastEthernet0/7 unassigned YES unset administratively down down
FastEthernet0/8 unassigned YES unset administratively down down
FastEthernet0/9 unassigned YES unset administratively down down
FastEthernet0/10 unassigned YES unset administratively down down
FastEthernet0/11 unassigned YES unset administratively down down
FastEthernet0/12 unassigned YES unset administratively down down
FastEthernet0/13 unassigned YES unset administratively down down
FastEthernet0/14 unassigned YES unset administratively down down
FastEthernet0/15 unassigned YES unset administratively down down
Vlan1 unassigned YES unset administratively down down
本文转自810105851 51CTO博客,原文链接: http://blog.51cto.com/4708948/1133153