An Example Network
In the diagram below, the earlier hardware wiring example is modified to show the network without the hubs. It also shows IP addresses assigned to each interface card. As you can see there are two networks which are 192.168.1.x and 192.168.2.x. Machines A through F are on network 192.168.1.x. The machines X and Z are on network 192.168.2.x, and machine G has access to both networks.
NIC A B C D E F G X Z
eth0 192.168.1.7 192.168.1.6 192.168.1.5 192.168.1.4 192.168.1.3 192.168.1.2 192.168.1.1 192.168.2.2 192.168.2.3
eth1 - - - - - - 192.168.2.1 - -
Using this port and addressing scheme, the networking system can pass data, addressing information, and type of service information through the hardware, from one computer to another. The reason, there is an address for the hardware card (ethernet address, also called MAC address), and another assigned address for that same card (IP address), is to keep the parts of the network system that deal with the hardware and the software, independent of each other. This is required in order to be able to configure the IP addressing dynamically. Otherwise, all computers would have a static address and this would be very difficult to manage. Also, if a modification needs to be made to the hardware addressing scheme for any reason, in ethernet, it will be transparent to the rest of the system. Conversely if a change is made to the software addressing scheme in the IP part of the system, the ethernet and TCP protocols will be unaffected.
In the example above, machine F will send a telnet data packet to machine A. Roughly, the following steps occur.
1. The Telnet program in machine F prepares the data packet. This occurs in the application (Telnet),
presentation, and session layers of the OSI network model.
2. The TCP software adds a header with the port number, 23, to the packet. This occurs in the transport (TCP) layer.
3. The IP software adds a header with the sender's and recipient's IP address, 192.168.1.2 to the packet. This occurs in the network (IP) layer.
4. The ethernet header is added to the packet with the hardware address of the network card and the packet is transmitted. This occurs in the link (Ethernet) layer.
5. Machine A's network card detects it's address in the packet, retrieves the data, and strips its header data and sends it to the IP layer.
6. The IP layer looks at the IP header, and determines if the sender's IP address is acceptable to provide service to (hosts.allow, hosts.deny, etc), and if so, strips the IP header and sends it to the TCP layer.
7. The TCP Layer reads the port number in it's header, determines if service is provided for that port, and what application program is servicing that port. It strips the TCP header and passes the remainder of the data to the telnet program on machine A. Please note, that the network layers mentioned here are described in the next section. Also there are many types of support at each of the four TCP/IP network system layers, but that issue is addressed in the next section.