PIX Alias命令的用法 

 
 
PIX Alias命令的用法。

Understanding the alias Command for the Cisco Secure PIX Firewall


--------------------------------------------------------------------------------

The alias command has two possible functions:

It can be used to do "DNS Doctoring" of DNS replies from an external DNS server.

In DNS Doctoring, the PIX "changes" the DNS response from a DNS server to be a different IP address than the DNS server actually answered for a given name.

This process is used when we want the actual application call from the internal client to connect to an internal server by its internal IP address.

It can be used to do "Destination NAT" (dnat) of one destination IP address to another IP address.

In dnat, the PIX "changes" the destination IP of an application call from one IP address to another IP address.

This process is used when we want the actual application call from the internal client to the server in a perimeter (dmz) network by its external IP address. This does not "doctor" the DNS replies.
For example, if a host sends a packet to 99.99.99.99, you can use the alias command to redirect traffic to another address, such as 10.10.10.10. You can also use this command to prevent conflicts when you have IP addresses on a network that are the same as those on the Internet or another intranet. For more information, consult the PIX documentation..

Hardware and Software Versions
The information in this document is based on the software and hardware versions below.


Cisco Secure PIX Firewall Software Releases 5.0.x and later

Translating an Internal Address with DNS Doctoring
In the first example, the web server has an IP address of 10.10.10.10, and the global IP address of this web server is 99.99.99.99.

Note: The DNS server is on the outside. Verify that the DNS server resolves your domain name to the global IP address of the web server by issuing an nslookup command. The result of the nslookup on the client PC should be the internal IP address of the server (10.10.10.10), because the DNS reply gets doctored as it passes through the PIX.

Also note that, for DNS fixup to work properly, proxy-arp has to be disabled. If you are using the alias command for DNS fixup, disable proxy-arp with the following command after the alias command has been executed.

sysopt noproxyarp internal_interface

Network Diagram



If we want the machine with the IP address 10.10.10.25 to access this web server by its domain name (www.mydomain.com), we need to implement the alias command as follows:

alias (inside) 10.10.10.10 99.99.99.99 255.255.255.255
!--- This command sets up DNS Doctoring. It is initiated from the clients in
!--- the "inside" network. It watches for DNS replies that contain
!--- 99.99.99.99, then replaces the 99.99.99.99 address with the 10.10.10.10
!--- address in the "DNS reply" sent to the client PC.

Next, a static translation must be created for the web server, and we need to give anyone on the Internet access to the web server on port 80 (http):

static(inside,outside) 99.99.99.99 10.10.10.10 netmask 255.255.255.255
!--- This command creates a static translation between the web server's
!--- real address 10.10.10.10 to the global IP address 99.99.99.99.

To grant permission for access, you should use access list commands, as shown below.

access-list 101 permit tcp any host 99.99.99.99 eq www
access-group 101 in interface outside
!--- These commands permit any outside user to access the web server on port 80.

If you prefer the older syntax, you can use a conduit command as follows.

conduit permit tcp host 99.99.99.99 eq www any
!--- This command permits any outside user to access the web server on port 80.
Translating a DMZ Address with Destination NAT
If the web server is on the DMZ network of the PIX, the alias command must be used to do Destination NAT (dnat). In our example, the web server on the DMZ has an IP address of 192.168.100.10, and the outside IP address for this web server is 99.99.99.99. We want to use dnat to translate the IP address 99.99.99.99 to 192.168.100.10 on the actual call to the server; the DNS call and reply will be unchanged. In this example the DNS response seen by the internal client PC will be the external 99.99.99.99 IP address, since it is not DNS doctored.

Network Diagram



In this example, we want machines in the 10.10.10.0 /24 network to access this web server in the DMZ by its external domain name ((www.mydomain.com
We need to use the alias command to perform dnat:

alias(inside) 99.99.99.99 192.168.100.10 255.255.255.255
!--- This sets up the Destination NAT. In this example the DNS reply is nott
!--- doctored by the PIX because the external address (99.99.99.99) does not
!--- match the foreign IP address in the alias command (the second IP).
!--- But the call will be "dnat-ed" because the destination address
!--- in the call will match the dnat IP address in the alias command (the first IP).

Note: The IP addresses in the alias command are in reverse order compared with the example above for DNS Doctoring..

Next, a static translation must be created for the web server, and we need to give anyone on the Internet access to the web server on port 80 (http):

static(dmz,outside) 99.99.99.99 192.168.100.10 netmask 255.255.255.255
!--- This command creates a static translation between the web server'ss
!--- real address 192.168.100.10 to the global IP address 99.99.99.99.
To grant permission for access, you should use access list commands, as shown below.

access-list 101 permit tcp any host 99.99.99.99 eq www
access-group 101 in interface outsidee
!--- These commands permit any outside user to access the web server on port 80.
If you prefer the older syntax, you can use a conduit command as follows.

conduit permit tcp host 99.99.99.99 eq www any
!--- This command permits any outside user to access the web server on port 80..
Other Configuration Notes

The interface in the alias command should be the "interface" that the clients are calling from.

If there are also clients on the DMZ, you could add another alias for the DMZ interface (this one would be DNS doctoring).

For instance, let's say that, in the example above, you want other clients on the DMZ to use the external DNS but to call the web server by its DMZ address. To do this, you would create an additional alias command, tied to the DMZ interface, in order to DNS doctor the DNS reply packets.
alias (dmz) 192.168.100.10 99.99.99.99 255.255.255.255
!--- This command sets up DNS Doctoring. It is initiated from the clients inn
!--- the "dmz" network. It watches for DNS replies that contain
!--- 99.99.99.99, then replaces the 99.99.99.99 address with the 192.168.100.10
!--- address in the "DNS reply" sent to the client PC.
You can have multiple alias commands tied to different interfaces on the same PIX.

 
 
PIX Alias命令的用法。(中文)



目前的情况是:DDN接入我单位,并且分配有公网IP地址。
outside的网段是 202.99.100.0/24
DMZ 的网段是 192.168.1.0/24
Inside 的网段是 10.10.1.0/24


有已经在CNNIC注册好的域名一个:abc.com.cn,并且是由自己来解析域名,注册时的域名服务器用的是202.99.100.1


一般的情况是在inside架设一台DNS服务器,供Inside的用户使用,而且这个一般是不能缺少的,因为有的服务并不是对外提供的,而是仅仅Inside内的用户使用,并且服务器放在Inside中,这里对Inside的DNS和主机的设置就不多说了。另外,在DMZ区架设一台NDS服务器,用于对外解析abc.com.cn,如解析www.abc.com.cn到202.99.100.2,DNS服...都放在DMZ区,用
static (dmz,outside) 202.99.100.1 192.168.1.1 netmask 255.255.255.255 0 0
static (dmz,outside) 202.99.100.2 192.168.1.2 netmask 255.255.255.255 0 0
…………..
……….
……
conduit permit udp host 202.99.100.1 eq domain any
conduit permit tcp host 202.99.100.2 eq www any
来解决外面访问DMZ区服务器的问题。


好了,现在问题出现了,那么DMZ区和inside的主机或者服务器,它们之间该是如何相互访问域名呢?DMZ区的主机或者服务器,它们本身的DNS该指向哪里呢?如果指向DMZ区的那台DNS(192.168.1.1),那么,它们在访问www.abc.com.cn的时候得到的解析结果?..鰓ww.abc.com.cn
到192.168.1.2。不过如果这样的话,首先将在DMZ区增加一台服务器,至少要在一台服务器上增加DNS服务;另外,如果每次DNS新增主机的时候,要在两台DNS上做添加、修改。其实,在PIX520 上的alias命令能解决这个问题,让你的DMZ区只需要一台DNS服务器。


alias (dmz) 192.168.1.2 202.99.100.2 255.255.255.255


好了,就是这条命令。
但是,我多次的试验就是不成功。我的最初的想象是,DMZ区的主机DNS指向就是DMZ区的DNS服务器,当解析回来的地址是202.99.100.2的时候,在防火墙上的alias (dmz)……命名会告诉那台主机,它还有别名叫192.168.1.2,然后主机就会去访问192.168.1.2,但是实际情况是DMZ区的主机无论如何都是无法Ping通www.abc.com.cn ,更别说浏览了。最终通过试验发现,DMZ区的主机或者服务器,它们的DNS指向不能是本区的DNS服务器,而是公网上的(如数据局)一台DNS服务器,这样,它们访问 www.abc.com.cn就没有问题了。


原理是这样的:DMZ区的一台主机发出对www.abc.com.cn
的DNS请求,公网上的那台DNS服务器最终会把解析请求发给DMZ区的那台DNS服务器(192.168.1.1),它解析的结果是202.99.100.2并把解析包告诉公网DNS服务器,公网的DNS服务器返回给DMZ区主机的dns reply包会被PIX上的alias (dmz)……命名所更改成192.168.1.2,从而使DMZ区的主机用域名的方式成功访问本区内的服务器,而由外面向dmz的dns请求以及返回包不受影响。

ALIAS命令完整的格式解析:

alias (发出DNS请求的接口) 需要转换成的IP地址 外部DNS server给出的响应地址 255.255.255.255

 

 

 
 

关于我们 |   

 招聘信息 |  友情链接 |  版权声明 |  管理中心 |  联系我们

中国思科培训网】- 思科(CISCO) CCNACCNPCCIE 认证培训第一品牌!

地址:北京市海淀区 白石桥-西苑饭店四号楼一层   
培训咨询:010-68345588(多线)   Email:service@ciscochina.com 

 

全 国 各 地 培 训 咨 询

北京:010-68345588 天津:022-62066366  上海:021-51095709
广州:020-61131010  深圳:0755-61283800  西安:029-62291168
南京:025-86871880 武汉:027-51240080  成都:028-66002150
重庆:023-89009811  郑州:0371-67215200   济南:0531-88343600