Home Database Mysql Tutorial 在CISCO路由器上配置NAT功能(上)

在CISCO路由器上配置NAT功能(上)

Jun 07, 2016 pm 03:06 PM
cisco nat Function router Configuration along with

随着internet的网络迅速发展,IP地址短缺已成为一个十分突出的问题。为了解决这个问题,出现了多种解决方案。下面几绍一种在目前网络环境中比较有效的方法即地址转换(NAT)功能。 一、NAT简介 NAT(Network Address Translation)的功能,就是指在一个网络内部


  随着internet的网络迅速发展,IP地址短缺已成为一个十分突出的问题。为了解决这个问题,出现了多种解决方案。下面几绍一种在目前网络环境中比较有效的方法即地址转换(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)、指定与内部网络相连的内部端口在端口设置状态下:  
  
      ip  nat  inside  
  
    (5)、指定与外部网络相连的外部端口  
  
      Ip  nat  outside 

Statement of this Website
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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The difference between vivox100s and x100: performance comparison and function analysis The difference between vivox100s and x100: performance comparison and function analysis Mar 23, 2024 pm 10:27 PM

Both vivox100s and x100 mobile phones are representative models in vivo's mobile phone product line. They respectively represent vivo's high-end technology level in different time periods. Therefore, the two mobile phones have certain differences in design, performance and functions. This article will conduct a detailed comparison between these two mobile phones in terms of performance comparison and function analysis to help consumers better choose the mobile phone that suits them. First, let’s look at the performance comparison between vivox100s and x100. vivox100s is equipped with the latest

Understand Linux Bashrc: functions, configuration and usage Understand Linux Bashrc: functions, configuration and usage Mar 20, 2024 pm 03:30 PM

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

What exactly is self-media? What are its main features and functions? What exactly is self-media? What are its main features and functions? Mar 21, 2024 pm 08:21 PM

With the rapid development of the Internet, the concept of self-media has become deeply rooted in people's hearts. So, what exactly is self-media? What are its main features and functions? Next, we will explore these issues one by one. 1. What exactly is self-media? We-media, as the name suggests, means you are the media. It refers to an information carrier through which individuals or teams can independently create, edit, publish and disseminate content through the Internet platform. Different from traditional media, such as newspapers, television, radio, etc., self-media is more interactive and personalized, allowing everyone to become a producer and disseminator of information. 2. What are the main features and functions of self-media? 1. Low threshold: The rise of self-media has lowered the threshold for entering the media industry. Cumbersome equipment and professional teams are no longer needed.

PHP Tips: Quickly Implement Return to Previous Page Function PHP Tips: Quickly Implement Return to Previous Page Function Mar 09, 2024 am 08:21 AM

PHP Tips: Quickly implement the function of returning to the previous page. In web development, we often encounter the need to implement the function of returning to the previous page. Such operations can improve the user experience and make it easier for users to navigate between web pages. In PHP, we can achieve this function through some simple code. This article will introduce how to quickly implement the function of returning to the previous page and provide specific PHP code examples. In PHP, we can use $_SERVER['HTTP_REFERER'] to get the URL of the previous page

What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account? What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account? Mar 21, 2024 pm 04:16 PM

As Xiaohongshu becomes popular among young people, more and more people are beginning to use this platform to share various aspects of their experiences and life insights. How to effectively manage multiple Xiaohongshu accounts has become a key issue. In this article, we will discuss some of the features of Xiaohongshu account management software and explore how to better manage your Xiaohongshu account. As social media grows, many people find themselves needing to manage multiple social accounts. This is also a challenge for Xiaohongshu users. Some Xiaohongshu account management software can help users manage multiple accounts more easily, including automatic content publishing, scheduled publishing, data analysis and other functions. Through these tools, users can manage their accounts more efficiently and increase their account exposure and attention. In addition, Xiaohongshu account management software has

What is PHP used for? Explore the role and functions of PHP What is PHP used for? Explore the role and functions of PHP Mar 24, 2024 am 11:39 AM

PHP is a server-side scripting language widely used in web development. Its main function is to generate dynamic web content. When combined with HTML, it can create rich and colorful web pages. PHP is powerful. It can perform various database operations, file operations, form processing and other tasks, providing powerful interactivity and functionality for websites. In the following articles, we will further explore the role and functions of PHP, with detailed code examples. First, let’s take a look at a common use of PHP: dynamic web page generation: P

How to configure and install FTPS in Linux system How to configure and install FTPS in Linux system Mar 20, 2024 pm 02:03 PM

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

Understanding VSCode: What is this tool used for? Understanding VSCode: What is this tool used for? Mar 25, 2024 pm 03:06 PM

"Understanding VSCode: What is this tool used for?" 》As a programmer, whether you are a beginner or an experienced developer, you cannot do without the use of code editing tools. Among many editing tools, Visual Studio Code (VSCode for short) is very popular among developers as an open source, lightweight, and powerful code editor. So, what exactly is VSCode used for? This article will delve into the functions and uses of VSCode and provide specific code examples to help readers

See all articles