实验目的:
掌握TCP的负载均衡配置
理解NAT的工作原理
实验环境拓扑图及要求:
要求:
假定有3个服务器10.1.1.1、10.1.1.2和10.1.1.3,使用一个虚拟主机10.1.1.100来代表这个服务器组,要求实现负载均衡来实现服务器的访问。
实验步骤:【必写】
第一步: 设置外部端口IP地址
Int f0/0
Ip add 192.168.1.1 255.255.255.0
No sh
exit
第二步:设置内部端口IP地址
Int f1/0
Ip add 10.1.1.10 255.255.255.0
No sh
exit
第三步:为虚拟主机定义一个标准的IP访问控制列表
Router(config)#access-list 1 permit 10.1.1.100
第四步:给真实主机定义一个NAT地址集
Router(config)#ip nat pool jl 10.1.1.1 10.1.1.3 prefix-length 24 type rotary
第五步:设置访问控制列表和NAT地址集之间的映射
Ip nat inside destination list 1 pool jl
第六步:在内部和外部端口上启用NAT
Int f0/0
Ip nat outside
exit
Int f1/0
Ip nat inside
end
配置命令:(实现全网互通)
RA:
en
conf t
no ip domain-lo
host RA
int f1/0
ip add 10.1.1.10 255.255.255.0
no sh
exit
int f0/0
ip add 192.168.1.1 255.255.255.0
no sh
exit
router rip
network 192.168.1.0
network 10.1.1.0
exit
access-list 1 permit 10.1.1.100
ip nat pool jl 10.1.1.1 10.1.1.3 prefix-length 24 type rotary
ip nat inside destination list 1 pool jl
int f1/0
ip nat inside
exit
int f0/0
ip nat outside
end
-----------------------------------------------------
RB:
en
conf t
no ip domain-lo
host RB
int f0/0
ip add 192.168.1.2 255.255.255.0
no sh
exit
int f1/0
ip add 172.16.1.1 255.255.255.0
no sh
exit
router rip
network 192.168.1.0
network 172.16.1.0
end
--------------------------------------------------------
PC1:
en
conf t
host PC1
no ip routing
no ip domain-lo
int f0/0
ip add 10.1.1.1 255.255.255.0
no sh
exit
ip default-gateway 10.1.1.10
end
---------------------------------------------------------
PC2:
en
conf t
host PC2
no ip routing
no ip domain-lo
int f0/0
ip add 10.1.1.2 255.255.255.0
no sh
exit
ip default-gateway 10.1.1.10
end
---------------------------------------------------------
PC3:
en
conf t
host PC3
no ip routing
no ip domain-lo
int f0/0
ip add 10.1.1.3 255.255.255.0
no sh
exit
ip default-gateway 10.1.1.10
end
---------------------------------------------------------
查看转换列表
转载于:https://blog.51cto.com/jamaser/280702