NAT负载均衡_ftp
原创
©著作权归作者所有:来自51CTO博客作者810105851的原创作品,请联系作者获取转载授权,否则将追究法律责任
拓扑图:
配置参数:
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.2的FTP服务器上面!
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 4 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.3的FTP服务器上面!
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#
下一篇:网络搭建3
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章