当前位置:网站首页>交换机和路由器技术-34-动态NAT
交换机和路由器技术-34-动态NAT
2022-08-11 04:44:00 【w辣条小王子】
动态NAT
静态NAT 回顾
静态NAT 1—>1转 192.168.1.1----->64.23.54.99
命令:
在接口上定义内网和外网接口
Router(config)#int g0/0
Router(config-if)#ip nat inside
Router(config-if)#exit
Router(config)#int g0/1
Router(config-if)#ip nat outside
Router(config-if)#exit
Router(config-if)#in nat inside source static内部ip 公网ip
查看转换表:
Show ip nat translations
做这个实验外网主机不需要配置网关,配置网关就是路由寻址而不是静态转换
动态NAT
动态的,多对多
第一步,完成拓扑搭建,划分网段,为PC配置IP地址,注意PC3不用配网关
第二步:在出口路由器上定义内网接口和外网接口
Router(config)#int g0/0
Router(config-if)#ip nat inside
Router(config-if)#exit
Router(config)#int g0/1
Router(config-if)#ip nat outside
Router(config-if)#exit
Router(config)#
第三步:
1.定义内网的范围 使用ACL来定义允许
Router(config)#access-list 10 permit 192.168.10.0 0.0.0.255
2. 定义外网的范围,使用名称指定范围IP
Router(config)#ip nat pool dtnat 23.34.56.70 23.34.56.71 netmask 255.255.255.0
3.应用
Router(config)#ip nat inside source list 10 pool dtnat
三个内部地址对应两个公网地址,最多只能同时两个设备可以使用外网
查看转换表
清除转换表
Router#Clear ip nat translations *
出口路由器的配置
Router(config)#
Router(config)#int g0/0
Router(config-if)#ip nat inside
Router(config-if)#exit
Router(config)#int g0/1
Router(config-if)#ip nat outside
Router(config-if)#exit
Router(config)#ip nat inside ?
source Source address translation
Router(config)#ip nat inside source ?
list Specify access list describing local addresses
static Specify static local->global mapping
Router(config)#ip nat inside source list ?
<1-199> Access list number for local addresses
WORD Access list name for local addresses
第一步:
创建ACL 允许192.168.10.0 网段通过,注意ACL使用的是反掩码
Router(config)#access-list 10 permit ?
A.B.C.D Address to match
any Any source host
host A single host address
Router(config)#access-list 10 permit 192.168.10.0 ?
A.B.C.D Wildcard bits
<cr>
Router(config)#access-list 10 permit 192.168.10.0 0.0.0.255
第二步:
创建Pool定义公网地址范围,注意要加上子网掩码确定网络范围大小
Router(config)#ip nat ?
inside Inside address translation
outside Outside address translation
pool Define pool of addresses
Router(config)#ip nat pool nat ?
A.B.C.D Start IP address
Router(config)#ip nat pool nat 23.34.56.70 ?
A.B.C.D End IP address
Router(config)#ip nat pool nat 23.34.56.70 23.34.56.71
% Incomplete command.
Router(config)#ip nat pool nat 23.34.56.70 23.34.56.71 ?
netmask Specify the network mask
Router(config)#ip nat pool nat 23.34.56.70 23.34.56.71 netmask 255.255.255.0
应用:
Router(config)#ip nat inside source ?
list Specify access list describing local addresses
static Specify static local->global mapping
Router(config)#ip nat inside source list 10 ?
interface Specify interface for global address
pool Name pool of global addresses
Router(config)#ip nat inside source list 10 pool nat
边栏推荐
猜你喜欢
Jetson Orin平台4-16路 GMSL2/GSML1相机采集套件推荐
Three 】 【 yolov7 series of actual combat from 0 to build training data sets
I wrote some code in my resume, but I still can't pass the interview
【组成原理 九 CPU】
Dry goods: The principle and practice of server network card group technology
What is ensemble learning in machine learning?
简历里写了会代码,却依然过不了面试这一关
分层架构&SOA架构
剑指offer_抽象建模能力
"125 Palindrome Verification" of the 10th day string series of LeetCode brushing questions
随机推荐
To break the bottleneck of transactional work, the gentleman signs the electronic contract to release the "source power" of HR!
Mysql中事件和定时任务
延长经济保险(jeecgboot)
Alibaba Cloud releases 3 high-performance computing solutions
map and set - natural search and lookup semantics
走出迷宫的最短路径
Layered Architecture & SOA Architecture
洛谷P2580 于是他错误的点名开始了
[Actual combat scene] Mall-discount event design plan
一种基于共识机制的数字集群终端防失控方案研究
阿里云发布3大高性能计算解决方案
Provincial level of Echart maps, as well as all prefecture-level download and use
Licking - frog jumping steps
标识密码技术在 IMS 网络中的应用
使用百度EasyDL实现智能垃圾箱
洛谷P7441 Erinnerung
2022新员工公司级安全教育基础培训(118页)
【小记】BatchSize的数值是设置的越大越好吗
解决多线程调用sql存储过程问题
c语言fprintf、fscanf、sscanf以及sprintf函数知识要点总结