NAT负载均衡_ftp

本文涉及的产品
传统型负载均衡 CLB,每月750个小时 15LCU
网络型负载均衡 NLB,每月750个小时 15LCU
公网NAT网关,每月750个小时 15CU
简介:
拓扑图:

配置参数:

R2

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

ip nat inside //内网接口

interface FastEthernet2/0

ip nat outside   //外网接口

计算机配置情况:

电脑上有3块网卡:

本地连接-----桥接====>C3

VMware Network Adapter-----桥接====>C1

VirtualBox Host-Only Network-----桥接====>C2

FTP服务器:

C1:
C2:
C3

以太网适配器 本地连接:

 
   连接特定的 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.2FTP服务器上面!

C:\Users\lenovo>ftp 192.168.1.2

连接到 192.168.1.2

220 Microsoft FTP Service

用户(192.168.1.2:(none)): administrator

331 Password required for administrator.

密码:

230 User administrator logged in.

ftp> dir

200 PORT command successful.

150 Opening ASCII mode data connection for /bin/ls.

02-08-13  02:33PM                    ftp1.txt

226 Transfer complete.

ftp: 收到 49 字节,用时 0.00 24.50千字节/秒。

ftp>

 
r2#sh ip na tr

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

r2#

C3(真机)上再次登陆FTP:可以看到自动转换到了10.1.2.3FTP服务器上面!

C:\Users\lenovo>ftp 192.168.1.2

连接到 192.168.1.2
220 Microsoft FTP Service
用户(192.168.1.2:(none)): administrator
331 Password required for administrator.
密码:
230 User administrator logged in.
ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
02-08-13  01:09PM                   24 ftp2.txt

226 Transfer complete.
ftp: 收到 49 字节,用时 0.00 49000.00千字节/秒。

ftp>

 
r2#sh ip na tr

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

r2#

可以看到TPC负载均衡配置成功!

问题:

只有将FTP服务器的外网IP配置成路由器的外网接口才可以测试成功!配置成其它的IP就测试不成功。

下面是各设备的配置文件:

r2#sh run

Building configuration...

 
Current configuration : 1184 bytes

!

version 12.3

service timestamps debug datetime msec

service timestamps log datetime msec

no service password-encryption

!

hostname r2

!

boot-start-marker

boot-end-marker

!

!

memory-size iomem 5

no aaa new-model

ip subnet-zero

!

!

ip cef

!

!

ip ips po max-events 100

no ftp-server write-enable

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

interface Serial0/0

 no ip address

 ip virtual-reassembly

 serial restart-delay 0

!

interface Serial0/1

 no ip address

 shutdown

 serial restart-delay 0

!

interface Serial0/2

 no ip address

 shutdown

 serial restart-delay 0

!

interface Serial0/3

 no ip address

 shutdown

 serial restart-delay 0

!

interface FastEthernet1/0

 ip address 10.1.2.1 255.255.255.0

 ip nat inside

 ip virtual-reassembly

 duplex auto

 speed auto

!

interface FastEthernet2/0

 ip address 192.168.1.2 255.255.255.0

 ip nat outside

 ip virtual-reassembly

 duplex auto

 speed auto

!

ip http server

no ip http secure-server

ip classless

!

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

!

!

control-plane

!

!

!        

!

!

!

!

!

!

line con 0

line aux 0

line vty 0 4

 login

!

!

end

 
r2#

r2# sh ip int b

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     

r2#

r3#sh run

Building configuration...

 
Current configuration : 1342 bytes

!

version 12.3

service timestamps debug datetime msec

service timestamps log datetime msec

no service password-encryption

!

hostname r3

!

boot-start-marker

boot-end-marker

!

!

memory-size iomem 5

no aaa new-model

ip subnet-zero

!

!

ip cef

!

!

ip ips po max-events 100

no ftp-server write-enable

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

interface FastEthernet0/0

 no ip address

!        

interface FastEthernet0/1

 no ip address

!

interface FastEthernet0/2

 no ip address

!

interface FastEthernet0/3

 no ip address

 shutdown

!

interface FastEthernet0/4

 no ip address

 shutdown

!

interface FastEthernet0/5

 no ip address

 shutdown

!

interface FastEthernet0/6

 no ip address

 shutdown

!

interface FastEthernet0/7

 no ip address

 shutdown

!

interface FastEthernet0/8

 no ip address

 shutdown

!

interface FastEthernet0/9

 no ip address

 shutdown

!

interface FastEthernet0/10

 no ip address

 shutdown

!

interface FastEthernet0/11

 no ip address

 shutdown

!

interface FastEthernet0/12

 no ip address

 shutdown

!        

interface FastEthernet0/13

 no ip address

 shutdown

!

interface FastEthernet0/14

 no ip address

 shutdown

!

interface FastEthernet0/15

 no ip address

 shutdown

!

interface Vlan1

 no ip address

 shutdown

!

ip http server

no ip http secure-server

ip classless

!

!

!

!        

!

control-plane

!

!

!

!

!

!

!

!

!

line con 0

line aux 0

line vty 0 4

!

!

end

 
r3#

r3# sh ip int b

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   

r3#







      本文转自810105851 51CTO博客,原文链接:
http://blog.51cto.com/4708948/1133153
,如需转载请自行联系原作者

相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
基于阿里云,构建一个企业web应用上云经典架构,让IT从业者体验企业级架构的实战训练。
相关文章
|
8月前
|
负载均衡 应用服务中间件 Linux
企业实战(13)LVS负载均衡NAT(网络地址转换)模式实战详解(一)
企业实战(13)LVS负载均衡NAT(网络地址转换)模式实战详解(一)
127 0
|
25天前
|
负载均衡 网络协议
NAT模式 LVS负载均衡部署
NAT模式 LVS负载均衡部署
|
9月前
|
存储 负载均衡 应用服务中间件
LVS负载均衡群集——NAT模式实操
LVS负载均衡群集——NAT模式实操
319 0
|
10月前
|
负载均衡 调度
NAT负载均衡
NAT负载均衡
|
运维 数据中心 网络虚拟化
《企业运维之云上网络原理与实践》——第三章 云上网络VPC&EIP&NAT&共享宽带&SLB——云上网络VPC&EIP&NAT&共享带宽&SLB(上)(1)
《企业运维之云上网络原理与实践》——第三章 云上网络VPC&EIP&NAT&共享宽带&SLB——云上网络VPC&EIP&NAT&共享带宽&SLB(上)(1)
322 0
|
弹性计算 运维 安全
《企业运维之云上网络原理与实践》——第三章 云上网络VPC&EIP&NAT&共享宽带&SLB——云上网络VPC&EIP&NAT&共享带宽&SLB(上)(2)
《企业运维之云上网络原理与实践》——第三章 云上网络VPC&EIP&NAT&共享宽带&SLB——云上网络VPC&EIP&NAT&共享带宽&SLB(上)(2)
285 0
|
存储 弹性计算 运维
《企业运维之云上网络原理与实践》——第三章 云上网络VPC&EIP&NAT&共享宽带&SLB——云上网络VPC&EIP&NAT&共享带宽&SLB(下)(1)
《企业运维之云上网络原理与实践》——第三章 云上网络VPC&EIP&NAT&共享宽带&SLB——云上网络VPC&EIP&NAT&共享带宽&SLB(下)(1)
196 0
|
弹性计算 运维 安全
《企业运维之云上网络原理与实践》——第三章 云上网络VPC&EIP&NAT&共享宽带&SLB——云上网络VPC&EIP&NAT&共享带宽&SLB(下)(2)
《企业运维之云上网络原理与实践》——第三章 云上网络VPC&EIP&NAT&共享宽带&SLB——云上网络VPC&EIP&NAT&共享带宽&SLB(下)(2)
163 0
|
1月前
|
负载均衡 算法 应用服务中间件
面试题:Nginx有哪些负载均衡算法?Nginx位于七层网络结构中的哪一层?
字节跳动面试题:Nginx有哪些负载均衡算法?Nginx位于七层网络结构中的哪一层?
66 0
|
1月前
|
负载均衡 应用服务中间件 API
Nginx配置文件详解Nginx负载均衡Nginx静态配置Nginx反向代理
Nginx配置文件详解Nginx负载均衡Nginx静态配置Nginx反向代理
66 4