In this module, we will cover the basic commands necessary to connect a UNIX machine to a network.
By the end of this module, you will be able to:
- Configure the resolver library to arrange for TCP/IP name service
- Bring interfaces up and down, and set their IP addresses and netmasks
- Set the default route in the kernel routing table
- Every computer (or device) directly connected to the Internet should have it's own IP address and that address must be unique.
- Every current IP address is composed of 32 bits, generally separated into groups of 8 to make it more human readable. Each group of 8 bits is called an octet.
- A bit is binary and is either a 0 or 1.
- The numbers for each set of 8 bits, when converted to decimal range from 0 to 255. The octets are separated by dots. For example, 192.168.4.1 is an IP address.
- Each IP address is composed of a network part and a host part, determined by the subnet mask.
- To really understand how the IP numbers work and are derived (especially for subnetting), you should learn binary to decimal conversions.
- TCP/IP is virtually a universal protocol. All major (and most minor) OS's support it.
Internetworking with Linux has been the most popular choice of developers. Not only in the server world where Linux has made its mark but also in the small embedded network OS market, Linux is the most popular choice.
All this requires an understanding of the TCP/IP code base. Some products require implementation of a firewall, and others require implementation of IPSec. There are products that require modifications in the TCP connection code for load balancing in a clustered
environment. Some products require improving scalability on SMTP machines. Most talked about is the embedded world, where networking is most popular. Real time embedded products have very specific requirements and need huge modifications to the stack as far as buffer management is concerned or for performance reasons.
All these require a complete understanding of stack implementation and the supporting framework.
As mentioned above, some of the embedded networking products require a minimum of the code to be complied because of the memory requirements. This requirement involves knowledge of source code organization in the Linux source distribution. Once we know how the code is distributed, it becomes easier to find out the relevant code in which we are interested.
Mostly all the networking application work on very basic client-server technology. The server is listening on a well- known port for connection requests while the client is sending out connection request to the server.
Many complex arrangements are made for security reasons or sometimes for load balancing to the client- server technology. But the basic implementation is a simple client server program in which the client and server talk to each other.
For example, telnet or ftp services are accessed through the inet program which hides all the details of services. There are many tunable parameters available to tune your TCP/IP connections. These can be used to best tune the connection without disturbing overall system wide tuning.
Most of the network applications are written to exchange data. Once a connection is established, either
- the client sends data to the server or
- data flow in the opposite direction or may flow in both directions.
There are different ways to send and receive data over the connection. These different techniques may differ in the way that application blocks once the socket connection either receive or send data.
In this module we discuss only TCP and no other transport protocol. So, we need to understand the TCP connection process.
TCP is a connection-oriented protocol that has a set process for initializing connections, and similarly it has a set process for closing connection cleanly.
TCP maintains state for the connection because of handshakes during connection initiation and closure processes.
We need to understand the TCP states to completely understand the TCP connection process.
In this chapter we will present an overview of how the TCP/IP protocol stack is implemented on Linux. We need to understand the Linux operating system, including the process, the threads, the system call, and the kernel synchronization mechanism.
All these topics are covered though not in great detail. We also need to understand the application programming interface that uses a TCP/IP protocol stack for data transmission, which is discussed.
We discuss socket options with kernel implementation. Finally, we discuss the TCP state, which covers a three- way handshake for opening connection and a four - way handshake for connection closure.