55
1 Computer Networks, Internet and TCP/IP Edited by Metin Demiralp and Reformatted by Hüseyin Toros for presentation By being equipped with an information on the Unix operating system we focus our attention on to the concept of network, computer networks and Internet. When we deal with Internet we emphasize TCP and IP which are the most widely used fundamental tools for computer networks. We do not intend to give every details but just routes to the information we need for networking except the presentation of the most important elements.

1 Computer Networks, Internet and TCP/IP Edited by Metin Demiralp and Reformatted by Hüseyin Toros for presentation By being equipped with an information

  • View
    212

  • Download
    0

Embed Size (px)

Citation preview

1

Computer Networks, Internet and TCP/IP

Edited by Metin Demiralp and Reformatted by Hüseyin Toros for presentation

By being equipped with an information on the Unix operating system we focus our attention on to the concept of network, computer networks and Internet. When we deal with Internet we emphasize TCP and IP which are the most widely used fundamental tools for computer networks. We do not intend to give every details but just routes to the information we need for networking

except the presentation of the most

important elements.

2

communication• Consider two humans who want to

communicate. If they are at a distance which enables them to hear each other then they can use the speech as the tool of the communication. If the distance does not permit speech based communication to them then they need some other kind tools. These tools may be varying depending on the geography of the place where the communication takes place and the nature of the humans.

3

They do not hear (communicate) each other

He can take the information from

one communicatee and send it to the

other.

4

Nodes

the path used for

the transmission

of the information

between these

nodes is called

edge or connection

5

Informatics network which carries information from one node to the other.

We do not have to use only information for the entity to be transmitted. Instead the network may use water, petroleum, or natural gas ( pipelines ); or passengers amongst the airports ( airlines );

Therefore, the network concept has a more general nature. Mathematically speaking it is composed of nodes, edges and flow through edges between nodes. However here we are going to focus our attention on the informatics networks. Because of the today's reality the nodes are computers or their some peripherals and the edges are wire or wireless connections between these nodes. The flow is the information to be transmitted.

6

Computer Networks • The networks which are

composed of computers or their peripherals like printers are called computer networks. They can be classified in according to their features.

•Geographical Classification •Topological Classification •Protocol Based Classification •Architecture Based Classification

7

Geographical Classification One important property to this end is the geographical

position or housing of the network. If the computer network under consideration is in the same building or same location such that it does not require telephone or radio connection then it is called Local Area Network (LAN). For example, the student informatics labs in the Faculties of İTÜ are LANs. The whole network in the Ayazağa Campus of İTÜ can also be considered as a LAN. If some nodes of a network communicate through telephone lines or radio connections then the whole network is called Wide Area Network (WAN). There are modem connections between the Ayazağa and Maçka Campuses of İTÜ. Therefore the entire network of İTÜ should be considered as a WAN. The whole network of Turkey and the widest computer network of the entire world, Internet, are other examples of the WANs.

8

Topological ClassificationThe computer networks can be classified in

according to their topological structures, that is, geometrical arrangements of their nodes and edges. There are three basic types of topologies: bus, ring, and star. These are basically used in LANs.

9

In the bus topology all the nodes are connected to a single cable which is called bus or backbone. This type of LANs are called bus networks. They are relatively inexpensive and easy to install in small distances. There are two end points in these networks where the cable must be ended with some special devices called terminators. The obsolete BNC structures which were using coaxial cables in the backbone and had some special devices called T connector to connect each node to the backbone are good examples for the bus networks.

10

The ring networks are composed of nodes and connections such that all nodes are connected in a loop. Therefore each device is directly connected to two other devices. These networks are relatively expensive and not easy to install. However each node regenerate the message as the messages pass through it. This enables them to span large distances.

11

The star networks consist of nodes which are directly connected to a central device called hub. The hub is a multiport system which copies a signal to all ports when it comes to one of the ports. The passive hubs just enable data to go from one device to another without any extra management.

The manageable somehow intelligent hubs give the capability of managing the routing and some other network facilities to the administrator.

12

The third type of hub is called switching hub and checks the address of each data packet and then sends it to the related port. These hubs increase the communication efficiency in the networks and are relatively expensive than the passive hubs. The mixtures of these three type networks can also be used in the networks.

13

WANs we can use mixtures of these networks.

14

is an agreement which defines a common set of rules and signals to be used for the communication by the computers on the network. One of the most widely used protocols for the LANs is called Ethernet while the another popular protocol for the personal computers is the IBM token--ring network. Ethernet uses a star or bus topology.

It supports data transfer rates of 10 Mbps ( Mega Bit Per Second ).

A newer version of Ethernet, called 100Base--T ( or Fast Ethernet ) supports data transfers of 100 Mbps.

On the other hand the newest version Ethernet, called Gigabit Ethernet, supports data transfers of one gigabit ( 1000 megabits ) per second.

Protocol Based Classification

15

There are two fundamental architectures, peer--to--peer and client/server architectures.

In peer--to--peer architecture each node ( that is, workstation ) has equivalent capabilities and responsibilities. Peer--to--peer networks are rather simpler and less expensive. However they can not offer the same performance obtained in the client/server architectures under heavy loads or demands.

In the client/server architecture some nodes are called servers and are responsible to serve for one or more than one specific task. They must have sufficient physical capabilites like RAM or HD capacities and the speed in the processors.

Architecture Based Classification

16

For example, we can mention web servers to serve for the

interactions at world wide web level, file servers to keep the data for the users, ftp servers to enable file transfers, mail servers to manage the mail sending and receiving, proxy servers to reduce the amount of data in the transmission for web accesses, and so on.

The client nodes are for running the user programs however they do not have every capability and demand some common services from the related servers if needed. A client machine in certain service may be set as a server in another service.

17

Transmission Control Protocol (TCP)Internet Protocol (IP). Internet is the widest computer network on Earth. It

connects millions computers and peripherals around the world. As today's status there are more than 100 million users and more than 100 countries connected to this huge network worldwide and these numbers are rapidly increasing. Internet is not a centralized structure. On the contrary, it is decentralized in such a way that its each node called host is completely independent.

TCP/IP Networks and Internet

18

It is an addressing protocol, that is, it defines rules for the addressing of the nodes existing in Internet. The address of a node in Internet is called IP Adress

For today, an IP adress contains four byte of information about the adress. Since each byte, according to the today's definitions, contains 256 different value denoted by the integers between 0 and 255 inclusive the number of the possible adresses all over the Internet is (256)^4=4.294.967.296.

Internet Protocol (IP)

19

The four bytes of an IP adress is denoted by dotted decimal notation. The bytes of the adress are separated by dots and varies between 0 and 255 inclusive. Hence, there must be three dots in an IP adress and each byte must be shown by integers from the closed interval 0,255 in such a way that the leading zeros in the value of each byte must be discarded unless the value vanishes. For example, 160.75.2.24 is an IP adress in İTÜ. Each host must use at least one IP adress for Internet connection.

IP Networks are composed of the nodes which share same values in some portion of the IP adress. The IP address portion which does not change from node to node in the network is called Network Portion and the protion of digits varying from node to node in the network is called Host Portion. For example, for the İTÜ WAN 160.75 portion of the IP addresses is fixed,

20

all nodes in İTÜ has this leading portion hence it is network portion while the remaining values in the İTÜ addresses vary from host to host or from sub network to subnetwork.

The shared digits in the IP address throughout a network are called netmask. It is responsible to determine which nodes are contained in the network and treat them accordingly.

The network mask address is used for this task and it can have either 255.0.0.0 or 255.255.0.0 or 255.255.255.0 address values. For example, the network mask for İTÜ WAN is 255.255.0.0 while any sub network in İstanbul Technical University has usually ( unless a subnet is designed ) the network mask 255.255.255.0.

21

There are two more addresses which are important in the network configuration. They are called Network Address and Broadcast Adress respectively. The network address is obtained by changing the host portion bytes of the IP address by 0s wheras the broadcast address has the 255 values in place of the host portion bytes of the IP address.

The network address is used for the identification of the network. Whereas the broadcast address serves as a distribution point for some datagrams like warning messages or routing information for data transmission. According to the above definitions there are 256-2=254 chance of giving IP addresses in a network.

22

The gateway addres is generally set one less than the broadcast address in the value unless a specific convention is used. So it is a host which has 254 values for host portion bytes. The values for a byte between 0 and 255 inclusive can be divided into subregions such that the number of nodal addresses become a power of 2. For example we could divide the Informatics Institute LAN into two subdomains varying between 160.75.90.0 and 160.75.90.127 inclusive and between 160.75.90.128 and 160.75.90.255 inclusive respectively.

23

The networks set on these subdomains would be called subnets or somtimes subsegments. In this case the network addresses of the subnets would be 160.75.90.0 and 160.75.90.128 respectively while the broadcast addresses would be 160.75.90.127 and 160.75.90.255 respectively.

The IP addresses of Internet are categorized into four classes.

A Class Addresses varies between 0.0.0.0 and 127.255.255.255

B Class Addresses varies between 128.0.0.0 and 191.255.255.255.

24

C Class Addresses varies between 192.0.0.0 -- 223.255.255.255

D Class Addresses varies between 224.0.0.0 -- 239.255.255.255

E Class Addresses varies between 240.0.0.0 -- 247.0.0.0

There are some specific address sub domains which are reserved for some reasons. They are 10.0.0.0 -- 10.255.255.255 for A class, 172.16.0.0 -- 172.31.255.255 for B class, 192.168.0.0 -- 192.168.255.255 for C class.

25

An IP address can also be given in words. In that case whole address is a string of alphanumeric characters. The whole string is composed of some substrings which are separated by dots. it is not easy to recall numerical values it is better to use some meaningful words

This means that we can give a hostname to each node of the network under consideration. The domain can also be named and a hierarchical way is used for this purpose.

www.itu.edu.tr

www.yok.gov.tr

26

The hierarchy is provided by dots. So in the address the right string portion of a dot is the parent for the left string portion of the same dot. At the rightmost place the acronym for the country of the network is specified. This can be like

tr, for Turkeyuk, for United Kingdomfr, for Francede, for Germany (Deutschland), it, for Italy us, for USAbut USA addresses may not necessitate a country

string

27

The second substring in the IP address from right to left is about the type of the organization which owns the network.

edu for education, com for commercial, mil for military, org for organization, net for internet related, gov for government, are used for this purpose.

28

The next substrings specify the organization under consideration and its departments and sub organizations as we proceed from right to left. For example,

the IP address string bilgi.be.itu.edu.tr implies a node whose name is bilgi belongs to the Informatics Institute ( be ) of İstanbul Technical University ( itu ) an educational ( edu ) organization in Turkey ( tr ).

29

Transmission Control Protocol (TCP) is a tool which controls the data transfer between the nodes of the same or different networks. It enables us to make file transfers between nodes, to make remote logins, to control network access and to browse in the Internet via WWW.

Transmission Control Protocol

ftp hyperion.labs.itu.edu.tr

30

File Transfer Protocol is enables the users to transfer files from a local machine to a remote one and vice versa. It necessitates a ftpd daemon for the UNIX systems. A daemon is a devil--like software which runs at the background by waiting to serve when a demand is sent to the system. FTP is an interactive software and works as an interpreter. It presents a prompt and executes its commands given by the user at the prompt. FTP can be activated by giving the ftp command at the shell prompt either alone or followed by the IP address of the node (in string or numerical form)

ftp 160.75.100.15

File Transfer and Remote Access via TCP/IP

31

If the address given after ftp command is in string form and it fails then you can try and very possibly get a success by using numerical address since the failure of string address means a domainname server problem. When you successfully entered the ftp address followed by the IP address a login prompts appears on the screen to get the username from the user. If the user does not have any account on the remote point which is connected to the local machine through ftp then the login procedure fails even if a correct username is given at the prompt unless the user gives the correct password coincidentally . The password prompt appears after the successful entrance of a username and waits for the password.

32

As usual the characters are not displayed at the prompt as the user presses the character keys on the keyboard. If the correct password is given then the login procedure is completed successfully and user gets an access to the home directory of the username in the remote machine. Then user can do a lot of tasks permitted within the ftp connections capabilities.

ftp has a lot of commands which can be given at its prompt. Some of commonly used ones of them are given below.

user: This ftp command is used to change the user ID (identification) in an ftp session. When it is given a prompt appears and waits for the entrance of new username. This step is followed by the password receiving and checking stage.

33

help: This ftp command displays the avaliable ftp commands at the client node. It is possible to get more information about a specific ftp command by giving the name of the command after the ftp command help like help ls.

ls: This ftp command is used to list the content of a directory. It behaves like the UNIX command ls or ls -l or the DOS command dir.

dir: This ftp command is same with the ftp command ls. Although it is DOS based it is available under Linux also.

pwd: This ftp command displays the present working directory at the server.

cd: This ftp command is used to change the currect directory at the remote server. It is same with its UNIX counterpart.

34

mkdir: This ftp command creates a directory on the remote node, that is, server. It needs writing permission for the user in that location.

md: This ftp command is same with mkdir. rmdir: This ftp command deletes a directory on the remote

node, that is, server. It needs writing permission for the user in that location.

rd: This ftp command is same with rmdir. cdup: This ftp command is used to change the present

working directory at remote node to its parent. It is same as cd ../.

lcd: This ftp command is used to change the present working directory at the local node. This is also useful to get information about the present working directory at the local node. Indeed the entrance of the command

35

binary: There are two modes in the file transfers via ftp. One of them is called binary. Most of the ftp servers on UNIX and Linux operating systems are set to use binary transfer mode although there are some others which use ascii mode for the file transfer.

The binary mode is needed when the file to be transferred is binary like compressed files, executables and images. If the binary mode is not used for the transfer of a binary file then nothing happens to the original copy at the server location but the transferred copy is generally unrecoverably damaged. To activate the binary mode it is sufficient to give the ftp command binary at the ftp prompt. If the ftp server is besides in binary mode there is no problem because it is reset to the binary mode. For changing the transfer mode to binary some substrings like bin can be used in place of the whole string.

36

ascii: The other mode is called ascii. The ascii mode is used for the transfer of textual files mostly. To activate the ascii mode it is sufficient to give the ftp command ascii at the ftp prompt.

type: This ftp command displays the current ftp transfer mode.

status: This ftp command displays the information of the current setting of the ftp client.

get: This ftp command is used to make file transfers from the current location in the directory tree of the server to the current location of the client directory tree. It uses current transfer mode either binary or ascii. It is given at the ftp prompt as get which must be followed by the name of the file to be transferred. It transfers just one file in its each utilization.

37

put: This ftp command is used to make file transfers from the current location in the directory tree of the client to the current location of the server directory tree. It uses current transfer mode which is either binary or ascii. It is given at the ftp prompt as put which must be followed by the name of the file to be transferred. It transfers just one file in its each utilization.

send: This ftp command is used to make file transfers from the current location in the directory tree of the client to the current location of the server directory tree. It uses current transfer mode which is either binary or ascii. It is given at the ftp prompt as send which must be followed by the name of the file to be transferred. It transfers just one file in its each utilization. It is same with put.

38

mget: This ftp command is used to make multiple file transfers from the current location in the directory tree of the server to the current location of the client directory tree. It uses current transfer mode which is either binary or ascii. It is given at the ftp prompt as mget which must be followed by the names of the files to be transferred in a blank space separated format. The transfer is interactive by default, that is, the permission is demanded from the user before each file transfer. Wild character is permitted to be used in the name specification so for example the ftp command mget * tries to transfer all the files existing in the remote location. It asks for the user's permission before each individual file transfer and tries to transfer the files from the subdirectories of the present directory but fails.

39

mput: This ftp command is used to make multiple file transfers from the current location in the directory tree of the client to the current location of the server directory tree. It uses current transfer mode which is either binary or ascii. It is given at the ftp prompt as mput which must be followed by the names of the files to be transferred in a blank space separated format. The transfer is interactive by default, that is, the permission is demanded from the user before each file transfer. Wild character is permitted to be used in the name specification so for example the ftp command mput * tries to transfer the all files existing in the local location. It asks for the user's permission before each individual file transfer and tries to transfer the files from the subdirectories of the present directory but fails.

40

!: This ftp command is used to escape to the shell. When issued the ftp session is terminated.

bye: This ftp command is used to finish an ftp session with the remote server and exit from the ftp. The end of file character ( Control D ) also terminates the session with the remote node and exits.

chmod: This ftp command is used to change the file permissions of the files at the remote node. It works if the remote files are owned by the user.

close: This ftp command is used to terminate the current ftp session with the remote node and return to the command interpreter.

41

delete: This ftp command is used to delete the files at the remote node. It works only when the writing permission is granted to the user at the present working directory and files there.

disconnect: This ftp command terminates the current ftp session. It is a synonim for close.

exit: This ftp command terminates and exits the current ftp session.

42

lcd ./ at the ftp prompt results in the announcement of the present working directory given in full path.

mdelete: This ftp command is used to delete multiple files at the remote node. It needs writing permissions.

mdir: This ftp command is used to list the contents of the multiple remote directories.

mls: This ftp command is used to list the contents of the multiple remote directories.

mode: This ftp command is used to set the mode of the file transfer through ftp.

modtime: This ftp command is used to show the last modification time of the remote file.

newer: This ftp command is used to get the remote file if it is newer than its local counterpart.

43

open: This ftp command is used to connect to the remote server. If an optinal port number is given then the access is tried through that port.

prompt: This ftp command is used to toggle interactive prompting which is on by default. If the prompt is set to be off then the commands mget, mput and mdelete do their tasks without demanding any permission from the user.

reget: This ftp command is almost same as get but it can recover a broken file transfer from its failure point. When it is issued it checks the local files and if finds a file under the name of the remote file to be transferred and the local file is smaller than the remote one then it assumes that the local file is a partially transferred copy of the remote one and tries to transfer the bytes which are not transferred before.

44

rename: This ftp command is used to rename a remote file. It requires two names to be given after the command at the ftp prompt. The first name must be the name of the remote file to be renamed while the second name is the target (new) name of the remote file.

system: This ftp command is used to display the operating system at the remote node. There are a little bit more ftp commands which are not given here. But they can be found in the manual pages of ftp under the UNIX or Linux operating systems. There are also printed documentation on these beside the availability of the virtual medium copies through Internet.

45

Although the software called ftp has some standard capabilites in its all versions for different platforms, there may be some minor changes from version to version and from platform to platform. To explain all these type of minor alterations is out of the scope of this chapter. On the other hand there are some other ftp based protocols having more user friend interfaces and they may have different names like CuteFTP, WS_FTP or ncftp including the acronym ftp. The documentation for these are also available in different formats. Most of the ftp protocols are free softwares hence their source are open to the public. This gives great enthusiasm to the ftp developers for perfectioning. We suffice this information here for the file transfers.

46

This utility tests the capability of the local host for datagram sending and receiving to some host elsewhere. The term PING is an acronym for the statement Packet Internet Groper. To use ping one can enter the command ping followed by the IP address whose connection to the host will be checked after one or more than one spaces at the prompt of the command line interpreter. It sends a package and waits for its return. If the remote point's connection is alive it will send the package back to the host where it is sent from. The package size is mostly 64 bytes.

ping

47

The IP address of the remote node can be given in both formats, numerical or string. If the connection is alive then after a while the lines including some information about each consecutive datagram transmitted forth and back appear on the screen. These lines continuously scroll up and the scrolling never ends unless the ping interface is broken by force or the connection suddenly becomes dead for some reason. In the case of the nonexistence of the connection between the local and target nodes a starting line of information which is different than that of the case of alive connections appears on the screen and constantly remains until the connection is provided or the ping interface is broken deliberately

48

Network File System (NFS). It was developed and licensed by the Sun Microsystems. Although it is licensed it is freely available with the all Linux distributions. The main philosophy under NFS is to create a single filesystem over the some directory subtrees of several remote nodes. It uses the mounting facility of the UNIX operating system. The mounting means to flexibly add a directory tree or a subtree to a given directory tree of a UNIX or Linux system. This procedure needs a target point which is, by default, a directory. A filesystem on a different directory tree or subtree can be mounted to a specified target point. This can be done by using a command like

Mount –t filesystemname /dev/hda4 /targetdirectory

NFS and NIS

49

One of the standard electronic mail facilities under Unix systems is mail. It is also available under all Linux systems. mail is perhaps the most widely available mail system since it is given with all Unix system by default although some other softwares like pine which are more user friend than mail are becoming more widely used as time goes. mail is an intelligent software whose command syntax is based on the editor ed's features. It is possible to give certain parameters after the command in a space separated fashion at the prompt of the command line interpreter. At least two components must be given at the prompt of command line interpreter: The command mail and the address which has a format

Mail

50

username@IPaddress. When this is done a mail session starts without checking the validity of the user's address and asks to the user about the subject and the content of the message to be sent via mail. The username must be a valid name, that is, an existing user. Otherwise an error message is returned when the mail message is attempted to be sent. The IP address may not be specified if the user is at the same node or at the same LAN where an NIS and an NFS is active. That is, just the command mail username suffices for sending an e--mail message to the near neighbor users. The IPaddress can be given in either numerical or string format. The numerical address has priorities more than the string one and may work even some serving problems exist.

51

& is the prompt of the mail reading session of the command mail.

t This is used to type messagesn This is used to go to and type next messagee This is used to edit messagesf This is used to give head lines of messages.d This is used to delete messagess This is used to append messages to file. The filename must

be given after the following space(s) of this commandu This is used to undelete messages R This is used to reply to message sendersr This is used to reply to message senders and all recipientspre This is used to make messages go back to

/var/spool/mail

52

m This is used to mail to specific users which are specified as a space separated list.

q This is used to quit, saving unresolved messages in mbox

x This is used to quit, do not remove system mailbox h This is used to print out active message headers ! This is used to escape to shell cd This is used to change the directory to a specified

directory or home if none given. The name of the directory (if used) should be given after the command.

The messages in the mailbox of the user are numbered starting from 1. You can combine the message number with the above commands of mail session to act on some specific commands.

53

pine is one of the most widely used mail package for the Unix and Linux systems. It is publically

available and easy to use because of its menu based structure. It can be used at the command line and customized according to the favors of the user. It has a lot of improved features like attachment in MIME format which are not existing in mail.

pine

54

Webmail is possible to send and receive mail through world wide web (WWW) facilities. Today's web

browsers are equipped with the capabilities to communicate via e--mails. All you have to do is just to search the documentation for the related browser.

The two of the most commonly used browsers, Netscape and Internet Explorer have this facility.

Webmail

55

Sometimes it is better to prepare alias lists to send the messages to the members of a group at a single

attempt. If needed one can use the alias files such that the name of the file is considered as if it is a

user and treated so. That single virtual user which is in fact nonexisting becomes a distribution point of

the messages coming to it for the addresses included in the aliases file under that virtual user's

name. This facilitates the management and the controlling of the mailing for massive message

distributions. The Informatics Institute of Istanbul operates a lot of such lists at the level of lecturers

and at the level of students.