发新话题
打印

[网络转载] 动态NAT的一点发现

动态NAT的一点发现

我们在配置动态NAT的以后,当地址池中的IP地址用完时。假如有一个用户下线了,哪么他还要等一段时间才能空出这个IP出来, 这样就造成了下线与上线不能同时进行,为了解决这一问题我们可以通过设置它的超时来让他在最短的时间里空出Ip出来。它的配置方 法是:router(config)#ip nat  translations timeout  n ,这个N的单位是以秒计算的。

Inside Local(内部本地地址)


Configured IP address assigned to a host on the inside network. Address may be globally unique, allocated out of the private address space defined in RFC 1918, or might be officially allocated to another organization


(分配给内部网络中一台主机的IP地址,地址可以是全球唯一的,也可以是一个RFC 1918 定义的私有的地址。)


Inside Global (内部全球地址)


The IP address of an inside host as it appears to the outside network, "Translated IP Address". Addresses can be allocated from a globally unique address space, typically provided by the ISP (if the enterprise is connected to the global Internet)


(由地区因特网注册局(RIP)或服务提供商分配的一个合法IP地址。它可以代表一个或多个内部本地IP地址。)


Outside Local (外部本地地址)


The IP address of an outside host as it appears to the inside network. These addresses can be allocated from the RFC 1918 space if desired.


(为内部网络主机所知的一台外部主机的IP地址)


Outside Global (外部全球地址)


The configured IP address assigned to a host in the outside network.


(外部网络的某台主机拥有者分配给该主机的IP地址)


CONFIGURATION EXAMPLES(结构例子)


The following sample configuration translates between inside hosts addressed from either the 192.168.1.0 or 192.168.2.0 nets to the globally-unique 171.69.233.208/28 network.


ip nat pool net-20 171.69.233.208 171.69.233.223 netmask <netmask> 255.255.255.240


ip nat inside source list 1 pool net-20


!


interface Ethernet0


ip address 171.69.232.182 255.255.255.240


ip nat outside


!


interface Ethernet1


ip address 192.168.1.94 255.255.255.0


ip nat inside


!


access-list 1 permit 192.168.1.0 0.0.0.255


access-list 1 permit 192.168.2.0 0.0.0.255


The next sample configuration translates between inside hosts addressed from the 9.114.11.0 net to the globally unique 171.69.233.208/28 network. Packets from outside hosts addressed from 9.114.11.0 net (the "true" 9.114.11.0 net) are translated to appear to be from net 10.0.1.0/24.


ip nat pool net-20 171.69.233.208 171.69.233.223 netmask <netmask> 255.255.255.240


ip nat pool net-10 10.0.1.0 10.0.1.255 netmask <netmask> 255.255.255.0


ip nat inside source list 1 pool net-20


ip nat outside source list 1 pool net-10


!


interface Ethernet0


ip address 171.69.232.182 255.255.255.240


ip nat outside


!


interface Ethernet1


ip address 9.114.11.39 255.255.255.0


ip nat inside


!


access-list 1 permit 9.114.11.0 0.0.0.255


FEATURE ENHANCEMENTS(增加的功能)


• More flexible pool configuration:


The pool configuration syntax has been extended to allow discontiguous ranges of addresses. The following syntax is now allowed:


ip nat pool <name> { netmask <mask> | prefix-length <length> } [ type { rotary } ]


This command will put the user into IP NAT Pool configuration mode, where a sequence of address ranges can be configured. There is only one command in this mode:


address <start> <end>


Example:


Router(config)#ip nat pool fred prefix-length 24


Router(config-ipnat-pool)#address 171.69.233.225 171.69.233.226


Router(config-ipnat-pool)#address 171.69.233.228 171.69.233.238


This configuration creates a pool containing addresses 171.69.233.225-226 and 171.69.233.228-238 (171.69.233.227 has been omitted).


• Translating to interface's address:


As a convenience for users wishing to translate all inside addresses to the address assigned to an interface on the router, the NAT code allows one to simply name the interface when configuring the dynamic translation rule:


ip nat inside source list <number> interface <interface> overload


If there is no address on the interface, or it the interface is not up, no translation will occur.


Example:


ip nat inside source list 1 interface Serial0 overload


• Static translations with ports:


When translating addresses to an interface's address, outside-initiated connections to services on the inside network (like mail) will require additional configuration to send the connection to the correct inside host. This command allows the user to map certain services to certain inside hosts.


ip nat inside source static { tcp | udp } <localaddr> <localport> <globaladdr> <globalport>


Example:


ip nat inside source static tcp 192.168.10.1 25 171.69.232.209 25


In this example, outside-initiated connections to the SMTP port (25) will be sent to the inside host 192.168.10.1.


• Support for route maps:


The dynamic translation command can now specify a route-map to be processed instead of an access-list. A route-map allows the user to match any combination of access-list, next-hop IP address, and output interface to determine which pool to use:


ip nat inside source route-map <name> pool <name>


Example:


ip nat pool provider1-space 171.69.232.1 171.69.232.254 prefix-length 24


ip nat pool provider2-space 131.108.43.1 131.108.43.254 prefix-length 24


ip nat inside source route-map provider1-map pool provider1-space


ip nat inside source route-map provider2-map pool provider2-space


!


interface Serial0/0


ip nat outside


!


interface Serial0/1


ip nat outside


!


interface Fddi1/0


ip nat inside


!


route-map provider1-map permit 10


match ip address 1


match interface Serial0/0


!


route-map provider2-map permit 10


match ip address 1


match interface Serial0/1


• "Extendable" static translations:


The extendable keyword allows the user to configure several ambiguous static translations, where an ambiguous translations are translations with the same local or global address.


ip nat inside source static <localaddr> <globaladdr> extendable


Some customers want to use more than one service provider and translate into each provider's address space. You can use route-maps to base the selection of global address pool on output interface as well as an access-list match. Following is an example:


ip nat pool provider1-space ...


ip nat pool provider2-space ...


ip nat inside source route-map provider1-map pool provider1-space


ip nat inside source route-map provider2-map pool provider2-space


!


route-map provider1-map permit 10


match ip address 1


match interface Serial0/0


!


route-map provider2-map permit 10


match ip address 1


match interface Serial0/1




TOP

发新话题