Computer NW Lab Manual
Computer NW Lab Manual
SCHOOL OF ENGINEERING
: : : : :
B. Tech. 2010-11
: :
V IT-302
Introduction
1.1 Purpose of the laboratory
The main goal of this laboratory is to give you an overview of the computer network and data transmission. You will have to plan the IP address scheme, congure and test the equipment, as well as congure several applications and servers typical of any network (DNS servers for example). You will also learn the socket programming to build a network application. After you have completed the laboratory exercises, you should be familiar with the practical issues of the different concepts explained in the course, as well as with the real equipment used nowadays in computer networks.
In continuous evaluation system of the university, a student is evaluated throughout semester. His/her performance in the lab, attendance, practical knowledge, problem solving skill, written work in practical file and behavior are main criteria to evaluate student performance. Apart from that a lab quiz will be organize to see program programming skill and knowledge about the proposed subject.
B. External Assessment
30
At the end of the semester a lab examination will be scheduled to check overall programming skill, in which student will need to solve 2 programming problems in time span of 3 hours.
20
30
50
Students are required to submit the lab file before the lab starts. Students missing the lab file submission will not be accepted to the lab.
1 Every laboratory sessions begins SHARP at the specied time in the schedule. 2 Each lab session is two hours long. Students are advised to bring their practical file 3 Please bring your identity cards with you. 4 Students must have their own copies of the laboratory manual. 5 Food, drinks and cell phone are not allowed inside the laboratory.
3. Source Code/experiment description: In this section write the complete errorless source code/experiment description, what you have written in the editor of the IDE, with proper indentation and also specify name of the file in the middle of the paper like 4. Input: Write input test data that are used to test program objective to see whether program is achieving the given objective or not. 5. Output : Write complete output produced by the program, at run time
6. Conclusion: Write complete conclusion that comprises what student learned from this program.
Building a network
Network diagrams show the relationship between the elements of communication networks such as computers, peripheral devices and network equipment. A diagram is the main documentation of a network and its importance cannot be overemphasized. Often, it is the key resource when troubleshooting the network. The network diagram shows how the network operates, so the main task of the network administrator is to maintain the network functioning as its diagram species. As a general rule, any modication to the network must rst be made to the network diagram, the side effects analyzed and then, if everything works properly, the network equipment will be recongured following the new diagram. Despite the fact that there are standards for most of the network parts, the network diagrams are not standardized at all. Developing appropriate network diagrams requires a mixture of experience, knowledge and likely some art. It is a skill that will only be developed through practice, although the study of existing diagrams helps a lot. In these brief notes you will receive some guidelines to interpret network diagrams and then you will practice with the diagram for the lab session.
When reading a network diagram, the rst thing to discover is the represented layer. As the network diagram shows the relationships between networked elements and these happen at different layers, it is natural that diagrams are classied according to the network layers. The most frequent diagram is the network layer diagram, which shows IP networks and routers between the networks. Usually they are fairly complex, so they do not show any information of other network layers. It is important not to overload the diagrams with information; therefore the details of the individual networks are included in link layer network diagrams. This type of diagrams have a narrower scope (a single sub-network typically) and contains a lot of details about the link and possibly physical layers. Higher level diagrams are also frequent, showing the arrangement of network services like DNS or DHCP, or the relationship between application servers and client common to all these types of diagrams is the use of symbols to represent the different entities.
For data communication we will use different cables depending on the link layer technology, though the media will always be copper. For the Ethernet connections, we will use four-pair category 5 Unshielded Twisted-Pair (UTP) cabling with RJ45 plugs on both ends. Figure 2.5 shows the RJ45 plug at the end of the UTP cable. This type of cable contains eight individually insulated wires twisted in pairs. Each pair is colored with one wire having a solid color (blue, orange, green, or brown) and the other wire having a stripe of the same color over a white background. Each wire is named by its color when it is solid (e.g. green) or by the pair white and color of the stripe otherwise (e.g. white-green). The pairs are identied by the solid colors (e.g. green pair). The RJ45 plug has eight pins, numbered from 1 to 8. So that each one of the wires of the four-pairs UTP cable will be connected to one pin. The assignment of wires to pins is named color code and it is different depending on the standard. We will use both the EIA/TIA 568A and 568B standards. Their color assignment We will need two different types of cables for Ethernet connections: crossover cables and straightthrough cables. A crossover cable must be used to connect Ethernet ports of two PCs directly, or two routers or two switches (when the uplink port of the switches is not used). It has one RJ45 plug wired following the 568A standard and the other following the 568B standard.
A straight-through cable must be used to connect the Ethernet ports of a switch to PCs or routers. It has both RJ45 plugs wired following the 568B standard. The only way to identify whether an Ethernet cable is a crossover or straight-through cable is to check the color code at both ends. A different cable must be used to connect a PC to the console port of a Cisco device. The console port is a serial port, thus it must be connected to the PC serial port. The console port is a RJ45 jack while the PC serial port is a DB9 connector. To connect both ports properly, we will use the DB9 to RJ45 adapter (see Figure 2.7) and a new type of cable known as roll-over cable. A roll-over cable also uses 8 wires with RJ45 plugs on both ends, but it is different from the straight-through or crossover cables. In a roll-over cable, the pins on one end are reversed on the other end. Thus pin 1 on one end connects to pin 8 on the other end. Pin 2 connects to pin 7, pin 3 connects to pin 6 and so on. Figure 2.8 shows a roll-over cable. Finally, yet another arrangement must be used to connect two PCs through their serial ports. In this case, we would link two DB9 to RJ45 adapters using a roll-over cable. And then each DB9 plug will be connected to the serial ports of each PC.
Department of Computer Science & Engineering
In addition to these cables, there is permanent cabling in the lab room that you will need to use to connect the routers outer interface to the departmental backbones. The permanent cables run in the ceiling and link each lab position with the labs cabling rack. The cabling rack is right by the entrance. It contains the departmental switches and two patch panels above them. Figure 2.9 shows the interior of the cabling rack.
2.2.2 Routers
Instead of using router we will use CISCO router simulator T. All its ports are situated in the back. It has two 10/100 Ethernet RJ45 ports, a RJ45 console port for its conguration, a three-pin power socket and a power switch. Each port is labeled in the box with a name, which it is also used to identify the port in the conguration le. Since the router forwards packets between its ports, it is very important to connect each network to the proper port.
Fig 2.9
2.2.3 Terminals
Personal Computers (PCs) running Linux will be used as terminals in the lab. Each area network has a laptop PC, which will be used as the network server for the area network. All the ports of this PC are in the back. Its most important ports for this lab are the 10/100 Ethernet RJ45 port and the DB9 serial port. Figure 2.11 shows the back of the laptop PC at the lab. Additional PCs, laptops or desktops, can be connected to the area network. These PCs must have a RJ45 Ethernet port. This port will be connected to any free port in the switch to join the area network.
POST completes successfully, the bootstrap program is loaded from ROM into the RAM. This process produces the rst messages in the console. After bootstrap is loaded, it searches and loads the Cisco IOS. In our case, this software is retrieved from the internal ash memory, decompressed and loaded into RAM. More messages appear in the console reporting the evolution of these steps. When it is successfully loaded, the routers conguration le is searched and loaded. When you boot the router for the rst time, there is no conguration le, so you will be asked whether you want to enter the initial conguration dialog. Answer "yes" and you will be conguring everything from scratch in the set-up mode. If this question does not appear, it means that the router found some conguration. In this case, you will have to start the initial conguration procedure from the privileged mode using the setup command as described below: Router> enable Password: passwd Router# setup Continue with configuration dialog? [yes/no]: y
When the Internet Protocol (IP) was designed and standardized, the specication required that each system interface had a unique Internet address of 32 bits. Some of these systems could have more than one network interface, like routers, and thus they would need a unique IP address for each interface. An IP address is divided in two parts: the rst part identies the network and the second part identies the particular host in the network. During the early years of IP addressing, the rst part of the IP address was called the network number because the leading portion of each IP address identies the network, while the last part of the address was called the host number. In one particular network, all the hosts contain the same network number, but they must have different host numbers. On the other hand, if two hosts are in different networks their network number must be different, but they can have the same host number. There is one exception to the required uniqueness for IP addresses, and it is the group of addresses reserved for private use. These private IP addresses can be repeated in different organizations, but they should never be directly connected to the Internet.
2.3.2 Primary Address Classes
One of the main goals when designing the IP protocol was supporting networks of different size. For that purpose, the IP address space was divided into ve different address classes Class A, B, C, D, and E. This way of partitioning is called classful addressing because the address space is split into predened classes, groupings, or categories. The different classes x the boundary
Department of Computer Science & Engineering
between the network number and the host number at different points within the three rst bytes of the address. The different formats are illustrated in Figure 2.16. Classful IP addressing is quite convenient from the routing point of view, since each address contains a selfencoding key that identies the dividing point between the network number and the host number. This way, early routers on the Internet could know the length of the network number without having a network mask. For example, when the rst two bits of an IP address are 10, the dividing point is between the 16th and 17th bits. Class A Networks Class A network addresses have an 8bit network number, which starts with a 0, followed with a 24bit host number. Nowadays, class A addresses are referred to as /8, 7 because of their 8bit network number. There are 126 (2 2) class A networks. We have to subtract 2 because the 0.0.0.0 network is reserved for the default route and 127.0.0.0 is used for 24 the loopback interface. Each /8 network contains 2 2 (16,777,214) hosts. Again, we subtract two addresses because the all0s ("this network") and all1s ("broadcast") host numbers cannot be 31 assigned to individual hosts. There are in total 2 (2,147,483,648) individual addresses available in class A, which are 50% of the total IPv4 address space.
Class B Networks Class B network addresses have a 16bit network number, with the two highest order bits set to 10, followed by a 16bit host number. They are usually referred to as 14 16 /16s. There are 16,384 (2 ) /16 networks, with 65,534 (2 2) hosts per network. The entire 30 class B address space contains 2 (1,073,741,824) addresses. Class C Networks Class C network addresses have the three highest order bits set to 110 and a 24bit network number, followed by a 8bit host number. They are referred to as /24s. There
Department of Computer Science & Engineering
are 254 (2 2) hosts per network, with 2,097,152 (2 ) possible /24 networks, giving a maximum 29 of 2 (536,870,912) addresses. Other Classes In addition to the three classes used to identify individual network interfaces, there are two additional classes: Class D addresses have their four highest order bits set to 1110 and are used to support IP Multicasting, while Class E addresses have their leading fourbits set to 1 111 and are reserved for future use.
2.3.3 DottedDecimal Notation
In order to facilitate the use of IP addresses, they are often expressed as four decimal numbers, each separated by a dot. This format is called dotteddecimal notation. In this notation, each 32bit Internet address is divided into four 8bit (byte) elds. Then, the value of each eld is specied independently as a decimal number with the elds separated by dots. Table 2.1 shows typical Internet addresses expressed this way. Table 2.2 displays the range of decimal values that can be assigned to the rst byte of each address classes.
2.3.4 Problems with Classful Addressing
The Internet nowadays has surpassed in size all the original expectations of its creators. The design decisions made in the early years of the Internet have created complex problems with difcult solutions: a. When the Internet started, IP addresses were allocated to organizations based on simple 32 requests, instead of the actual needs. The decision to create 32bit addresses gave only 2 (4,294,967,296) IPv4 addresses available, which has led to an actual lack of addresses. b. The division of IP addresses based on octet boundaries was easy to implement and deploy, but it created a lack of proper support for medium-size organizations. A /16, supporting 65,534 hosts, can be too large for this type of organizations, while a /24, with only 254 possible hosts can be far too small. In the past, sites with several hundred hosts were assigned a single /16 address, instead of two or three /24 addresses, thus quickly nishing off the /16 address space. Also, the need to give several /24 addresses to the same organization has increased the size of the routing tables.
Purpose of Straight Through CableStraight-through cables get their name from how they are made. Out of the 8 pins that exist on both ends of an Ethernet cable, each pin connects to the same pin on the opposite side. Review the diagram below for a visual example:
Notice how each wire corresponds to the same pin. This kind of wiring diagram is part of the 568A standard. The 568B standard achieves the same thing, but through different wiring. It is generally accepted to use the 568A standard as pictured, since it allows compatibility with certain telephone hardware- while 568B doesnt. Straight-through cables are primarily used for connecting unlike devices. A straight-through cable is typically used in the following situations: Use a straight-through cable when: 1. Connecting a router to a hub 2. Connecting a computer to a switch 3. Connecting a LAN port to a switch, hub, or computer Note that some devices such as routers will have advanced circuitry, which enables them to use both crossover and straight-through cables. In general, however, straight-through cables will not connect a computer and router because they are not unlike devices.
Purpose of Crossover CableCrossover cables are very similar to straight-through cables, except that they have pairs of wires that crisscross. This allows for two devices to communicate at the same time. Unlike straightthrough cables, we use crossover cables to connect like devices. A visual example can be seen below:
Notice how all we did was switch the orange-white and green-white wires, and then the orange and green wires. This will enable like devices to communicate. Crossover cables are typically used in the following situations: Use a crossover cable when: 1. 2. 3. 4. 5. Connecting a computer to a router Connecting a computer to a computer Connecting a router to a router Connecting a switch to a switch Connecting a hub to a hub
While the rule of thumb is to use crossover cables with like devices, some devices do not follow standards. Others provide support for both types of cables. However, there is still something that both crossover and straight-through cables cant do.
Purpose of Rollover CableRollover cables, like other cabling types, got their name from how they are wired. Rollover cables essentially have one end of the cable wired exactly opposite from the other. This essentially rolls over the wires- but why would we need to do such a thing? Rollover cables, also called Yost cables, usually connect a device to a router or switchs console port. This allows a programmer to make a connection to the router or switch, and program it as needed. A visual example can be seen below:
Notice that each wire is simply rolled over. These types of cables are generally not used very much, so are usually colored differently from other types of cables.
Getting in privileged mode The router has two main modes: User mode. This is the initial mode that the user goes into when they log onto the router. In this mode it is not possible to configure the router, and it is only possible to perform simple commands such as telnet and ping. Executive mode. In this mode the full range of commands can be used, and the router can be programmed. The command which is used to go from user mode into executive mode is enable. If a password is set for the executive mode, the user must enter this before they can enter into the executive mode. The prompt should change from a > to a #. The following gives an example: Router> enable Router# If at any time you cannot remember the syntax of a command type-in the command and then press the ? key. Setting hostname The hostname is set using the hostname command. This name is reflected in the prompt of the router, and makes it easier to identify the current router. For example to set the host of LAB_A to LAB_A: Router# config t Enter configuration commands, one per line. End with END. Router (config)# hostname LAB_A LAB_A (config)# Setting the secret password The secret password is used to enter into the executive mode. In the following case the password is defined as class. LAB_A (config)# enable secret class LAB_A (config)# exit LAB_A# exit LAB_A> enable Password: ccc Password: class LAB_A# Setting the IP addresses on the ports One of the most important things to set on the router is the IP address of each of the ports. These ports will be used as gateways out of the network segment to which they connect to. The interface
Department of Computer Science & Engineering
command (or int for short) programs each of the interfaces. In the following example the three ports on the router are programmed with the required IP addresses, and subnet masks. The ports will not automatically come on-line, and will start in a shutdown mode. Thus the no shutdown command is used to start them up. LAB_A# config t LAB_A (config)# int e0 LAB_A (config-if)# ip address 192.5.5.1 255.255.255.0 LAB_A (config-if)# no shutdown LAB_A (config-if)# exit LAB_A (config)# int e1 LAB_A (config-if)# ip address 205.7.5.1 255.255.255.0 LAB_A (config-if)# no shutdown LAB_A (config-if)# exit LAB_A (config)# int s0 LAB_A (config-if)# ip address 201.100.11.1 255.255.255.0 LAB_A (config-if)# clock rate 56000 LAB_A (config-if)# no shutdown LAB_A (config-if)# exit Setting a routing protocol The router will not be able to connect to other routers unless it runs a routing protocols which is the same as the other routers. This allows the routers to determine the best path to a remote device. In this case the RIP protocol is set-up with the router rip command, and then each of the networks in which the router will broadcast its routing table are defined (using the network command): LAB_A (config)# router rip LAB_A (config-router)# network 192.5.5.0 LAB_A (config-router)# network 205.7.5.0 LAB_A (config-router)# network 201.100.11.0 LAB_A (config-router)# exit LAB_A (config)# Setting the line console password Passwords are important in providing a degree of security to the router. The are three main passwords to set: the executive password, the console password, and the remote login (vty) password. The vty password defines the telnet password, and the console password defines the initial login password. LAB_A (config)# Line con 0 LAB_A (config-line)# password cisco LAB_A (config-line)# login LAB_A (config-line)# exit LAB_A (config)# exit
Department of Computer Science & Engineering
LAB_A # exit User Access Verification Password: cisco LAB_A> enable Password: class LAB_A # config t LAB_A (config)# The telnet password is set with: LAB_A (config)# Line vty 0 LAB_A (config-line)# password cisco LAB_A (config-line)# login LAB_A (config-line)# exit LAB_A (config)# exit Setting the hostnames table It is often difficult to remember the IP address of each of the ports, thus a router can be setup with its own hosts table, as shown next: LAB_A (config)# ip host LAB_A 192.5.5.1 205.7.5.1 201.100.11.1 LAB_A (config)# ip host LAB_B 201.100.11.2 219.17.100.1 199.6.13.1 LAB_A (config)# ip host LAB_C 223.8.151.1 204.204.7.1 199.6.13.1 LAB_A (config)# ip host LAB_D 210.93.105.1 204.204.7.2 LAB_A (config)# ip host LAB_E 210.93.105.2 LAB_A (config)# exit LAB # show running-config Determining if the ports are operating To see if the ports are up, and if they are connected to the other routers, the show protocols command is used. For example: LAB_A# show protocols E0 is up, line protocol is up Internet address is 192.5.5.1 E1 is up, line protocol is up Internet address is 205.7.5.1 S0 is up, line protocol is up Internet address is 201.100.11.1 The hosts table can also be viewed with show hosts.
Using Windows XP Professional you can host one Web site and one FTP site on a single computer.