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

CCNA实验(7) -- NAT的更多相关文章

  1. Packet Tracer 5.0 构建CCNA实验(2)—— 配置VLAN

    Packet Tracer 5.0 构建CCNA实验(2)—— 配置VLAN Vlan(Virtual Local Area Network) 即虚拟局域网.VLAN可以把同一个物理网络划分为多个逻辑 ...

  2. CCNA 之 十一 NAT 子网地址转换

    NAT 网络地址转换 全称:Network Address Translation 为什么需要NAT? 因为公网IP(IPv4)地址紧缺,内容地址通过NAT转换成一个公有地址去访问公网资源: 如下图展 ...

  3. CCNA实验4:HDLC和PPP

    一.HDLC封装 router9和11上分别配置s0/0如下 conf t int s0/0 encapsulation hdlc do show int s0/0 ip address x.x.x. ...

  4. CCNP交换实验(7) -- NAT

    1.静态NAT2.动态NAT3.复用内部全局地址的NAT(PAT) enableconf tno ip do loenable pass ciscoline con 0logg syncexec-t ...

  5. CCNA实验2.VLAN

    一. 二.配置主VTP上的信息 sw2上配置为domain server,sw1上配置为domain client,sw2上增加vlan并命名和添加描述 conf t vtp domain corp ...

  6. CCNA实验1.port-security

    一, 二,MAC地址绑定 3550-1#conf t3550-1(config)#int f0/13550-1(config-if)#switchport mode access /指定端口模式.35 ...

  7. CCNA实验(1) -- 基本配置

    Ctrl+A: 到行首(Ahead)Ctrl+E: 到行尾(End)Esc+B: 回退一个单词(Back)Esc+F: 前进一个单词(Forward) 1.三种配置模式2.时间时区配置3.设置超时时间 ...

  8. CCNA实验(2) -- Static Route

    1.静态路由R1:ip route 22.1.1.0 255.255.255.0 12.1.1.2 2.静态汇总路由R1:ip route 22.1.0.0 255.255.0.0 12.1.1.2 ...

  9. CCNA实验(5) -- OSPF

    enableconf tno ip do loenable pass ciscoline con 0logg syncexec-t 0 0line vty 0 4pass ciscologg sync ...

随机推荐

  1. .Xmodmap vim键位映射。

    remove Lock = Caps_Lockkeysym Caps_Lock = Control_Ladd Control = Control_Lkeysym Escape = grave asci ...

  2. artTemplate-3.0

    https://github.com/aui/artTemplate artTemplate-3.0 新一代 javascript 模板引擎 目录 特性 快速上手 模板语法 下载 方法 NodeJS ...

  3. Mysql语句的批量操作[修改]

    UPDATE `cla_info` SET `comment` = CASE ) THEN 'A' ) THEN 'B' ) THEN 'C' ) THEN 'D' END, `collect` = ...

  4. Spring简单的文件配置

    Spring简单的文件配置 “计应134(实验班) 凌豪” 一.Spring文件配置 spring至关重要的一环就是装配,即配置文件的编写,接下来我按刚才实际过程中一步步简单讲解. 首先,要在web. ...

  5. 使用mysql_query()方法操纵数据库以及综合实例

    1.利用insert 语句添加记录 <? require('conn.php'); mysql_query( "insert into lyb ( title, content, au ...

  6. Silverlight并行下载与串行下载

    思路清晰后仅仅只需百来行代码便可轻松编写出一套完整的资源动态下载组件- SerialDownloader和ParallelDownloader,它们共用一个完成资源表,且串行下载集成了优先机制(Dow ...

  7. jni note

    2016-1-15 javah 使用javah可以自动从java文件生成jni头文件, 用法:javah [选项] <类> 其中 [选项] 包括:         -help        ...

  8. 6. java.lang.IllegalArgumentException

    方法的参数错误 比如g.setColor(int red,int green,int blue)这个方法中的三个值,如果有超过255的也会出现这个异常,因此一旦发现这个异常,我们要做的,就是赶紧去检查 ...

  9. Android应用中使用自定义文字

    在Android系统中可以很方便的修改字体样式.系统提供了三种样式,分别是sans,serif,monospace.可以在xml布局文件中通过 android:typeface="[sans ...

  10. 一个SysLog实现

    http://www.ice.com/java/syslog/index.shtml http://alvinalexander.com/servlets