Page 291 - DCAP403_Operating System
P. 291
Operating System
Notes every ethernet device has a unique address. Any ethernet frame transmitted to that address will
be received by the addressed host but ignored by all the other hosts connected to the network.
These unique addresses are built into each ethernet device when they are manufactured and it is
usually kept in an SROM on the ethernet card. Ethernet addresses are 6 bytes long, an example
would be 08-00-2b-00-49-A4. Some ethernet addresses are reserved for multicast purposes and
ethernet frames sent with these destination addresses will be received by all hosts on the network.
As ethernet frames can carry many different protocols (as data) they, like IP packets, contain a
protocol identifier in their headers. This allows the ethernet layer to correctly receive IP packets
and to pass them onto the IP layer.
In order to send an IP packet via a multi-connection protocol such as ethernet, the IP layer must
find the ethernet address of the IP host. This is because IP addresses are simply an addressing
concept, the ethernet devices themselves have their own physical addresses. IP addresses on the
other hand can be assigned and reassigned by network administrators at will but the network
hardware responds only to ethernet frames with its own physical address or to special multicast
addresses which all machines must receive. Linux uses the Address Resolution Protocol (or
ARP) to allow machines to translate IP addresses into real hardware addresses such as ethernet
addresses. A host wishing to know the hardware address associated with an IP address sends
an ARP request packet containing the IP address that it wishes translating to all nodes on the
network by sending it to a multicast address. The target host that owns the IP address, responds
with an ARP reply that contains its physical hardware address. ARP is not just restricted to
ethernet devices, it can resolve IP addresses for other physical media, for example FDDI. Those
network devices that cannot ARP are marked so that Linux does not attempt to ARP. There is
also the reverse function, Reverse ARP or RARP, which translates physical network addresses
into IP addresses. This is used by gateways, which respond to ARP requests on behalf of IP
addresses that are in the remote network.
13.9.2 The Linux TCP/IP Networking Layers
Just like the network protocols themselves, Figure 13.13 shows that Linux implements the internet
protocol address family as a series of connected layers of software. BSD sockets are supported by
a generic socket management software concerned only with BSD sockets. Supporting this is the
INET socket layer, this manages the communication end points for the IP based protocols TCP
and UDP. UDP (User Datagram Protocol) is a connectionless protocol whereas TCP (Transmission
Control Protocol) is a reliable end to end protocol. When UDP packets are transmitted, Linux
neither knows nor cares if they arrive safely at their destination. TCP packets are numbered
and both ends of the TCP connection make sure that transmitted data is received correctly. The
IP layer contains code implementing the Internet Protocol. This code prepends IP headers to
transmitted data and understands how to route incoming IP packets to either the TCP or UDP
layers. Underneath the IP layer, supporting all of Linux’s networking are the network devices,
for example PPP and ethernet. Network devices do not always represent physical devices; some
like the loopback device are purely software devices. Unlike standard Linux devices that are
created via the mknod command, network devices appear only if the underlying software has
found and initialized them. You will only see /dev/eth0 when you have built a kernel with
the appropriate ethernet device driver in it. The ARP protocol sits between the IP layer and the
protocols that support ARPing for addresses.
284 LOVELY PROFESSIONAL UNIVERSITY