1.静态NAT
2.动态NAT
3.复用内部全局地址的NAT(PAT)

enable
conf t
no ip do lo
enable pass cisco
line con 0
logg sync
exec-t 0 0
line vty 0 4
pass cisco
logg sync
exit
host

1.静态NAT

R2为一个ISP接入路由器,客户端为(R1,R3),ISP分配给客户端一个公网IP地址为12.1.1.1.客户端服务器内网地址为33.1.1.1.
(R1,R3)运行OSPF协议,通过默认路由访问外网。

R1:
int s1/1
ip add 13.1.1.1 255.255.255.0
no shut
exit
int s1/0
ip add 12.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 11.1.1.1
network 13.1.1.0 0.0.0.255 area 0
default-info originate
exit
ip route 0.0.0.0 0.0.0.0 12.1.1.2

R3:
int s1/1
ip add 13.1.1.3 255.255.255.0
no shut
exit
int l0
ip add 33.1.1.1 255.255.255.0
no shut
exit

router ospf 1
router-id 33.1.1.1
network 13.1.1.0 0.0.0.255 area 0
network 33.1.1.0 0.0.0.255 area 0
exit

R2:
int s1/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit

ip route 0.0.0.0 0.0.0.0 12.1.1.1

R1:
ip nat inside source static 33.1.1.1 12.1.1.1
int s1/1
ip nat inside
exit
int s1/0
ip nat outside

debug ip nat

R3:
ping 22.1.1.1 source 33.1.1.1

2.动态NAT
不能用一个本地全局地址访问内部特定地址,因为每次分配的本地全局地址可能不同。
仿真客户从ISP处申请了10个公网IP(12.1.1.1-10/24)

R1:
ip nat pool WBSN 12.1.1.1 12.1.1.10 netmask 255.255.255.0
access-list 1 permit 33.1.1.1 0.0.0.255
ip nat inside source list 1 pool WBSN

int s1/1
ip nat inside
exit
int s1/0
ip nat outside

R3:
int l0
ip add 33.1.1.2 255.255.255.0 secondary
ip add 33.1.1.3 255.255.255.0 secondary
ip add 33.1.1.4 255.255.255.0 secondary
ip add 33.1.1.5 255.255.255.0 secondary
exit

ping 22.1.1.1 source 33.1.1.1
ping 22.1.1.1 source 33.1.1.2
ping 22.1.1.1 source 33.1.1.3
ping 22.1.1.1 source 33.1.1.4
ping 22.1.1.1 source 33.1.1.5

R1:
show ip nat translations
show ip nat translations verbose

3.复用内部全局地址的NAT(PAT)
当多个本地地址映射到同一个全局地址的时候,用端口号来区别不同的本地地址。

R1:
ip nat pool WBSN 12.1.1.1 12.1.1.1 netmask 255.255.255.0
access-list 1 permit 33.1.1.1 0.0.0.255
ip nat inside source list 1 pool WBSN overload

int s1/1
ip nat inside
exit
int s1/0
ip nat outside

R3:
int l0
ip add 33.1.1.2 255.255.255.0 secondary
ip add 33.1.1.3 255.255.255.0 secondary
ip add 33.1.1.4 255.255.255.0 secondary
ip add 33.1.1.5 255.255.255.0 secondary
exit

ping 22.1.1.1 source 33.1.1.1
ping 22.1.1.1 source 33.1.1.2
ping 22.1.1.1 source 33.1.1.3
ping 22.1.1.1 source 33.1.1.4
ping 22.1.1.1 source 33.1.1.5

R1:
show ip nat translations
show ip nat translations verbose

CCNP交换实验(7) -- NAT的更多相关文章

  1. CCNP交换实验(5) -- 网关热备冗余

    HSRP:1.启用HSRP功能,并设置虚拟地址IP, 1为standby的组号.2.相同组号的路由器属于同一个HSRP组,所有属于同一个HSRP组的路由器的虚拟地址必须一致.3.HSRP的优先级默认为 ...

  2. CCNP路由实验之十五 NAT(网络地址转换)

     CCNP路由实验之十五 NAT(网络地址转换) 众所周知,要让自己的电脑连上Internet,必须要到运营商(ISP)申请一个上网账号,依据此账号申请自己的宽频业务(拨号上网.商业固定IP等等) ...

  3. CCNP路由实验之八 路由重公布

     CCNP路由实验之八 路由重公布 在前面几个实验,已经学习了静态路由和动态路由.如今,我们要掌握怎样使它们在一个网络中融合,即路由重公布. 使用出站口作为静态路由 0 使用下一跳地址作为静态路由 ...

  4. CCNP路由实验之六 动态路由协议之IS-IS

     CCNP路由实验之六动态路由协议之IS-IS 动态路由协议能够自己主动的发现远程网络.仅仅要网络拓扑结构发生了变化.路由器就会相互交换路由信息,不仅能够自己主动获知新添加的网络.还能够在当前网络 ...

  5. CCNP路由实验之十 组播(多播)

                        CCNP路由实验之十 组播(多播) 种方法: 在交换机上配置静态的多播MAC地址到用户接口的映射 使用CGMP.执行CGMP的多播路由器能够将用户发送给自己 ...

  6. CCNP路由实验之七 动态路由之BGP

     CCNP路由实验之七 动态路由之BGP 动态路由协议能够自己主动的发现远程网络,仅仅要网络拓扑结构发生了变化,路由器就会相互交换路由信息,不仅能够自己主动获知新添加的网络,还能够在当前网络连接失 ...

  7. CCNP路由实验之九 路由策略

     CCNP路由实验之九 路由策略 路由器在公布与接收路由信息时,可能须要实施一些策略.以便对路由信息进行过滤,比如仅仅接收或公布满足一定条件的路由信息. 一种路由协议可能须要引入其它的路由协议发现 ...

  8. CCNP路由实验之十二 MPLS

     个.第3个数据包„„同样的操作.包含查询路由表.重写MAC地址,CRC校验等. 系列路由器.或者12000系列路由器. Netflow switching 通过一种标准的交换机制,处理了流的第一 ...

  9. 华为eNSP路由交换实验-生成树之RSTP

    RSTP基础配置 实验拓扑图 实验步骤 1.基本配置 根据实验编址表进行相应的基本IP配置. 2.配置RSTP基本功能. (1)把生成树模式由默认的MSTP(华为交换机默认开启)改为RSTP. [FW ...

随机推荐

  1. hdu1698 Just a Hook 线段树:成段替换,总区间求和

    转载请注明出处:http://blog.csdn.net/u012860063 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1698 Problem ...

  2. HDU 3060 多边形面积并

    Area2 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Subm ...

  3. redis研究记录

    1 redis安装 wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-st ...

  4. BZOJ 1742: [Usaco2005 nov]Grazing on the Run 边跑边吃草( dp )

    dp... dp( l , r , k )  , 表示 吃了[ l , r ] 的草 , k = 1 表示最后在 r 处 , k = 0 表示最后在 l 处 . ------------------- ...

  5. Oracle修改字段长度以及计算天数

    sql修改字段长度的语法: alter table 表名 modify 字段名 字段类型; sql修改字段长度的示例代码 alter table qtline modify qtl_bidernote ...

  6. SqlServer字段说明查询(表基本信息查询)

    --快速查看表结构(比较全面的) THEN obj.name ELSE '' END AS 表名, col.colorder AS 序号 , col.name AS 列名 , ISNULL(ep.[v ...

  7. SQL Server 基础 04 函数与分组查询数据

    函数与分组查询数据 系统函数分 聚合函数.数据类型转换函数.日期函数.数学函数 . . . 1. 聚合函数 主要是对一组值进行计算,然后返回一个值. 聚合函数包括 sum(求和).avg(求平均值). ...

  8. Python 第五篇(下):系统标准模块(shutil、logging、shelve、configparser、subprocess、xml、yaml、自定义模块)

    目录: shutil logging模块 shelve configparser subprocess xml处理 yaml处理 自定义模块 一,系统标准模块: 1.shutil:是一种高层次的文件操 ...

  9. Python 第一篇:python简介和入门

    一.python简介 1.python下载地址:https://www.python.org/downloads/ Python的创始人为Guido van Rossum.1989年圣诞节期间,在阿姆 ...

  10. js open() 与showModalDialog()方法

    此方法可通用,项目开发中经常要用到: //w:宽,h:高,url:地址,tag:标记 function showWin(w, h, url, tag) { var t = (screen.height ...