ARP and RARP

advertisement
• Point-to-Point Protocol
• Data Link Layer Loopback
• ARP and RARP
© Jörg Liebeherr (modified by M. Veeraraghavan)
1
Orientation
• We are still talking about the Data Link Layer.
Network
Layer
Data Link
Layer
Network
Layer
Data Link
Layer
Physical
Layer
Physical
Layer
• Last Lecture we discussed
protocols in broadcast LAN
networks.
© Jörg Liebeherr (modified by M. Veeraraghavan)
2
Orientation 2
Data Link
Layer
• We learned that in broadcast LANs, the Link Layer is divided
in two sublayers:
to Network Layer
– Media Access Control (MAC)
Logical Link
Control
– Logical Link Control (LLC)
Medium Access
Control
to Physical Layer
• We discussed the IEEE 802 family of LAN standards:
802.3
802.4
802.5
© Jörg Liebeherr (modified by M. Veeraraghavan)
CSMA/CD (Ethernet)
Token Bus
Token Ring
3
PPP - Point-to-Point Protocol
• The PPP protocol is a data link protocol for transmission on a
serial link.
• Currently, most ISPs offer Internet
access to dial-in users over PPP.
• The main purpose of PPP is
encapsulation of IP datagrams,
but it can be used for other
network protocols as well.
Point-to-Point Network
• PPP was proposed in 1992; a predecessor of PPP was the
Serial Link IP (SLIP) protocol.
© Jörg Liebeherr (modified by M. Veeraraghavan)
4
PPP - IP encapsulation
• PPP suports an asynchronous link (8 data bits/no parity) or a
bit-oriented synchronous link.
• The frame format of PPP is similar to the 802.2 LLC frame
format:
flag
addr ctrl
7E
FF
03
1
1
1
© Jörg Liebeherr (modified by M. Veeraraghavan)
protocol
CRC
data
flag
7E
2
<= 1500
0021
IP datagram
C021
link control data
8021
network control data
2
1
296 if low delay
5
PPP - Escape sequences
• If a data byte is 0x7e, how does the receiver know whether
this is the end of a PPP frame or if it is a data byte?
– PPP on synchronous links
• Hardware bit stuffing is used to handle this
– PPP on asynchronous links
• Escape sequences are used
– The byte 0x7e is transmitted as the 2-byte sequence
0x7d, 0x5e
– The byte 0x7d is transmitted as the 2-byte sequence
0x7d, 0x5d
© Jörg Liebeherr (modified by M. Veeraraghavan)
6
PPP - Link Control Protocol
• The link control protocol (LCP) of PP is responsible for
establishing, configuring, and negotiating the data-link
connection.
• LCP is specified in RFC 1331.
© Jörg Liebeherr (modified by M. Veeraraghavan)
7
PPP Network Control Protocol
• For each network layer protocol supported by PPP, there is
one network control protocol (NCP).
•
The NCP for IP is specified in RFC 1332.
© Jörg Liebeherr (modified by M. Veeraraghavan)
8
Loopback Interface
• Most TCP implementations have a loopback interface with IP
address 127.0.0.1 and name localhost.
• The localhost behaves as a separate data link interface.
• A packet that is sent to the loopback interface moves down
the protocol stack and is returned back by the driver software
for the localhost “device”.
127.0.0.1
• Used for debugging, but also
IP Protocol
for multicasting and broadcasting.
loopback
drivers
© Jörg Liebeherr (modified by M. Veeraraghavan)
Ethernet drivers
9
Processing of IP packets by network drivers
IP Input
IP Output
Put on IP
input queue
Yes
Yes
IP destination = multicast
or broadcast ?
No
IP destination of packet
= local IP address ?
loopback
Driver
Put on IP
input queue
No: get MAC
address with
ARP
Ethernet
Driver
ARP
ARP
Packet
IP datagram
demultiplex
Ethernet Frame
Ethernet
© Jörg Liebeherr (modified by M. Veeraraghavan)
10
Maximum Transmission Unit
• The frame size limit of the data link protocol translates itself to
a limit on the size of the IP datagram that can be
encapsulated.
• This limit is called maximum transmission unit (MTU).
• MTUs for various data link layers:
Ethernet:
1500
FDDI:
4352
802.3:
1492
ATM AAL5: 9180
802.5:
4464
PPP:
296
• What if the size of an IP datagram exceeds the MTU?
IP datagram is fragmented into smaller units.
• What if the route contains networks with different MTUs?
© Jörg Liebeherr (modified by M. Veeraraghavan)
11
ARP and RARP
• The IP protocol uses 32-bit addresses.
• Data link protocols (Ethernet, FDDI, ATM) may have different
(MAC) addresses.
• The ARP and RARP protocols perform the translation
between IP addresses and MAC layer addresses.
• We will discuss ARP for broadcast LANs, particularly Ethernet
LANs.
IP address
(32 bit)
ARP
RARP
© Jörg Liebeherr (modified by M. Veeraraghavan)
Ethernet MAC
address
(48 bit)
12
Address Translation
(1) HOST-A wants to send an IP
datagram to HOST-B.
(2) HOST-A broadcasts an ARP
request to all stations on the
network: “What is the hardware
address of HOST-B?”
(3) HOST-B responds with an ARP
Reply which contains its
hardware address.
(4) HOST-A transmits the IP
datagram to HOST-B.
HOST-A HOST-B
IP
1
IP
ARP
ARP
Ethernet
Driver
Ethernet
Driver
3
2
4
© Jörg Liebeherr (modified by M. Veeraraghavan)
13
ARP Packet Format
28 byte ARP request/reply
Ethernet header
Ethernet
Ethernet frame
hw
prot
hw
Dest
Source
type
type
size size fld.
2
2
1
6
6
type
2
prot op
1
2
sender
sender
target
target
Eth. addr
IP addr
Eth. addr
IP addr
6
4
6
4
• Ethernet destination: ff:ff:ff:ff:ff:ff is broadcast address
•
•
•
•
•
•
Ethernet Source address: That of ARP request sending host
frame type:
“0x0806” for ARP request/reply
hw type:
“1” for Ethernet MAC addresses
prot type:
“0x0800” for IP addresses
hw size, prot size:
size of the respective address in bytes.
Op field:
1 = ARP request
2 = ARP reply
3 = RARP request
4 = RARP reply
• Interesting: Both your textbook and RFC 826 do not mention a CRC
field at the end of an ARP frame
© Jörg Liebeherr (modified by M. Veeraraghavan)
14
ARP reply
• The ARP reply is sent by the node whose IP address matches
the address in the target IP address field of the ARP request
– It fills its MAC address into the target Ethernet address
field of the ARP request
– It then swaps the two sender addresses (Ethernet and IP
addresses) with the two target addresses, sets the op field
to 2, and sends the ARP reply
– The ARP reply is sent back to the source host only
• All other nodes receiving the broadcast ARP ignore the
request (since their IP addresses do not match the address
that is being resolved)
© Jörg Liebeherr (modified by M. Veeraraghavan)
15
Example with tcpdump
rigoletto
128.238.42.112
0:0:86:7:4d:a9
10:58:15.255050
10:58:15.255182
10:58:15.255671
aida
128.238.32.114
0:80:c6:ff:9:99
0:0:86:7:4d:a9 Broadcast arp 60:
arp who-has aida.poly.edu tell rigoletto.poly.edu
0:80:c6:ff:9:99 0:0:86:7:4d:a9 arp 60:
arp reply aida.poly.edu is-at 0:80:c6:ff:9:99
0:0:86:7:4d:a9 0:80:c6:ff:9:99 ip 60:
rigoletto.poly.edu.1042 > aida.poly.edu.telnet:
S 6219463:6219463(0) win 8192 <mss 1460> (DF)
© Jörg Liebeherr (modified by M. Veeraraghavan)
16
ARP Cache
• Clearly, sending an ARP request/reply for each IP datagram is
inefficient.
• Each station maintains a cache (ARP Cache) of current
entries. The entries expire after 20 minutes.
• Everytime the ARP cache is consulted for a MAC address, the
expiry timer is reset in common implementations.
• ARP cache of aida.poly.edu:
dibner-gw.poly.edu (128.238.42.1) at 0:0:c:1:a2:e
ebbets.poly.edu (128.238.42.29) at 8:0:20:7a:da:44
mng.poly.edu (128.238.42.105) at 0:60:8:3:93:41
aida.poly.edu (128.238.42.114) at 0:80:c6:ff:9:99 permanent
mare.poly.edu (128.238.42.247) at (incomplete)
© Jörg Liebeherr (modified by M. Veeraraghavan)
17
Things to know about ARP
• What happens if an ARP Request is made for a non-existing
host?
Several ARP requests are made with increasing time
intervals between requests. Eventually, ARP gives up.
• What if a host sends an ARP request for its own IP address?
The other machines respond (gratuitous ARP) as if it
was a normal ARP request.
This is useful for detecting if an IP address has already
been assigned.
• Routers can respond to an ARP request for a host that is on
a different subnet (Proxy ARP)
© Jörg Liebeherr (modified by M. Veeraraghavan)
18
Proxy ARP
• Router answers an ARP request on one of its networks for a
host on another of its networks
• netb answers as a “proxy” for sun.
gemini
ARP request for 140.252.1.29
Ethernet subnet 140.252.1
ARP reply
140.252.1.183
netb
PPP link
140.252.1.29
Ethernet subnet
140.252.13
© Jörg Liebeherr (modified by M. Veeraraghavan)
sun
140.252.13.33
19
RARP - Reverse ARP
• Reverse ARP (RARP) performs a translation from a physical
(MAC) address into a logical (IP) address.
• When does one need RARP?
Hosts without secondary storage (e.g., Xterminals) do not know their IP address when they
are booted.
• Packet format is the same as in ARP:
– frame type:
– Op field:
© Jörg Liebeherr (modified by M. Veeraraghavan)
“0x0806” for ARP request/reply
3 = RARP request
4 = RARP reply
20
Example from Textbook
• A diskless host with name “sun” boots up:
1.
0.0
8:0:20:3:f6:42
ff:ff:ff:ff:ff:ff
rarp 60:
rarp who-is 8:0:20:3:f6:42 tell 8:0:20:3:f6:4
This is the broadcast RARP request
2.
0.13
0:0:c0:6f:2d:40 8:0:20:3:f6:42
rarp 42:
rarp reply 8:0:20:3:f6:42 at sun
This is the response which contains the complete IP
address
3.
0.14
8:0:20:3:f6:42
0:0:c0:6f:2d:40 ip 42:
sun.26999 > bsdi.tftp: 23 RRQ “8CFC0D21.SUN4C”
Request to setup an TFTP read-request for
bootstrapping.
© Jörg Liebeherr (modified by M. Veeraraghavan)
21
Hub vs. switch
• An ethernet hub simply broadcasts frames received on
any one port to all other ports
• An ethernet switch learns (knows) the MAC addresses of
its hosts on all its ports and sends a frame received on
one port to only the link connected to the destination of
the frame
– Multiple hosts can send frames into the ethernet
switch at the same time; if two packets arriving
simultaneously at a switch are destined to the same
output port of the switch, one will be buffered while
the other is transmitted
© Jörg Liebeherr (modified by M. Veeraraghavan)
22
Download