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. 典型c库函数的实现

    StrToInt:字符串转int输出 enum Status { kValid = , kInvalid = , }; int StrToInt(const char* str) { g_nStatu ...

  2. 非root不能gdb attach的限制

    Could not attach to process.  If your uid matches the uid of the targetprocess, check the setting of ...

  3. BZOJ 1648: [Usaco2006 Dec]Cow Picnic 奶牛野餐( dfs )

    直接从每个奶牛所在的farm dfs , 然后算一下.. ----------------------------------------------------------------------- ...

  4. hdu 1284 关于钱币兑换的一系列问题 九度oj 题目1408:吃豆机器人

    钱币兑换问题 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Sub ...

  5. Group DataList

    一,效果图. 二,源代码. <!DOCTYPE html><html><head> <meta charset="UTF-8"> & ...

  6. js 易错点

    如下代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...

  7. 关于VerilogHDL生成的锁存器

    总是会遇到有写文档中提到,不要生成锁存器.问题是 一: 什么叫锁存器 二 : 为什么不要生成锁存器 三 : 如何避免生成锁存器 好,现在就这三个问题,一一做出解答 一  什么叫锁存器 锁存器(Latc ...

  8. Hibernate JPA 中配置Ehcache二级缓存

    在Hibernate3 JPA里配置了一下非分布式环境的二级缓存,效果不错.具体过程如下: 1, 需要引入的jar包 http://ehcache.org/downloads/catalog 下载的包 ...

  9. Poj 2777 Count Color(线段树基础)

    又毁三观了.......虽然题目数据有坑:区间[a,b]可能会有a>b的情况,但是我一开始没有考虑它也能过. 此外莫名其妙的TLE #include <iostream> #incl ...

  10. java 异常 之 实战篇(trows 和 try catch Dead Code)

    一:throws 和 trycatch 差别 (1)比如.publicFileWriter(String fileName) throws IOException{} 我在mian中创建一个FileW ...