Ethernet switch Hosts Can talk using Ethernet addresses only
Ethernet switch Hosts Can talk using Ethernet addresses only Ethernet switch Hosts
Ethernet switch Hosts Ethernet switch Hosts Router Assign IP addresses A B C 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? How to tell A that B is reachable using the local Ethernet, while C is not? Interface subnet mask (also just “mask”) Interface subnet mask (also just “mask”) Assigned at configuration Assigned at configuration
Using the mask A does a bit-wise AND of its interface IP address and mask A does a bit-wise AND of its interface IP address and mask Result: identification of own network [say x] Result: identification of own network [say x] For any host H with dest IP addr DA For any host H with dest IP addr DA –DA & mask = y [say] IF x = y, A thinks H is on its own network 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 = y, A thinks H is directly connected If x not equal to y 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 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 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 In either case, actual packet transfer uses link layer frames Directly connected Link layer dest addr = link layer address of host Directly connected Link layer dest addr = link layer address of host Indirectly connected Link layer dest addr = link layer address of router Indirectly connected Link layer dest addr = link layer address of router
Re-iteration Directly or indirectly connected Directly or indirectly connected –From a host’s viewpoint IP level (logical) notion IP level (logical) notion Must consider 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? How to find link layer addresses from IP addresses? Address Resolution Protocol (ARP) Address Resolution Protocol (ARP) Query: “Who has ”? Query: “Who has ”? Queries are broadcast Queries are broadcast Machine with IP address sends an ARP reply, supplying Ethernet address Machine with IP address sends an ARP reply, supplying Ethernet address
Directly connected host X Directly connected destination X – ARP for X Directly connected destination X – ARP for X Indirectly connected destination Y – ARP for R Indirectly connected destination Y – ARP for R Direct and Indirect Routes IP address of XLayer 2 address of XDataIP address of YLayer 2 address of RData
/ / / / / / 24 Single physical network but 2 logical subnets
Ethernet PPP ABCD Mask = or / 27 B wants to send pkt to A; directly connected? B wants to send pkt to D; directly connected?
Variable length subnet masks B Subnet mask: Subnet mask: On different interfaces, subnet masks of different length
Special IP addresses Diskless X terminal Server Want to get boot file from a server
Special IP addresses The diskless ws downloads the bootstrap file name from a server, and then the file The diskless ws downloads the bootstrap file name from a server, and then the file No IP address, no subnet mask available initially 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 But the IP network must be used
Special IP addresses Protocols: “BOOTP” and “TFTP” Protocols: “BOOTP” and “TFTP” BOOTP The name of the bootfile BOOTP The name of the bootfile TFTP To transfer the file TFTP To transfer the file BOOTP UDP IP Eth TFTP UDP IP Eth
Special IP addresses Special IP addresses What should be the source and destination IP addresses in the BOOTP andTFTP requests? What should be the source and destination IP addresses in the BOOTP andTFTP requests? –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? How does a server send its reply to the host that sent the query? Uses link layer (e.g., Ethernet) address Uses link layer (e.g., Ethernet) address The query arrived in an Eth frame The query arrived in an Eth frame Host’s Eth address: in Src Eth address of frame Host’s Eth address: in Src Eth address of frame
Other special IP addresses –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 127.x.y.z –Valid source and destination address –Loopback interface address
More special IP addresses Net-directed broadcast address Net-directed broadcast address –Netid and hostid –Set the hostid bits to 1 Subnet-directed broadcast address 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 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 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 The table provides information on the next-hop IP address, the outgoing interface etc
Routing Table Typical entries 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 DestMaskG/wFlagsIntfc S.A.D.A. Different things
Routing Table: Basic Operation Pick up the packet’s destination address Pick up the packet’s destination address Apply the routing table mask Apply the routing table mask The network-prefix of the packet’s destination address is extracted The network-prefix of the packet’s destination address is extracted Now match this extracted id with entries in the column named “Destination” 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 If match is seen, obtain the next hop address from the “Gateway” column Flags: Flags: –H present “Destination” column represents a host –H absent “Destination” column represents a collection of hosts
Routing table (contd) Flags (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 Destination address type: H flag or no H flag N/wHost Connection type: G flag or no G flag Direct Indirect
/ x / x / x / x / 19 Router /19 X What will the routing table of X look like?
Routing Table / 19 = / 19 = x / 19 = x / 19 = x / 19 = x / 19 = All addresses share a common 19 bit prefix: All addresses share a common 19 bit prefix: – A single entry should be used to communicate with all hosts on the LAN A single entry should be used to communicate with all hosts on the LAN