Networking and TCP/IP Management



What is it? TCP/IP commands. Hardware? Terminology used
note: IP addresses and system names used in this example are non-existing (fictional). In all probability these IP addresses might be real addresses, I disclaim any responsibility constituting towards any wrong doing to machines/systems/networks/etc behind these IP addresses.



What is Networking?

The core of the strength of Unix machines are flexibility vis-a-vis networking. It will not be wrong to say that networking was first tested and developed successfully on Unix machines in late 1960's and early 1970's. Today core of Internet is run on Unix machines, which range from Lynix to Sun, HP to SCO. More then 70% of the Internet Service providers use Apache Web server which run on Unix Machines. Sun systems even developed diskless Unix machines networked to other machines. There are two types of protocols available on Unix machines, UDP and TCP/IP. Most Unix machines are connected through standard RJ45 cables with TCP/IP protocol. TCP/IP protocol was developed to network unix machines and now it has become Industry standard of communications on Internet. Model of TCP/IP is slightly different from OSI (OSI has seven layers TCP/IP four layers). TCP/IP consists of

Data is passed down the stack when it is being sent to the network, and up the stack when it is being received from the network. Each layer in the stack adds control (actual bytes) when it is sending and subtracts (actual bytes) when date is received and moved up the stack. For example, consider a data packet which consists of five bytes and you want to send it to your friend over Internet. So, application layer passes your data to transport layer which adds its control in bytes to this data making it data+application+transport and passes it to Internet layer which adds its control in bytes to data+application+transport+Internet layer and passes it to network access layer which adds its control and makes it data+application+transport+Internet+network access and sends all the bytes over network. Now receiving computer's network access first reads network bytes and compares it to its records and then strips data+application+transport+Internet+network to data+application+transport+Internet and pass it to its Internet layer, which reads and do its computation and strips it to data+application+transport and so forth until data is passed on to application layer.

Here is how telnet application works. You issue telnet command which sends out its bytes down the protocal stack and is transported to server computer. Server computer's network access layer passes it up the stack stripping down its controls bytes and at end to kernel. Kernel issues login: and sends it back to client. Then client enters its login name and so forth. Important files where all protocols are declared is called /etc/protocols, lowest layers looks at data and knows that those bytes being number 6 are on TCP protocol, etc. Then ports are defined in a file called /etc/services which is a part of application layer. If data comes with order to open port 25 (which is smtp or simple mail transport protocol) it knows which application to open for e-mail (sendmail).

an example few entries in /etc/protocols file

ip      0       IP      # internet protocol, pseudo protocol number
icmp    1       ICMP    # internet control message protocol
igmp    2       IGMP    # internet group management protocol
ggp     3       GGP     # gateway-gateway protocol
tcp     6       TCP     # transmission control protocol
pup     12      PUP     # PARC universal packet protocol
udp     17      UDP     # user datagram protocol

an example of few entries in /etc/services file

echo            7/tcp
echo            7/udp
netstat         15/tcp
ftp             21/tcp
telnet          23/tcp
smtp            25/tcp          mail
time            37/tcp          timserver
time            37/udp          timserver
name            42/tcp          nameserver
whois           43/tcp          nicname
back to top
Back to main page


TCP/IP configuration

To configure a host to run TCP/IP you will need the following information. Every host must have a unique IP address and hostname. If you are planning your LAN to be on Internet then you need to fill out an application with NIC (or whoever provides it) and you can buy true Internet network license for your LAN. Class C are cheapest and upto 255 hosts can be configured with IP supplied (price is still not less than $10,000). Depending on the networking consider following:

You will also need to make sure that TCP/IP is installed in kernel of your system. Although everything can be done from command line but I recommend using system administration utility for TCP/IP configuration. Using System admin utility to configure system can assure a correct configuration.

A configprogram is used to build an operational Unix kernel (for example Sco's netconfig).

RIP Routing information protocol and DNS domain name server are started by daemons at system startup. RIP uses routed and DNS uses named daemon. Check your /etc/rc.local or /sbin/rc.* files or your startup files in init.d directory for more information. Internet daemon inetd is also started from bootup and it reads configuration file /etc/inetd.conf. Example inetd.conf file

ftp     stream  tcp     nowait  root    /usr/local/etc/ftpd     ftpd
telnet  stream  tcp     nowait  root    /usr/etc/in.telnetd     in.telnetd
name    dgram   udp     wait    root    /usr/etc/in.tnamed      in.tnamed
# Shell, login, exec, comsat and talk are BSD protocols.
shell   stream  tcp     nowait  root    /usr/etc/in.rshd        in.rshd

subnet masking concept is used to overcome distance limitations (by assigning a new ip address to join cables each time over 500 metres (for ethernet), 300 meters (for thin TWP), is used to interconnect dissimilar physical networks (i.e. two different LANs, one token ring and another ethernet), is used to filter traffic between networks (local traffic stays on local subnet, only traffic for other networks is forwarded to gateway).

ifconfig command is used to configure TCP/IP on system. Here are different uses of ifconfig: ifconfig -a will display information about interface on system. output is

le0: flags=63
        inet 198.87.24.223 netmask ffffff00 broadcast 206.2.114.0
lo0: flags=49
        inet 127.0.0.1 netmask ff000000 

ifconfig le0 126.98.23.2 netmask 255.255.255.0 broadcast 126.98.23.255 will assign a subnet mask to le0 interface.

To take a value from file while assigning subnet mask, i.e. apples 255.255.255.0 is entry in /etc/networks and if you enter ifconfig le0 128.98.23.2 netmask apples it will work just as example before.

To check the interface named le0 enter ifconfig le0. Output is:

le0: flags=63
        inet 198.87.24.223 netmask ffffff00 broadcast 198.87.24.0

To assign an IP address to a network interface, enter ifconfig le0 224.65.0.12 .

dmesg collects system diagnostic messages to form error log and displays on screen. (obsolete by syslogd).

syslogd is the syslogd daemon that reads and logs messages to a set of files described in the /etc/syslog.conf configuration file.

netstat command displays network statistics. i.e. to check the status of all network interfaces enter, netstat -ain output looks like:

Name  Mtu  Net/Dest      Address        Ipkts  Ierrs Opkts  Oerrs Collis Queue 
le0   1500 198.87.24.14  198.87.24.223  7138249 0    4529943 5    13018  0     
lo0   1536 127.0.0.0     127.0.0.1      1405521 0    1405521 0    0      0   

netstat -rn will display a routing table.

For more information about netstat, enter man netstat.
back to top
Back to main page



Hardware needed?

In order to make a simple network with PCs you need following. Let's say you need a small network with 10 PCs


back to top
Back to main page


Networking Terminology

The hardest part of networking to learn is probably its terminology.


back to top
Back to main page




Fundamentals of Unix Unix commands User Accounts Shell Programming
File Systems Networking Backups Security
Installing software Installing Hardware Performance and Tuning Some Useful Scripts

Your suggestions and comments are welcome. Please e-mail me
Copyright reserved with Sandeep S Bajwa.