Rewriting the Network Prefix


You want to rewrite all of the addresses in a particular range by simply replacing the prefix with one of equal length.


Sometimes you need to connect your network to another network that uses an unregistered range, such as However, if you already use this range in your network, the easiest thing to do is to simply replace this prefix with another one that doesn't have a conflict, such as

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ip nat outside source static network /16 no-alias
Router(config)#ip route Ethernet1/0
Router(config)#ip route Ethernet1/0
Router(config)#interface FastEthernet 0/0
Router(config-if)#ip address
Router(config-if)#ip nat inside
Router(config)#interface Ethernet1/0
Router(config-if)#ip address
Router(config-if)#ip nat outside



Unlike the previous examples, this recipe shows a very simple static form of NAT that translates addresses by simply replacing one prefix with another. So, for example, the remote host,, gets its address rewritten simply as

The router can accomplish this with the following command:

Router(config)#ip nat outside source static network /16 no-alias

This defines a static mapping of one network prefix to another, as required.

Note that we have included the no-alias keyword in this command. If we didn't include this keyword, the router would try to generate aliases for the translated addresses to allow it to answer ARP requests for them. This keyword is necessary because one of the router's own interfaces belongs to the translated range.

Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505
Simiral book on Amazon © 2008-2017.
If you may any questions please contact us: