search
HomeDatabaseMysql Tutorial谈路由器NAT功能的配置

谈路由器NAT功能的配置

Jun 07, 2016 pm 03:06 PM
internetnatFunctionrouterConfigurationalong with

随着Internet的迅速发展,IP地址短缺已成为一个十分突出的问题。如我单位,200台计算机,4台服务器只分配了6个C类地址。那么,如何解决这个问题呢?我选择了在 路由器 上实现NAT的方法来解决这个问题。 NAT(Network Address Translation)顾名思义就是网络IP


  随着Internet的迅速发展,IP地址短缺已成为一个十分突出的问题。如我单位,200台计算机,4台服务器只分配了6个C类地址。那么,如何解决这个问题呢?我选择了在路由器上实现NAT的方法来解决这个问题。
  NAT(Network Address Translation)顾名思义就是网络IP地址的转换。NAT的出现是为了解决IP日益短缺的问题,将多个内部地址映射为少数几个甚至一个公网地址。这样,就可以让我们内部网中的计算机通过伪IP访问INTERNET的资源。
  设置NAT功能路由器至少要有一个内部端口(Inside),一个外部端口(Outside)。
  内部端口连接的网络用户使用的是内部IP地址(非法IP);外部端口连接的是外部的网络,使用电信部门分配给我们的IP地址。一般来说,内部端口应使用ETHERNET 端口,外部端口使用SERIAL 端口。另外,想要使用NAT功能路由器的IOS必须支持NAT功能
  NAT设置可以分为静态地址转换、动态地址转换、复用动态地址转换。以下设置以Cisco路由器为例。
  1.静态地址转换
  静态地址转换将内部本地地址与内部合法地址进行一对一地转换,且需要指定和哪个合法地址进行转换。如果内部网络有WWW服务器或FTP服务器等可以为外部用户提供服务,则这些服务器的IP地址必须采用静态地址转换,以便外部用户可以使用这些服务。
  2.动态地址转换
  动态地址转换也是将内部本地地址与内部合法地址一对一地转换,但是动态地址转换是从内部合法地址池中动态地选择一个未使用的地址来对内部本地地址进行转换的。
  3.复用动态地址转换
  复用动态地址转换首先是一种动态地址转换,但是它可以允许多个内部本地地址共用一个内部合法地址。对只申请到少量IP地址但却经常同时有多个用户上外部网络的情况,这种转换极为有用。
  PAT(Port Address Translation)也称为NAPT,就是将多个内部地址映射为一个公网地址,但以不同的协议端口号与不同的内部地址相对应。这种方式常用于拨号上Internet网。
  以下是以2611路由器为例,配置清单如下:
  Current configuration:
  !
  version 12.0
  service timestamps debug uptime
  service timestamps log uptime
  no service password-encryption
  !
  hostname 2611
  !
  enable secret 5 $1$JIeG$UZJNjKhcptJXHPc/BP5GG0
  enable password 2323ipro
  !
  ip subnet-zero
  no ip source-route
  no ip finger
  !
  !
  !
  interface Ethernet0/0
  ip address 192.168.10.254 255.255.255.0 secondary
  ip address 218.27.84.249 255.255.255.248
  no ip directed-broadcast
  ip accounting output-packets
  no ip mroute-cache
  no cdp enable
  !
  interface Serial0/0
  ip unnumbered Ethernet0/0
  no ip directed-broadcast
  ip accounting output-packets
  ip nat outside
  no ip mroute-cache
  no fair-queue
  no cdp enable
  !
  interface Ethernet0/1
  ip address 192.168.2.254 255.255.255.0
  no ip directed-broadcast
  ip nat inside
  no ip mroute-cache
  no cdp enable
  !
  interface Virtual-TokenRing35
  no ip address
  no ip directed-broadcast
  no ip mroute-cache
  shutdown
  ring-speed 16
  !
  router rip
  redistribute connected
  network 192.168.2.0
  network 192.168.10.0
  network 218.27.84.0
  !
  ip default-gateway 218.27.127.217
  ip nat pool nat-pool 218.27.84.252 218.27.84.254 netmask 255.255.255.248
  ip nat inside source list 1 pool nat-pool overload
  ip nat inside source static 192.168.2.254 218.27.84.249
  ip classless
  ip route 0.0.0.0 0.0.0.0 Serial0/0
  ip http server
  ip http port 9091
  ip ospf name-lookup
  !
  !
  ip access-list extended filterin
  permit tcp any host 218.27.84.249 eq www reflect httpfilter
  access-list 1 permit 192.168.2.0 0.0.0.255
  no cdp run
  
  !
  line con 0
  transport input none
  line aux 0
  line vty 0 4
  password routr
  login
  !
  end
  当然,我们也可以采用PAT技术,但PAT 技术不太适合指定TCP/UDP端口的应用,如电视会议等。因此,如果使用PAT技术,也应当使用NAT+PAT,这样才不至于功能受限。
  
  

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),