一篇不错的关于NAT的文章(一)
一、NAT简介 NAT(Network Address Translation)的功能,就是指在一个网络内部,根据需要可以随意自定义的IP地址,而不需要经过申请。在网络内部,各计算机间通过内部的IP地址进行通讯。而当内部的计算机要与外部internet网络进行通讯时,具有NAT功能的设备(
一、NAT简介
NAT(Network Address Translation)的功能,就是指在一个网络内部,根据需要可以随意自定义的IP地址,而不需要经过申请。在网络内部,各计算机间通过内部的IP地址进行通讯。而当内部的计算机要与外部internet网络进行通讯时,具有NAT功能的设备(比如:路由器)负责将其内部的IP地址转换为合法的IP地址(即经过申请的IP地址)进行通信。
二、NAT 的应用环境:
情况1:一个企业不想让外部网络用户知道自己的网络内部结构,可以通过NAT将内部网络与外部Internet 隔离开,则外部用户根本不知道通过NAT设置的内部IP地址。
情况2:一个企业申请的合法Internet IP地址很少,而内部网络用户很多。可以通过NAT功能实现多个用户同时公用一个合法IP与外部Internet 进行通信。
三、设置NAT所需路由器的硬件配置和软件配置:
设置NAT功能的路由器至少要有一个内部端口(Inside),一个外部端口(Outside)。内部端口连接的网络用户使用的是内部IP地址。
内部端口可以为任意一个路由器端口。外部端口连接的是外部的网络,如Internet 。外部端口可以为路由器上的任意端口。
设置NAT功能的路由器的IOS应支持NAT功能(本文事例所用路由器为Cisco2501,其IOS为11.2版本以上支持NAT功能)。
四、关于NAT的几个概念:
内部本地地址(Inside local address):分配给内部网络中的计算机的内部IP地址。
内部合法地址(Inside global address):对外进入IP通信时,代表一个或多个内部本地地址的合法IP地址。需要申请才可取得的IP地址。
五、NAT的设置方法:
NAT设置可以分为静态地址转换、动态地址转换、复用动态地址转换。
1、静态地址转换适用的环境
静态地址转换将内部本地地址与内部合法地址进行一对一的转换,且需要指定和哪个合法地址进行转换。如果内部网络有E-mail服务器或FTP服务器等可以为外部用户提供的服务,这些服务器的IP地址必须采用静态地址转换,以便外部用户可以使用这些服务。
静态地址转换基本配置步骤:
(1)、在内部本地地址与内部合法地址之间建立静态地址转换。在全局设置状态下输入:
Ip nat inside source static 内部本地地址 内部合法地址
(2)、指定连接网络的内部端口 在端口设置状态下输入:
ip nat inside
(3)、指定连接外部网络的外部端口 在端口设置状态下输入:
ip nat outside
注:可以根据实际需要定义多个内部端口及多个外部端口。
实例1:
本实例实现静态NAT地址转换功能。将2501的以太口作为内部端口,同步端口0作为外部端口。其中10.1.1.2,10.1.1.3,10.1.1.4的内部本地地址采用静态地址转换。其内部合法地址分别对应为192.1.1.2,192.1.1.3,192.1.1.4。
路由器2501的配置:
Current configuration:
version 11.3
no service password-encryption
hostname 2501
ip nat inside source static 10.1.1.2 192.1.1.2
ip nat inside source static 10.1.1.3 192.1.1.3
ip nat inside source static 10.1.1.4 192.1.1.4
interface Ethernet0
ip address 10.1.1.1 255.255.255.0
ip nat inside
interface Serial0
ip address 192.1.1.1 255.255.255.0
ip nat outside
no ip mroute-cache
bandwidth 2000
no fair-queue
clockrate 2000000
interface Serial1
no ip address
shutdown
no ip classless
ip route 0.0.0.0 0.0.0.0 Serial0
line con 0
line aux 0
line vty 0 4
password cisco
end
配置完成后可以用以下语句进行查看:
show ip nat statistcs
show ip nat translations
2、动态地址转换适用的环境:
动态地址转换也是将本地地址与内部合法地址一对一的转换,但是动态地址转换是从内部合法地址池中动态地选择一个末使用的地址对内部本地地址进行转换。
动态地址转换基本配置步骤:
(1)、在全局设置模式下,定义内部合法地址池
ip nat pool 地址池名称 起始IP地址 终止IP地址 子网掩码
其中地址池名称可以任意设定。
(2)、在全局设置模式下,定义一个标准的access-list规则以允许哪些内部地址可以进行动态地址转换。
Access-list 标号 permit 源地址 通配符
其中标号为1-99之间的整数。
(3)、在全局设置模式下,将由access-list指定的内部本地地址与指定的内部合法地址池进行地址转换。
ip nat inside source list 访问列表标号 pool内部合法地址池名字
(4)、指定与内部网络相连的内部端口在端口设置状态下:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Some players are experiencing a strange issue on PS4 or PS5 at launch. For example, this can cause distress when their PlayStation Network login fails, but their internet connection is fine. You may encounter errors when entering your login information and may not be able to join PSParty chat. If you encounter a similar problem, this guide may help you solve it. Next to PlayStationNetworkSign-in, you will see the error message ‘AnErrorHaveAreAre’ and it will say ‘Failure’. Other parameters like getting IP address, internet connection and connection speed were successful. So, what could be the problem here? I will give you a job

In today's situation where almost all games are online, it is not advisable to ignore the optimization of home network. Almost all routers are equipped with NATBoost and QoS features designed to enhance users' gaming experience. This article will explore the definition, advantages and disadvantages of NATBoost and QoS. NATBoost vs. Qos for games; which one is better? NATBoost, also known as Network Address Translation Boost, is a feature built into routers that improves their performance. It's especially important for gaming because it helps reduce network latency, which is the time it takes for data to be transferred between the gaming device and the server. By optimizing the data processing method within the router, NATBoost achieves faster data processing speed and lower latency, thus changing the

1. How can you make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! 1. Activate basic rights and interests: original articles can earn profits by advertising, and videos must be original in horizontal screen mode to earn profits. 2. Activate the rights of 100 fans: if the number of fans reaches 100 fans or above, you can get profits from micro headlines, original Q&A creation and Q&A. 3. Insist on original works: Original works include articles, micro headlines, questions, etc., and are required to be more than 300 words. Please note that if illegally plagiarized works are published as original works, credit points will be deducted, and even any profits will be deducted. 4. Verticality: When writing articles in professional fields, you cannot write articles across fields at will. You will not get appropriate recommendations, you will not be able to achieve the professionalism and refinement of your work, and it will be difficult to attract fans and readers. 5. Activity: high activity,

Object-relational mapping (ORM) frameworks play a vital role in python development, they simplify data access and management by building a bridge between object and relational databases. In order to evaluate the performance of different ORM frameworks, this article will benchmark against the following popular frameworks: sqlAlchemyPeeweeDjangoORMPonyORMTortoiseORM Test Method The benchmarking uses a SQLite database containing 1 million records. The test performed the following operations on the database: Insert: Insert 10,000 new records into the table Read: Read all records in the table Update: Update a single field for all records in the table Delete: Delete all records in the table Each operation

The Yii framework is a high-performance, highly scalable, and highly maintainable PHP development framework that is highly efficient and reliable when developing Web applications. The main advantage of the Yii framework is its unique features and development methods, while also integrating many practical tools and functions. The core concept of the Yii framework, the MVC pattern, Yii adopts the MVC (Model-View-Controller) pattern, which is a pattern that divides the application into three independent parts, namely the business logic processing model and the user interface presentation model.

Object-relational mapping (ORM) is a programming technology that allows developers to use object programming languages to manipulate databases without writing SQL queries directly. ORM tools in python (such as SQLAlchemy, Peewee, and DjangoORM) simplify database interaction for big data projects. Advantages Code Simplicity: ORM eliminates the need to write lengthy SQL queries, which improves code simplicity and readability. Data abstraction: ORM provides an abstraction layer that isolates application code from database implementation details, improving flexibility. Performance optimization: ORMs often use caching and batch operations to optimize database queries, thereby improving performance. Portability: ORM allows developers to

Understanding Java Design Patterns: An introduction to 7 commonly used design patterns, specific code examples are required. Java design patterns are a universal solution to software design problems. It provides a set of widely accepted design ideas and codes of conduct. Design patterns help us better organize and plan the code structure, making the code more maintainable, readable and scalable. In this article, we will introduce 7 commonly used design patterns in Java and provide corresponding code examples. Singleton Patte

What is the ParticleNetwork chain abstraction project? Understand the chain abstraction project ParticleNetwork in one article! Do you feel like you are stumbling around in the complex Web3 world, full of cross-chain challenges and liquidity issues? Ever thought there was a way to make it all clearer? Next, let us take a look at the concept of ChainAbstraction. Today, the editor of this site will share with you a detailed introduction to the chain abstraction project ParticleNetwork. Friends who need it can take a look! What is the Chain Abstraction Project ParticleNetwork Chain Abstraction aims to solve multi-chain fragmentation by providing a unified user experience across all blockchains
