Top Banner
14-1 Copyright © 1999, Cisco Systems, Inc. Chapter 14 Scaling IP Addresses with NAT and PAT
21
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: N at

14-1 Copyright © 1999, Cisco Systems, Inc.

Chapter 14Scaling IP Addresses with NAT and PAT

Page 2: N at

14-2—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Objectives

Upon completion of this chapter, you will be able to perform the following tasks:• Identify how NAT and PAT solve the limited IP

address problem and describe how they operate

• Configure NAT and PAT

• Verify NAT and PAT

Page 3: N at

14-3—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Chapter Activities

Windows 95 PC Modem

Branch office

ISDN/analog

Small office

Central site

Frame Relay

Frame Relay

service

PRI

BRI

BRI

Frame Relay

Async

AAA server

AsyncSA

10.1.1.1

192.168.2.2SA

Inside Local IP Address

10.1.1.1

Inside Global IP Address

192.168.2.2

NAT table

PAT

Page 4: N at

14-4—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Why Use NAT?

Use NAT if:

• You need to connect to the Internet and your hosts do not have globally unique IP addresses

• You change over to a new ISP that requires you to renumber your network

• Two intranets with duplicate addresses merge

• You want to support basic load sharing

Outside

10.1.1.1

10.1.1.2

Inside

Internet

NAT borderrouter

SA192.168.2.2SA

10.1.1.1

Page 5: N at

14-5—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

NAT Implementation ConsiderationsAdvantages

Conserves legally registered addressesReduces address overlap occurrence

Increases flexibility when connecting to Internet

Eliminates address renumbering as network changes

Disadvantages

Translation introduces switching path delaysLoss of end-to-end IP traceability

Certain applications will not function with NAT enabled

Page 6: N at

14-6—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

NAT Overview and Terminology

Internet

Inside

10.1.1.1Inside Local IP

Address

10.1.1.210.1.1.1

Simple NAT table

Inside Global IP Address

192.168.2.3192.168.2.2

10.1.1.2

Host B172.20.7.3

A

C

BA

B

D

SA10.1.1.1

DA10.1.1.1

SA192.168.2.2

DA192.168.2.2

Page 7: N at

14-7—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

NAT Operation

Inside Local IP Address

10.1.1.110.1.1.2

NAT table

Inside Global IP Address

192.168.2.2192.168.2.3

NAT functions:• Translation inside local

addresses

• Overloading inside global addresses

• TCP load distribution

• Handling overlapping networks

Internet

Inside

10.1.1.1

10.1.1.2

Page 8: N at

14-8—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Translating Inside Local Addresses

10.1.1.2

10.1.1.1

192.168.2.3

192.168.2.2

NAT table

Inside Local IP Address

Inside Global IP Address

10.1.1.3 192.168.2.4

Internet

Inside

10.1.1.1

10.1.1.2

Host B172.20.7.3

1

3

SA10.1.1.1

DA10.1.1.1

SA192.168.2.2

DA192.168.2.2

10.1.1.2

10.1.1.3

4

5

2

Page 9: N at

14-9—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Overloading Inside Global Addresses

10.1.1.2:172310.1.1.1:1024

NAT table

192.168.2.2:1723192.168.2.2:1024

172.21.7.3:23172.20.7.3:23

TCPTCP

10.1.1.3:1723 192.168.2.2:1492 172.21.7.3:23TCP

Internet

Inside

10.1.1.1

Host B172.20.7.3

1

3

SA10.1.1.1

DA10.1.1.1

SA192.168.2.2

DA192.168.2.2

10.1.1.2

10.1.1.3

4

5

2

Host C172.21.7.3

DA192.168.2.2

4

Inside Global IP Address: Port

Outside Global IP Address: Port

Protocol Inside Local IP Address: Port10.1.1.1

Page 10: N at

14-10—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

TCP Load Distribution

NAT table

Inside Global IP Address: Port

10.1.1.127:8010.1.1.127:8010.1.1.127:80

Outside Global IP Address: Port

172.20.7.3:3058172.21.7.3:4371172.20.7.3:3062

Protocol

TCPTCPTCP

Inside Local IP Address: Port

10.1.1.1:8010.1.1.2:8010.1.1.3:80

Internet

Inside

10.1.1.1

Host B172.20.7.34 5

SA10.1.1.1

DA10.1.1.1

SA10.1.1.127

DA10.1.1.127

10.1.1.2

10.1.1.1

13

2

Host C172.21.7.3

10.1.1.127

10.1.1.3

Virtualhost

Realhosts

Page 11: N at

14-11—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Handling Overlapping Networks

Internet

10.1.1.1DNS ser ver

x.x.x.x

Host C10.1.1.3

Inside Local IP Address

10.1.1.1

Inside Global IP Address

192.2.2.2

Outside Global IP Address

10.1.1.3

Outside Local IP Address

193.3.3.3

NAT table

DNS request for host C address

SA=192.2.2.2 DA=x.x.x.x

DNS response from x.x.x.x

10.1.1.1 message to host C

SA= x.x.x.x DA= 192.2.2.2 C= 10.1.1.3

SA= 192.2.2.2 DA= 10.1.1.3

10.1.1.1 message to host C

SA= 10.1.1.1 DA= 193.3.3.3

SA= x.x.x.x DA= 10.1.1.1 C= 193.3.3.3

DNS request for host C address

SA= 10.1.1.1 DA=x.x.x.x

Page 12: N at

14-12—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Static NAT Configuration Example

ip nat inside source static 10.1.1.1 192.168.2.2!interface Ethernet0 ip address 10.1.1.10 255.255.255.0 ip nat inside!interface Serial0 ip address 172.16.2.1 255.255.255.0 ip nat outside!

ip nat inside source static 10.1.1.1 192.168.2.2!interface Ethernet0 ip address 10.1.1.10 255.255.255.0 ip nat inside!interface Serial0 ip address 172.16.2.1 255.255.255.0 ip nat outside!

Maps the inside local address to the inside global address.

This interface connected to the outside world.

This interface connected to the inside network.

Page 13: N at

14-13—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

ip nat pool dyn-nat 192.168.2.1 192.168.2.254 netmask 255.255.255.0ip nat inside source list 1 pool dyn-nat!interface Ethernet0 ip address 10.1.1.10 255.255.255.0 ip nat inside!interface Serial0 ip address 172.16.2.1 255.255.255.0 ip nat outside! access-list 1 permit 10.1.1.0 0.0.0.255!

ip nat pool dyn-nat 192.168.2.1 192.168.2.254 netmask 255.255.255.0ip nat inside source list 1 pool dyn-nat!interface Ethernet0 ip address 10.1.1.10 255.255.255.0 ip nat inside!interface Serial0 ip address 172.16.2.1 255.255.255.0 ip nat outside! access-list 1 permit 10.1.1.0 0.0.0.255!

Dynamic NAT Configuration

Translate between inside hosts addressed from 10.1.1.0/24 to the globally unique 192.168.2.0/24 network.

This interface connected to the outside world.

This interface connected to the inside network.

Page 14: N at

14-14—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Configuring Inside Global Address Overloading

ip nat pool ovrld-nat 192.168.2.1 192.168.2.2netmask 255.255.255.0

ip nat inside source list 1 pool ovrld-nat overload!interface Ethernet0/0 ip address 10.1.1.10 255.255.255.0 ip nat inside!interface Serial0/0 ip address 172.16.2.1 255.255.255.0 ip nat outside!access-list 1 permit 10.1.1.0 0.0.0.255

ip nat pool ovrld-nat 192.168.2.1 192.168.2.2netmask 255.255.255.0

ip nat inside source list 1 pool ovrld-nat overload!interface Ethernet0/0 ip address 10.1.1.10 255.255.255.0 ip nat inside!interface Serial0/0 ip address 172.16.2.1 255.255.255.0 ip nat outside!access-list 1 permit 10.1.1.0 0.0.0.255

Page 15: N at

14-15—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Configuring TCP Load Distribution

ip nat pool real-hosts 10.1.1.1 10.1.1.126 prefix-length 24 type rotary

ip nat inside destination list 2 pool real-hosts!interface serial0 ip address 192.168.1.129 255.255.255.224 ip nat outside!interface ethernet0 ip address 10.1.1.254 255.255.255.0 ip nat inside!access-list 2 permit 10.1.1.127

ip nat pool real-hosts 10.1.1.1 10.1.1.126 prefix-length 24 type rotary

ip nat inside destination list 2 pool real-hosts!interface serial0 ip address 192.168.1.129 255.255.255.224 ip nat outside!interface ethernet0 ip address 10.1.1.254 255.255.255.0 ip nat inside!access-list 2 permit 10.1.1.127

Page 16: N at

14-16—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Configuring NAT to Translate Overlapping Addresses

ip nat pool net-2 192.2.2.1 192.2.2.254 prefix-length 24ip nat pool net-10 10.0.1.1 10.0.1.254 prefix-length 24 ip nat outside source list 1 pool net-2ip nat inside source list 1 pool net-10!interface Serial0 ip address 171.69.232.182 255.255.255.240 ip nat outside!interface Ethernet0 ip address 10.1.1.254 255.255.255.0 ip nat inside!access-list 1 permit 10.1.1.0 0.0.0.255

ip nat pool net-2 192.2.2.1 192.2.2.254 prefix-length 24ip nat pool net-10 10.0.1.1 10.0.1.254 prefix-length 24 ip nat outside source list 1 pool net-2ip nat inside source list 1 pool net-10!interface Serial0 ip address 171.69.232.182 255.255.255.240 ip nat outside!interface Ethernet0 ip address 10.1.1.254 255.255.255.0 ip nat inside!access-list 1 permit 10.1.1.0 0.0.0.255

Page 17: N at

14-17—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Router#sh ip nat transPro Inside global Inside local Outside local Outside globaltcp 192.168.2.1:11003 10.1.1.1:11003 172.16.2.2:23 172.16.2.2:23tcp 192.168.2.1:1067 10.1.1.1:1067 172.16.2.3:23 172.16.2.3:23

Router#sh ip nat transPro Inside global Inside local Outside local Outside globaltcp 192.168.2.1:11003 10.1.1.1:11003 172.16.2.2:23 172.16.2.2:23tcp 192.168.2.1:1067 10.1.1.1:1067 172.16.2.3:23 172.16.2.3:23

Verifying NAT

A translation for a Telnet is still active. Two different inside hosts appear on the outside with a single IP address.

Basic IP address translation

Unique TCP port numbers are used to distinguishbetween hosts.

Router#show ip nat transProInside global Inside local Outside local Outside global---192.2.2.1 10.1.1.1 --- --- ---192.2.2.2 10.1.1.2 --- ---

Router#show ip nat transProInside global Inside local Outside local Outside global---192.2.2.1 10.1.1.1 --- --- ---192.2.2.2 10.1.1.2 --- ---

IP address translation with overloading

Page 18: N at

14-18—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Router#debug ip natNAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [0]NAT: s=172.16.2.2, d=192.168.2.1->10.1.1.1 [0]NAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [1]NAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [2]NAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [3]NAT*: s=172.16.2.2, d=192.168.2.1->10.1.1.1 [1]NAT: s=172.16.2.2, d=192.168.2.1->10.1.1.1 [1]NAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [4]NAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [5]NAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [6]NAT*: s=172.16.2.2, d=192.168.2.1->10.1.1.1 [2]

Router#debug ip natNAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [0]NAT: s=172.16.2.2, d=192.168.2.1->10.1.1.1 [0]NAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [1]NAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [2]NAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [3]NAT*: s=172.16.2.2, d=192.168.2.1->10.1.1.1 [1]NAT: s=172.16.2.2, d=192.168.2.1->10.1.1.1 [1]NAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [4]NAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [5]NAT: s=10.1.1.1->192.168.2.1, d=172.16.2.2 [6]NAT*: s=172.16.2.2, d=192.168.2.1->10.1.1.1 [2]

Troubleshooting NAT

An example address translation inside-to-outside.

A reply to the packet sent.

An example TCP conversation, inside-to-outside.

* Indicates translation was in the fast path.

Page 19: N at

14-19—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Clearing NAT Translation Entries

All entries are cleared.

192.168.2.2 is cleared.

Router#sh ip nat transPro Inside global Inside local Outside local Outside globaltcp 192.168.2.1:11003 10.1.1.1:11003 172.16.2.2:23 172.16.2.2:23tcp 192.168.2.1:1067 10.1.1.1:1067 172.16.2.3:23 172.16.2.3:23router#clear ip nat trans *router#router#show ip nat trans

Router#sh ip nat transPro Inside global Inside local Outside local Outside globaltcp 192.168.2.1:11003 10.1.1.1:11003 172.16.2.2:23 172.16.2.2:23tcp 192.168.2.1:1067 10.1.1.1:1067 172.16.2.3:23 172.16.2.3:23router#clear ip nat trans *router#router#show ip nat trans

router#show ip nat transPro Inside global Inside local Outside local Outside globaludp 192.168.2.2:1220 10.1.1.2:1120 171.69.2.132:53 171.69.2.132:53 tcp 192.168.2.1:1100310.1.1.1:11003 172.16.2.2:23 172.16.2.2:23tcp 192.168.2.1:1067 10.1.1.1:1067 172.16.2.3:23 172.16.2.3:23router#clear ip nat trans udp inside 192.168.2.2 10.1.1.2 1220171.69.2.132 53 171.69.2.132 53 router#show ip nat transPro Inside global Inside local Outside local Outside globaltcp 192.168.2.1:11003 10.1.1.1:11003 172.16.2.2:23 172.16.2.2:23tcp 192.168.2.1:1067 10.1.1.1:1067 172.16.2.3:23 172.16.2.3:23

Page 20: N at

14-20—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Summary

After completing this chapter, you should be able to perform the following tasks:

• Identify how NAT and PAT solve the limited IP address problem and describe how they operate

• Configure NAT and PAT

• Verify NAT and PAT

Page 21: N at

14-21—BCRAN—Scaling IP Addresses with Network Address Translation Copyright © 1999, Cisco Systems, Inc.

Review Questions

• What is the difference between a simple translation entry and an extended translation entry? State how each is used.

• Give one or more examples when NAT could be used.

• Your networks are addressed using 10.1.1.0/24 subnets. Your ISP provides you a globally unique address of 192.1.1.0/24. What commands do you use to translate from 10.1.1.0/24 to 192.1.1.0/24?

• When viewing the output of the show ip nat translations command, how can you determine when an inside global address is being used for overloading inside global addresses?