Transcript Document
Ethernet switch
Hosts
Can talk using Ethernet addresses only
Ethernet switch
Hosts
Can talk using Ethernet addresses only
Ethernet switch
Hosts
Router
Ethernet switch
Ethernet switch
A
Hosts
B
Hosts
C
Assign IP addresses
A B, want communication using Ethernet addresses only
A C, via router
So, use router interface’s Ethernet address
Problem
How to tell A that B is reachable using the local
Ethernet, while C is not?
Interface subnet mask (also just “mask”)
Assigned at configuration
Using the mask
A does a bit-wise AND of its interface IP address
and mask
Result: identification of own network [say x]
For any host H with dest IP addr DA
– DA & mask = y [say]
IF x = y, A thinks H is on its own network
Using the mask
IF x = y, A thinks H is directly connected
If x not equal to y
– A talks to H via router
– A thinks H is indirectly connected
Implications
If A thinks H is directly connected to it
– then A attempts to find Ethernet address of H
If A thinks H is indirectly connected to it
– then A attempts to find Ethernet address of router
interface
Observe…
In either case, actual packet transfer uses
link layer frames
Directly connected Link layer dest addr = link
layer address of host
Indirectly connected Link layer dest addr =
link layer address of router
Re-iteration
Directly or indirectly connected
– From a host’s viewpoint
IP level (logical) notion
Must consider
– Host interface address
– Host interface mask
– Destination machine’s interface address
IP addr to link addr
How to find link layer addresses from IP
addresses?
Address Resolution Protocol (ARP)
Query: “Who has 10.114.1.25”?
Queries are broadcast
Machine with IP address 10.114.1.25 sends an
ARP reply, supplying Ethernet address
Direct and Indirect Routes
connected
destination
•Directly
Directly
connected
host X X – ARP for X
Layer 2 address of X
IP address of X
Data
Indirectly connected destination Y – ARP for R
Layer 2 address of R
IP address of Y
Data
10.3.2.2 / 24
10.3.3.2 / 24
10.3.2.1 / 24
10.3.3.1 / 24 10.3.2.3 / 24
10.3.3.3 / 24
Single physical network but 2 logical subnets
Mask = 255.255.255.224 or
/ 27
.13.65
D
.13.66
PPP
C
.13.35
B
140.252.13.33
Ethernet
B wants to send pkt to A; directly connected?
B wants to send pkt to D; directly connected?
A
.13.34
Variable length subnet masks
On different interfaces, subnet masks of different length
Subnet mask:
255.255.255.0
140.252.1.29
B
140.252.13.33
Subnet mask:
255.255.255.224
Special IP addresses
Diskless X terminal
Want to get boot file from a server
Server
Special IP addresses
The diskless ws downloads the bootstrap file
name from a server, and then the file
No IP address, no subnet mask available initially
– Perhaps no fixed IP address for this machine
– To be obtained dynamically
But the IP network must be used
Special IP addresses
Protocols: “BOOTP” and “TFTP”
BOOTP The name of the bootfile
TFTP To transfer the file
BOOTP
TFTP
UDP
UDP
IP
IP
Eth
Eth
Special IP addresses
What should be the source and destination IP
addresses in the BOOTP andTFTP requests?
0.0.0.0
– Valid source address; never a dst address
– Used when the sender does not know its addr
Special IP addresses
How does a server send its reply to the host that
sent the query?
Uses link layer (e.g., Ethernet) address
The query arrived in an Eth frame
Host’s Eth address: in Src Eth address of frame
Other special IP addresses
255.255.255.255
– Valid destination address: “limited broadcast”
– Never a source address
– Never forwarded by a router beyond the
physical network in which the router is present
Other special IP addresses
127.x.y.z
– Valid source and destination address
– Loopback interface address
More special IP addresses
Net-directed broadcast address
– Netid and hostid
– Set the hostid bits to 1
Subnet-directed broadcast address
– Netid, subnetid and hostid
– Set the hostid bits to 1
Routing Table
Each machine, whether end-host or router, has a
routing table in the kernel
This table is consulted every time a packet has
to be sent out
The table provides information on the next-hop
IP address, the outgoing interface etc
Routing Table
Typical entries
– Destination network (netid or net-subnetid) or host
Note: This “destination” is the name of a column in r. table,
not in packet
– Routing table mask
– Next-hop IP address (often denoted as “gateway”)
Routing Table
– Outgoing interface
– Flags to indicate whether
destination address (in table) is a network/host
address
destination (in table) is directly connected
Routing Table
Dest
Different
things
S.A. D.A.
Mask G/w Flags Intfc
Routing Table: Basic Operation
Pick up the packet’s destination address
Apply the routing table mask
The network-prefix of the packet’s destination
address is extracted
Now match this extracted id with entries in
the column named “Destination”
Routing table (contd)
If match is seen, obtain the next hop address
from the “Gateway” column
Flags:
– H present “Destination” column represents a host
– H absent “Destination” column represents a
collection of hosts
Routing table (contd)
Flags (contd)
– G present Addresses aggregated in “Destination”
column indirectly connected
– “G” suggests “gateway”
– G absent Addresses aggregated in “Destination”
column directly connected
Routing Table
Indirect
Direct
N/w
Host
Destination address type: H flag or no H flag
144.16.68.x / 19
Router
X
144.16.64.1/19
144.16.66.x / 19
144.16.72.x / 19
144.16.68.2 /19
144.16.79.x / 19
What will the routing table of X look like?
Routing Table
144.16.68.2 / 19 = 144.16.64.0
144.16.66.x / 19 = 144.16.64.0
144.16.72.x / 19 = 144.16.64.0
All addresses share a common 19 bit prefix:
– 144.16.64.0
A single entry should be used to communicate
with all hosts on the LAN