Transcript Lecture 21

CS 453
Computer Networks
Lecture 21
Layer 3 Network Layer
Network Layer of the Internet
IP Network Address Translation
NAT
NAT





Remember that IP addresses should be
unique – Globally, Universally
There are not really enough IP addresses to
go around
Many situations where you have a single
“legitimate” IP address
So, how do you expand your local area
network with that single address
Network Address Translation - NAT
IP Network Address Translation
NAT
NAT






Common scenario—
You buy a cheap ethernet switch/router from Nerd-RUs to install at home
Your connect it to your Cable modem
Your router acts like a single DHCP client – gets a
single IP address from the ISP
So, you hook up your mother-in-law’s computer,
Uncle Fred’s computer, and you throw a Cat5 cable
out the window to your neighbor and connect his
computer to your router
Ok, but…
IP Network Address Translation
NAT
NAT




Common scenario—
… you can’t all use the same ISP assigned IP
address…
How would packets know which host they are
going to, coming from
Network Address Translation
IP Network Address Translation
NAT
NAT

There are three special IP address ranges
Non-routable
Non-unique

These are
10.x.x.x
192.168.x.x
???


So the “backside” of the router issues DHCP
addresses too,…
…but these addresses are from the non-routable
families
IP Network Address Translation
NAT
NAT



Recall that the IP packet header contains the
IP address of the host, .
… but also the socket that the transport layer
is using
From the outside all hosts in our little LAN
look like they have the same IP address
IP Network Address Translation
NAT
NAT



The router creates a table…
The router assigns each internal host a port number,
along with the
The table maps the external IP+port to the internal IP in
the local LAN
External IP/Port
Internal IP
157.182.99.99/5050
10.0.0.15
157.182.99.99/5051
10.0.0.16
….
….
IP Network Address Translation
NAT
NAT
From: Tanenbaum, 2003, 446
IP Network Address Translation
NAT
NAT



NAT really irks a lot in the IP community
Violates the IP unique address rule
IP is connectionless, NAT creates a
connection
Must track state

Violates protocol layer convention
Dips into IP header (port address)


Breaks on some protocols (payload imbedded
addresses
Might not be able to scale to large subnet
ICMP
Internet Control Message Protocol




In addition to all the user, host to host
message traffic using IP protocol in the
network…
Routers, switches and other devices need to
talk to each other
…to keep the network running
They have their own protocol for doing this
ICMP
ICMP
Message
Meaning
Destination Unreachable
Packet could not be delivered
Time Exceeded
Timer/counter hit 0
Parameter Problem
Invalid header info
Source quench
Source swamping network
Redirect
Suggests new routing
Echo
Asks a destination to reply
Echo reply
Reply from echo request
Timestamp request
Asks for a reply with a timestamp
Timestamp reply
Reply from a timestamp request
Finding Etherland
At Layer 3 we are dealing with, routing by, etc.
IP and IP addresses
But within a LAN we are using the local Layer
2/1 technology
…for example, ethernet
Within an Ethernet LAN, it sends, receives,
routes ethernet frames, not IP packets
So, when a packet containing an IP address hits
an ethernet LAN,…
How does it know where to go?
ARP-Address Resolution Protocol
Once on the LAN the frames address
destination address must be set to the
MAC address of the destination host
interface
To do this---
ARP-Address Resolution Protocol
The sending machine





Reads the IP address from the message
Transmits an ARP request – “Who does this
belong to”
The IP address owner replies “Me” by
returning its MAC address
The sender assigns the received MAC to the
destination field in the frame header…
…and send the frame on its way
RARP
Reverse Address Resolution Protocol

What happens when you know the MAC
address but you need to know the IP
address?