63
Network Laboratory SCOEIT 1 1. Network Components Aim: To provide basic network devices and LAN technologies. Objective: After going through this assignment you will be in a position to: 1. Basic components of a network (Sender, medium, receiver) 2. List the different components( hub, switch, router etc) 3. Various transmission medium ( UTP, FOC, STP, Coaxial, Bluetooth, IR) 4. Understand the use of computer network 5. Examples of networking ( ATM, Novell Netware ) Theory: Elaborate the following points. 1. Basic elements of communication system (Sender, medium, receiver). 2. Type of transmission medium ( Guided and unguided) 3. Networking devices ( Repeater, Hub, Switch, Bridge, Router, Gateway) 4. Network topology (Star, Bus, Ring, Mesh). 5. Classification of computer network ( LAN, WAN, MAN) 6. Reference model ( ISO-OSI, TCP/IP) Activities: 1. Ask students to define the term network. 2. Begin to focus on computer networks, seeking to apply some attributes of networks in a broader sense to their understanding of computer networks. Ask students to list examples of computer networks they may encounter on a regular basis like ATM networks, etc. 3. Ask students to explain why computer networks were developed. What are the advantages and disadvantages of computer networking? 4. Explain that computer networks can be classified in various ways, in terms of their scale, the arrangement of network nodes i.e. topology, the functional relationship among network nodes, and the protocols that govern their operation. FAQ: 1. Define LAN. 2. What is the difference between hub and switch?

Computer Networking Lab Manulas for TE IT PUNE 2010

Embed Size (px)

DESCRIPTION

1. Network ComponentsAim: To provide basic network devices and LAN technologies. Objective: After going through this assignment you will be in a position to: 1. Basic components of a network (Sender, medium, receiver) 2. List the different components( hub, switch, router etc) 3. Various transmission medium ( UTP, FOC, STP, Coaxial, Bluetooth, IR) 4. Understand the use of computer network 5. Examples of networking ( ATM, Novell Netware ) Theory: Elaborate the following points. 1. Basic elements

Citation preview

Page 1: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 1

1. Network Components

Aim: To provide basic network devices and LAN technologies.

Objective: After going through this assignment you will be in a position to:

1. Basic components of a network (Sender, medium, receiver)

2. List the different components( hub, switch, router etc)

3. Various transmission medium ( UTP, FOC, STP, Coaxial, Bluetooth, IR)

4. Understand the use of computer network

5. Examples of networking ( ATM, Novell Netware )

Theory: Elaborate the following points.

1. Basic elements of communication system (Sender, medium, receiver).

2. Type of transmission medium ( Guided and unguided)

3. Networking devices ( Repeater, Hub, Switch, Bridge, Router, Gateway)

4. Network topology (Star, Bus, Ring, Mesh).

5. Classification of computer network ( LAN, WAN, MAN)

6. Reference model ( ISO-OSI, TCP/IP)

Activities:

1. Ask students to define the term network.

2. Begin to focus on computer networks, seeking to apply some attributes of networks

in a broader sense to their understanding of computer networks. Ask students to list

examples of computer networks they may encounter on a regular basis like ATM

networks, etc.

3. Ask students to explain why computer networks were developed. What are the

advantages and disadvantages of computer networking?

4. Explain that computer networks can be classified in various ways, in terms of their

scale, the arrangement of network nodes i.e. topology, the functional relationship

among network nodes, and the protocols that govern their operation.

FAQ:

1. Define LAN.

2. What is the difference between hub and switch?

Page 2: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 2

1. Network Components

3. For ‘n’ devices in a network, what is the number of cable links required for a mesh

and ring topology?

4. Define Routers.

5. What are the four internetworking devices?

Page 3: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 3

2. Network Implementation

Title: Design and implement a small network using actual physical components with IP

address scheme.

Aim: To provide the necessary skills for LAN implementations.

Objective: After going through this assignment you will be in a position to:

1. Solve basic network design problems.

2. Design and build a simple local area network, and implement appropriate

network operating system client and server software in a Windows and Linux

environment.

3. Define and describe the function of a MAC address.

4. Describe the different classes of IP addresses.

5. How to setup IP an addressing scheme using class “A/B/C” networks

6. Understand the purpose of the network mask.

7. Applications, merits and demerits of this assignment.

Theory: Elaborate the following points.

1. Choosing the Best Computer Network.

2. Client server network ( client, server , diagram )

3. MAC address and IP address ( all classes )

4. Subnetting ( Definition, requirement)

5. Applications

Activities:

1. Decide which topology is going to use.

2. List out all the hardware and software required for network.

3. Decide which class IP addresses are available.

4. Decide the number of user.

FAQ:

1. Define IP address.

2. Define Gateway.

3. List the different types of topology?

4. Which transmission media used in star topology?

5. Define a protocol?

6. What is subnet mask?

Page 4: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 4

3. TCP/IP Utilities And Commands

Title: Study of the TCP/IP utilities and commands.

a. Ping b. Ifconfig c. tracert d. whois e. netstat

Aim: To develop the necessary skills for network maintains and troubleshooting.

Objective: After going through this assignment you will be in a position to:

1. How to Determine Network Configuration

2. Troubleshooting the network

3. Test Local Connectivity

4. Check Configuration Settings

5. Testing Routes

6. Network status

Theory: Elaborate the following points:

(Working and uses)

1. Ping 2. Ifconfig 3. tracert 4. whois 5. netsat

Activity:

1. Ping Command

• The ping command helps to verify IP-level connectivity. When troubleshooting,

you can use ping to send an ICMP echo request to a target host name or IP

address. Use ping whenever you need to verify that a host computer can

connect to the TCP/IP network and network resources. You can also use ping to

isolate network hardware problems and incompatible configurations.

• It is usually best to verify that a route exists between the local computer and a

network host by first using the ping command and the IP address of the network

host to which you want to connect. Try pinging the IP address of the target host

to see if it responds, as follows:

ping IP_address

You should perform the following steps when using ping:

1. Ping the loopback address to verify that TCP/IP is installed and configured

correctly on the local computer.

ping 127.0.0.1

Page 5: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 5

3. TCP/IP Utilities And Commands

2. Ping the IP address of the local computer to verify that it was added to the network

correctly.

ping IP_address_of_local_host

3. Ping the IP address of the default gateway to verify that the default gateway is

functioning and that you can communicate with a local host on the local network.

ping IP_address_of_default_gateway

4. Ping the IP address of a remote host to verify that you can communicate through a

router.

ping IP_address_of_remote_host

• If you cannot use ping successfully at any point, confirm that:

1. The computer was restarted after TCP/IP was installed and configured.

2. The IP address of the local computer is valid and appears correctly on the General

tab of the Internet Protocol (TCP/IP) Properties dialog box.

3. IP routing is enabled and the link between routers is operational.

2. Ipconfig/Ifconfig command

• Ipconfig – used in Windows based systems to get basic host computer

configuration information, including the IP address, subnet mask, and default

gateway. When ipconfig is used with the /all switch, it produces a more detailed

configuration report for all network interfaces.

• Ifconfig – used in Linux based systems to make an interface accessible to the kernel

networking layer. This involves the assignment of an IP address and other

parameters and activation of the interface

• Examples

• To display the basic TCP/IP configuration for all adapters, type:

ipconfig

• To display the full TCP/IP configuration for all adapters, type:

ipconfig /all

3. Tracert

Page 6: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 6

3. TCP/IP Utilities And Commands

• Tracert is used to trace the probable path a packet takes between source and

destination. Probable, because IP is a connectionless protocol and different packets

may take different paths between the same source and destination networks,

although this is not usually the case.

• Trace will show the path the packet takes to the destination, but the return path may

be different. This is more likely the case in the Internet, and less likely within your

own autonomous system.

• The TRACERT or TRACEROUTE utility can be used to check connectivity

over longer distances. If you can access some locations on the network, but not

others, you can use TRACEROUTE to determine which link in the chain is

broken. Uses ICMP message within an IP Packet.

• Calculate and display number of hops between computers. it also calculate time it

takes to traverse entire one-way path between machines

• UNIX platforms the layout of the command is:

TRACEROUTE [destination IP address]

Or

TRACEROUTE [URL of the destination host]

• On Windows machines the function of traceroute comes with the command

TRACERT

4. whois

• To make it easier for administrators to find information about domains in this large

distributed database, modern TCP/IP implementations generally come with an

intelligent version of the whois utility. It is able to accept as input the name of a

domain and automatically locate the appropriate registry in which that domain’s

information is located. The utility is usually used as follows:

whois [-h <whois-host>] <domain>

Page 7: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 7

• In this syntax, “<domain>” represents the name about which registration

information is requested. The administrator can use the “-h” parameter to force the

program to query a particular whois server, but again, this is usually not required.

3. TCP/IP Utilities And Commands

• Some implementations also include other options that can be used to direct queries

to particular registries.

5. Netstat

• Netstat displays protocol statistics and current TCP/IP connections. Netstat is a

common command line TCP/IP networking utility available in most versions of

Windows, Linux, Unix and other operating systems. Netstat provides information

and statistics about protocols in use and current TCP/IP network connections.

• This utility provides the connection both the local and remote, ports and the state of

the connection. It has several switches which maybe found by typing netstat /? from

the command prompt.

• It provides the IP addresses and the ports of the remote computer(S) to which the

socket is connected. If a port has not been established it is indicated by a *.

• It shows the port numbers as well as IP address for the local computer. It provides

the type of protocol being used for the connection(s). It provides a status of the

connection. Is it established ?? is it closed ?? or is it waiting ?? and more

For example : c:\ netstat

6. Telnet Commands

• The telnet protocol also specifies various commands that control the method and

various details of the interaction between the client and server. These commands are

incorporated within the data stream. The commands are distinguished by the use of

various characters with the most significant bit set. Commands are always

introduced by a character with the decimal code 255 known as an Interpret as

command (IAC) character

Syntax

telnet [\\RemoteServer]

Page 8: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 8

Parameters

\\RemoteServer : Specifies the name of the server to which you want to connect.

/?: Displays help at the command prompt.

3. TCP/IP Utilities And Commands

FAQ :

1. What is ping?

2. Which port number used by FTP?

3. What is traceroute ?

4. Which command is used by Ping command?

5. What is the port number used by Telnet?

Page 9: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 9

4. Protocol Analyzer

AIM: To analyze the network as well as packet header with the help of any protocol

analyzer. (Ethereal/Wire-shark)

OBJECTIVE: This lab will introduce the network protocol analyzer (ethereal/

wireshark). We will also be concentrating on:

1. Network analyzing process.

2. Packet capturing process.

THEORY:

1. What is a protocol analyzer?

2. Explore different packet headers with the analyzer. Write in brief about the same.

INPUT: Steam of data packets using diff. protocols

Steps to be followed:

1. Execute the Wireshark setup

2. Select the “Capture” option. Select “Interfaces” under the

same

3. Select the NIC card and click on “Start”

Page 10: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 10

4. Protocol Analyzer

4. The packets flowing in the network can be seen.

Page 11: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 11

4. Protocol Analyzer

5. Click on “Stop” the capture and start exploring the frames

6. Select a frame and explore the protocol. Here is an example of how the explored

ARP protocol packet will look

like:

Page 12: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 12

4. Protocol Analyzer

OUTPUT: Result:-packets captured

FAQs:

1. What protocols are currently supported on Wireshark?

2. What type of sockets does ethereal use to capture packets?

3. Can the contents of the message be seen on the analyzer?

4. Can we use Ethereal with Linux?

5. Can a protocol analyzer be used as a hacking tool?

6. What devices can a network analyzer use to capture packets?

PRACTICE ASSIGNMENTS:

1. Connect a small network and transfer files with FTP. Capture the packets with the

analyzer.

2. Connect two machines and make a VoIP call. Observe the packets and check out

the call flow diagram on ethereal/wireshark.

Page 13: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 13

5.Switch Configuration

Title: Design & implement network using network simulator

AIM: To design & implement medium/large network using any network simulator

(Boson simulator) with IP address scheme (CIDR).

OBJECTIVE: This lab will introduce the Internetwork Operating System (IOS)

command line interface (CLI). In this, we also shall be exploring about how to study IPv4

address management through subnetting / VLSM/CIDR.

THEORY:

1. What is an IOS?

2. What are different types of switches available in the market? What are

different access modes and commands used on switch?

3. What are IPv4 addresses?

4. Brief description about VLSM, CIDR and subnetting with examples.

5. What are VLANs? Why are they used in a network?

NOTATIONS AND SYMBOLS:

Page 14: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 14

6. Network Simulator 5.Switch Configuration

TOPOLOGY -I:

Switch configuration:

The switch supports these interface types:

1. Physical ports—Switch ports

2. VLANs—switch virtual interfaces

3. Port-channels—Ether-Channel of interfaces

To configure a physical interface (port), enter interface configuration mode,

and specify the interface type, slot, and number.

• Type: Fast Ethernet (fast Ethernet or fa) for 10/100 Ethernet or Gigabit Ethernet (Gigabit

Ethernet or gi).

• Slot: The slot number on the switch (always 0 on this switch).

• Port number: The interface number on the switch. The port numbers always begin at 1,

starting at the left when facing the front of the switch. For example: fastethernet 0/1,

fastethernet 0/2. If there is more than one media type (for example, 10/100 ports and

Gigabit Ethernet ports), the port number starts again with the second media: gigabitethernet

0/1, gigabitethernet 0/2.

We can identify physical interfaces by physically checking the interface location on

the switch. We can also use the IOS show privileged EXEC commands to display

information about a specific interface or all the interfaces on the switch.

Page 15: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 15

5.Switch Configuration

Procedures for Configuring Interfaces:

These general instructions apply to all interface configuration processes:

1. Logging onto a switch requires connecting a Console cable from Console port of a

Switch to SERIAL or COM port of workstation Press enter to get into the user

prompt mode. Enter enable to get into privileged mode.

2. Type “?” to see a list of privileged mode commands. Enter disable to go back to

user mode.

enter

> enable

# ?

# disable

>

3. Switch the catalyst switch ON and get into privileged mode and then into global

configuration mode. Assign switch a host name of 1900sw. Use exit or ctrl-z to get out of

configuration mode.

> enable

# configure terminal

(config)# hostname 1900sw

1900sw(config)# exit

1900sw#

4. On switch1, type show running-config to see the active configuration.

1900sw# show running-config

5. On switch1, erase the current configuration with the following command:

1900sw# delete nvram

6. On switch1, get into privileged mode and then into global configuration. Reassign

the switch a hostname of 1900sw and an enable password of ‘cisco’. Assign the

switch an IP address of 195.10.1.99 with a subnet mask of 255.255.255.0. Assign

the switch a default gateway of 195.10.1.1 (Router’s ethernet address if router is

also considered to be connected)

> enable

# configure terminal

(config)# hostname 1900sw

1900sw(config)# enable password level 15 cisco

1900sw(config)# ip address 195.10.1.99 255.255.255.0

1900sw(config)# ip default-gateway 195.10.1.1

Page 16: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 16

7. On switch, issue the show ip command to verify that the IP address, mask, and

default gateway are correct.

1900sw# show ip

8. On switch, issue the show interfaces command.

1900sw# show interfaces

9. On switch, issue the show version command.

1900sw# show version

10. On switch, issue the show spantree command.

1900sw# show spantree

11. On switch, issue the show mac-address-table command. This shows which devices

are attached to which switch ports.

1900sw# show mac-address-table

12. On switch, permanently assign a device with MAC address 1111-1111-1111 to port

E0/5. Issue the show mac-address-table command to verify the device is in the table

as a permanent entry.

1900sw(config)# mac-address-table permanent 1111-1111-1111 e0/5

1900sw(config)# exit

1900sw# show mac-address-table

13. We can use the interface range global configuration command to configure

multiple interfaces with the same configuration parameters. When we enter the

interface range configuration mode, all command parameters that we enter are

attributed to all interfaces within that range until we exit this mode.

Page 17: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 17

5.Switch Configuration

Page 18: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 18

5.Switch Configuration

TOPOLOGY - II:

Description of topology:

This is the simple topology to demonstrate VLAN configuration. The two VLANs

on switch are assigned some ports. Our main aim is to check the logical grouping between

the VLANs .Two pc’s pc1 and pc2 are grouped in same VLAN with assigned ports fast

Ethernet fa0/1 (mode 0/1 st port) and fa0/2 , and pc3,pc4 are grouped in vlan 3 . Let’s try to

ping a pc connected to port fa0/1 to fa0/2 and fa/3. The result will conclude this

experiment.

I. Switch configuration :

Procedure:

1. Configure the 2950 switch by going to the console and press ctrl+c to enter in

command line interface.

You will receive the > prompt.

2. Assign the user mode password on 2950 .The switch uses the command to set the

user and privileged mode commands.

3. Enable the switch for global configuration.

4. Specify the vlan that are to be configured in the vlan database

5. Assign switch ports to the vlans given in the database

6. Verify the configuration on switch using

a) Show ip.

b) Show running –config

c) Show int f0/17(any interface)

Page 19: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 19

5.Switch Configuration

II. Configuring VLANs on the switch:

1. Switch# vlan database

2. Switch (vlan) # vlan 2 name x

(Vlan 2 added, Name: x)

3. Switch (vlan) # vlan 3 name y

(Vlan 3 added, Name: y)

4. Switch (vlan)#apply

(Apply completed.)

5. Switch (vlan) # end

Switch#

III. Checking VLAN database:

1. Switch# sh vlan brief

IV. Assigning the ports to VLANs added in database:

1. Switch (config) #int f0/1

(0 specifies the Mode and 2 species the port in that mode)

2. Switch (config-if) #switchport mode access

3. Switch (config-if) #switchport access vlan 2

4. Switch (config) #int f0/2

5. Switch (config-if)#switchport mode access

6. Switch (config-if) #switchport access vlan 2

7. Switch (config) #int f0/3

8. Switch (config-if ) #switchport mode access

9. Switch (config-if) #switchport access vlan 3

10. Switch (config) #int f0/4

11. Switch (config-if) # switchport mode access

12. Switch (config-if) #switchport access vlan 3

13. Switch (config-if) #end

V. To checkout the configuration:

1. Switch# sh vlan brief

Page 20: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 20

5.Switch Configuration

Command summary:

Page 21: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 21

5.Switch Configuration

IOS commands:

Page 22: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 22

5.Switch Configuration

FAQs:

1. Which layer of OSI and TCP/IP model switch is associated with?

2. What are different switches available in market?

3. What are VLANs?

4. What is the difference between VLAN and VPN?

5. What is the difference between L3 switch and a router?

PRACTICE ASSIGNMENTS:

1. Implement a small network using a switch. Implement VLAN for the same.

Implement inter-VLAN communication for two VLANs

Page 23: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 23

6 . Router Configuration

AIM: To configure a router using router commands including access lists on any network

simulator (Packet Tracer)

OBJECTIVE: Find information about router configurations, memory size, interface

status and IP addresses. Execute the user-levels and command modes on a Cisco router.

Configure and modify the Cisco 2600 router interfaces.

THEORY: 1. What are different components of a router? What are different memories used with

it?

2. Describe different modes of Cisco IOS

3. What is a HyperTerminal? Where is it used?

4. What are access lists? Why do we use access lists?

UNIT I: ESTABLISHING CONNECTIVITY:

To access the router you need first to establish a telnet session to its Commserver. The next

few steps help you connect to the Commserver.

TOPOLOGY I:

(Figure 1)

Use HyperTerminal to establish a telnet session:

1. Go to Start>Programs>Accessories>Communications>HyperTerminal on the PC

desktop.

2. Next, name the session for the new connection.

“Lab1”

Page 24: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 24

6 . Router Configuration

3. You can view all commands available at this mode by entering “? “at the prompt:

2600> ?

( the help command, lists all commands)

4. This command is also helpful when you need a list of all commands that begin with

the same letters. For instance, let us try to find all commands that start with letters

“sh”. Enter the command:

2600> sh?

(list all commands that begin with “sh”?)

5. Also you can determine the arguments that matches a particular command using the

“?” help command

2600> show ?

(lists the available matching arguments for show command)

6. Commands are often abbreviated to the minimum number of letters that identifies a

unique selection

2600> sh ?

(verify that sh is similar to show command)

(Note the space after sh.)

7. To delete a configuration line enter no in front of the statement you wish to delete.

For example:

Page 25: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 25

r1(config-if)# no ip address 192.168.13.1 255.255.255.0 6 . Router Configuration

8. To switch to the Privileged EXEC mode enter enable (or its abbreviation en)

2600> enable

(enable command to switch to privileged mode)

9. Enter the password on the flyer handed out to you. To view the configuration of the

router enter:

2600# show run

(display the configuration information currently running on the router.)

TOPOLOGY II:

(Figure 2)

10. Note the ip host commands and how line numbers 2001, 2002, etc. were assigned

to routers. You must do this by way of the commserver. There are two ways to

accomplish this. You can also use the telnet command with the commserver IP

address of the city location to connect to router r1:

2600# telnet IP address of commserver 2001

Page 26: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 26

6 . Router Configuration

11. Connecting to router r1 using line 2001 of the Commserver. Line 2002 connects to

r2, 2003 to router r3, 2004 to r4, etc. Or you could simply enter the name of the

router, r1. (this would be r4 if you were assigned to routers Press ENTER key again

after the “… Open” line and you should see the prompt r1> or “Connection refused

by remote host” message, similar to the next window:

12. If you get a “Connection refused by remote host” message the telnet session is

suspended and you will have to clear the console line. To do this, enter the

following commands on your Commserver:

2600# clear line 1

(clears line 1 (or ‘clear line 4’ for r4) so it’s ready for new telnet sessions.)

(For r2 enter “clear line 2”, for r3 “clear line 3”, r4 “clear line 4”, etc)

13. Press the enter key to confirm the clearing of the line or repeat the command until

the line clears. Now try connecting to the router again as explained above. Verfiy

that you successfully connected to the router by looking at the hostname prompt.

Now that you have established a connection with your router you can begin to

configure and maneuver within that Cisco device using Cisco’s IOS software.

14. First, enter privileged EXEC mode of the router, r1.

r1> enable

(You should see a # sign next to router r1 now)

15. To find the version and system information about your router issue the following

commands:

r1# show version

(NOTE: When you see “–More—“ press the spacebar to continue with the entire

output. )

Page 27: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 27

6 . Router Configuration

16. To interrupt output press Ctrl-Z until it brings you back to the router prompt.

a. What is the software image version?

b. How long has the device been running?

c. How many interfaces are physically present on this device?

17. To find memory information about the router, enter:

r1# show memory

a. How much total memory is there for the processor (b=bytes)?

b. How much processor memory is in use?

c. How much processor memory is free or available for use?

18. To learn about the status of the interfaces of this router use the following command:

r1# show ip interface

a. What is the administrative status of the first Ethernet interface?

b. What is the line protocol status of the first Ethernet interface?

c. What is the difference between these two fields?

19. The CLI is smart enough to recognize abbreviated commands. For example sh ipint

br would be enough to issue the above command. In addition, if you enter the first

few letters of a command and hit Tab, it will display the remainder of the command.

r1# show ip interface brief

UNIT II: GETTING MORE INFORMATION USING PRIVILEDGED MODE

There are two different configurations stored on the router. These configurations are

called the Running Configuration and the Start-Up Configuration. The Running

Configuration is your current, working configuration. This configuration is stored in the

RAM memory of the router.

1. Enter the following command:

r1# show running-config

a.What interfaces are present?

2. The Start-Up configuration is the configuration that is loaded when the router initializes

its boot sequence. This configuration is stored in the NVRAM of the router. To view this

configuration, enter the command.

Page 28: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 28

Since we have made no changes in the configuration, the startup and running

configurations are the same.

6 . Router Configuration

UNIT III: BASIC CONFIGURATION COMMANDS

To configure the router you must be in the Configuration Mode. You can get

to the configuration mode from the Privileged EXEC Mode.

A. Global Configuration Mode

1. From privileged mode, you can monitor devices, view the status of interfaces, or

run debugging. However, if you want to change the configuration of the router, you

must enter configuration mode. This is done using the 'configure terminal

command. From router r1 enter the following commands:

r1# configure terminal

r1(config)#

r1(config)# <CTRL>+Z

r1#

2. The prompt now indicates that you are in configuration mode, as shown above. This

is global configuration mode. Configuration commands that are entered here apply

to the entire system. This is where you would do such things as enable a routing

protocol, or change the hostname of the router. To exit from configuration mode,

press <CTRL>+Z.

B. Interface Configuration Mode

1. Many features must be configured on a per-interface basis, rather than for the entire

system. For example, to assign an IP address to the Serial interface, we must get to

the configuration mode specific to that port. There may be many interfaces with

different addresses. To do this we must enter interface configuration mode. To enter

an interface of the router perform the following commands:

r1# configure terminal

r1(config)# interface serial0/1

r1(config-if)#

r1(config-if)# <CTRL>+Z

>> Notice that our prompt has changed once again. To exit from interface

configuration mode, use the 'exit' command. This will return you to global

configuration mode. To exit configuration mode entirely and go back to privileged

Exec mode, press <CTRL>+Z.

Page 29: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 29

6 . Router Configuration

C. CONFIGURATION EXERCIZES

1. To change the name of your router (hostname), you need to be in the global

configuration mode.

r1# config terminal

(entering the global configuration mode)

r1(config)# hostname Spartan

(configuration of new host name)

>> Notice the change in your prompt name to confirm the change of the

hostname of your router.

>> Repeat steps above to change the hostname back to its original name

>>Exit the global mode with a Ctrl-Z.

2. Find all interfaces configured in your router, r1

r1# show run

(displays all running interfaces)

r1# show interfaces

(displays detailed information on all interfaces on the router)

3. Now assign interface Serial 0/1 of Router r1 the IP address as described below:

a. From the global configuration mode enter:

r1(config)# interface Serial0/1

(enter configuration mode)

r1(config-if)# ip address 192.168.10.1 255.255.255.0

(assign an IP address and a Class C subnet mask to the interface using its IP address in

Figure)

b. To complete the interface configuration you need to activate the interface. By

default router interfaces are deactivated by manufacturer, left on the shutdown

state. From interface configuration mode, enter:

r1(config-if)# no shutdown

(activate the interface)

4. Exit to the privileged mode by entering <Ctrl>-Z and use the command show ip

interface brief to check if the interface has been assigned an IP address and see if

the interface status has changed. It should be in “administratively up” status, if not,

continue with the steps below to configure IP addresses to connecting interfaces to

Page 30: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 30

bring it to an up state. To switch to another router or “reverse telnet”, suspend this

telnet session by pressing [Ctrl+Shift+6] simultaneously, release the keys then

6 . Router Configuration

press x. This will take you back to your Commserver and should display a 2511#

prompt. Telnet to the router r3, and configure an IP address and subnet mask on the

Serial interface 0/0 as described below. From the global configuration mode enter:

r3(config)# interface Serial0/0

(enter configuration mode)

r3(config-if)# ip address 192.168.10.2 255.255.255.0

(assign an IP address and a Class C subnet mask to the interface using its IP address

in Figure)

Perform a no shutdown command and exit to the privileged mode. Check the

interface modification using the show ip interface brief command. There should be

a connection between routers r1 and r3 as determined by the interface Serial 0/0

having a status of “up” and a protocol status of “up”.

UNIT IV: CONFIGURATION OF THE NETWORK

Use commands and methods of the previous exercises to assign IP addresses using Figure 2

to complete the configuration of the network.

1. Testing Connectivity

ping and traceroute are tools commonly used to test network layer connectivity.

You can also examine the device’s routing table to obtain further information on

network layer functionality.

2. Testing accessibility: ping

The ping (packet internet groper) command demonstrates network layer

connectivity and gives you an idea of the reliability of the path to the specified

system. ping does this by providing information as to the minimum, average, and

maximum times it takes for ping packets to find the specified system and return.

There are two forms of ping. The simplest form is available through the User

EXEC mode of the CLI. It takes the IP address of the interface of the device you

want to contact as its only argument, for example:

r1# ping 172.23.17.53

Page 31: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 31

There is also an advanced feature of ping call the extended ping which is available

from the Privileged EXEC mode of the CLI. It provides more testing for the link.

You can access this advanced form of ping by simply entering ping at the router

prompt. But for now, use the simple form to ping addresses. ping the IP address of

6 . Router Configuration

one of your directly connected devices. While connected to Router r3 ping Router

r1.

Notice the success rate is 100 % meaning you successfully reached the destination

router. Congratulations! If you have anything below 100% the router has difficulty

with making a network connection to the other router.

3. Finding the Point of Failure: traceroute

The traceroute command is used to find the actual path that packets took to reach

its destination. Instead of testing just end-to-end connectivity, as ping, traceroute

is used to check each link along the packet route. Experiment with the traceroute

command as we did with ping, starting with the line command:

r1# traceroute

(IP address of destination)

The trace command terminates when the destination responds, when the maximum

TTL is exceeded, or when the user interrupts the trace with the escape sequence.

4. Checking the Routing Table: show ip route

Through the show ip route command you can directly examine the routing table to

determine if an entry for the host actually exists. The output of the show ip route

displays the entries in the routing table. (directly connected network, static route, or

which routing protocol was used to select the route, and via the type of connection

the information was collected). View the routing table of r2 by entering:

r2# show ip route

Page 32: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 32

6 . Router Configuration

(output of show ip route command)

5. Setting password to console port:

Starting from within the Router (config) mode, you need to put in the following

series of commands to create one.

Router (config) # line console 0

Router (config-line) # login

Router (config-line) # password CISCO

Router (config-line #Ctrl-Z

UNIT SUMMARY:

Router access modes :

1. User EXEC mode - limited examination of router

Router>

2. Privileged EXEC mode - detailed examination of router, debugging, testing, file

manipulation, etc.

Router#

3. Global configuration mode – configuring router interfaces, routing protocols, etc.

4. ROM Monitor - useful for password recovery & new IOS upload session

5. Setup Mode – available when router has no startup-config file

6. Console – direct PC serial access

7. External configuration sources:

Auxiliary port – Modem access

Virtual terminals – Telnet access

Page 33: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 33

TFTP Server – copy configuration file into router RAM

6 . Router Configuration

UNIT V: CONFIGURING ACCESS LISTS

Access lists can allow one host to access a part of your network and prevent another

host from accessing the same area. In Figure , host A is allowed to access the Human

Resources network, and host B is prevented from accessing the Human Resources network.

You can also use access lists to decide which types of traffic are forwarded or

blocked at the router interfaces. For example, you can permit e-mail traffic to be routed, but

at the same time block all Telnet traffic.

The Cisco access control list (ACL) is probably the most commonly used object in

the IOS. It is not only used for packet filtering (a type of firewall) but also for selecting

types of traffic to be analyzed, forwarded, or influenced in some way.

ACCESS CONTROL LIST TYPES:

Cisco ACLs are divided into types. Standard IP, Extended IP, IPX, Appletalk, etc. Here

we will just go over the standard and extended access lists for TCP/IP. As you create

ACLs you assign a number to each list, however, each type of list is limited to an

assigned range of numbers. This makes it very easy to determine what type of ACL you

will be working with.

1. TCP/IP Access Lists

You can have up to 99 Standard IP Access Lists ranging in number from 1 to 99,

Page 34: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 34

the Extended IP Access Lists number range is assigned from 100 to 199. The most

common use of the Extended IP access list to is create a packet filtering firewall. This is

where you specify the allowed destinations of each packet from an allowed source.

6 . Router Configuration

2. Standard IP Access Lists

A Standard Access List only allows you to permit or deny traffic from specific IP

addresses. The destination of the packet and the ports involved do not matter.

Here is an example:

access-list 10 permit 192.168.3.0 0.0.0.255

(This list allows traffic from all addresses in the range 192.168.3.0 to

192.168.3.255)

You can see how the last entry looks similar to a subnet mask, but with Cisco

ACLs they use inverse subnet masks. Also realize that by default, there is an

implicit deny added to every access list. If you entered the command:

show access-list 10

The output would be:

access-list 10 permit 192.168.3.0 0.0.0.255

access-list 10 deny any

3. Extended IP Access Lists

Extended ACLs allow you to permit or deny traffic from specific IP addresses to a

specific destination IP address and port. It also allows you to specify different types of

traffic such as ICMP, TCP, UDP, etc. Needless to say, it is very grangular and allows

you to be very specific. If you intend to create a packet filtering firewall to protect your

network it is an Extended ACL that you will need to create.

Typically you would allow outgoing traffic and incoming initiated traffic. In other

words, you want your users to be able to connect to web servers on the internet for

browsing but you do not want anyone on the Internet to be able to connect to your

machines. This will require 2 ACLs. One to only limit our users on the company

network to only use a web browser (so this will block outgoing FTP, email, Kazaa,

napster, online gaming, etc.) The other access-list will only allow incoming traffic from

the Internet that has been initiated from a machine on the inside. This is called an

established connection. Let's see what our access list would look like for starters:

ASSUMPTIONS:

internal network: 63.36.9.0

access-list 101 - Applied to traffic leaving the office (outgoing)

Page 35: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 35

access-list 102 - Applied to traffic entering the office (incoming)

Access lists are numbered (for IP, numbered or named)

6 . Router Configuration

HOW TO IDENTIFY ACCESS LISTS:

a. IP Standard 1 - 99

b. IP Extended 100-199

c. Named (Cisco IOS 11.2 and later)

d. IPX Standard 800 - 899

e. IPX SAP filters 1000 - 1099

f. Apple Talk 600 – 699

NOTE:

1. Number identifies the protocol and type

2. Other number ranges for most protocols:

a. For TCP/IP packet filters, Cisco IOS access lists check the packet and upper layer

headers for:

i. Source IP addresses using standard access lists; identify these with a number

in the range 1 to 99.

ii. Destination and source IP addresses or specific protocols using extended

access lists; identify these with a number in the range 100 to 199.

iii. Upper-level TCP or UDP port numbers in addition to the other tests in

extended access lists; also identify these with a number in the range 100 to

199.

b. For all of these TCP/IP access lists, after a packet is checked for a match with the

access list statement, it can be denied or permitted to use an interface in the access

group.

RESEARVED TCP PORT NUMBERS:

----------------------------------------------------------------

Decimal Keyword Description

----------------------------------------------------------------

0 Reserved

1-4 Unassigned

5 RJE Remote Job Entry

7 ECHO Echo

9 DISCARD Discard

11 USERS Active Users

13 DAYTIME Daytime

Page 36: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 36

15 NETSTAT Who is Up or NETSTAT

17 QUOTE Quote of the Day

19 CHARGEN Character Generator

20 FTP-DATA File Transfer Protocol (data)

21 FTP File Transfer Protocol

23 TELNET Terminal Connection

6 . Router Configuration

25 SMTP Simple Mail Transfer Protocol

37 TIME Time of Day

39 RLP Resource Location Protocol

42 NAMESERVER Host Name Server

43 NICNAME Who Is

53 DOMAIN Domain Name Server

67 BOOTPS Bootstrap Protocol Server

68 BOOTPC Bootstrap Protocol Client

69 TFTP Trivial File Transfer Protocol

75 Any Private Dial-out Service

77 Any Private RJE Service

79 FINGER Finger

95 SUPDUP SUPDUP Protocol

101 HOSTNAME NIC Host Name Server

102 ISO-TSAP ISO-TSAP

113 AUTH Authentication Service

117 UUCP-PATH UUCP Path Service

123 NTP Network Time Protocol

133-159 Unassigned

160-223 Reserved

224-241 Unassigned

242-255 Unassigned

RESERVED UDP PORT NUMBERS:

---------------------------------------------------------------

Decimal Keyword Description

---------------------------------------------------------------

0 Reserved

1-4 Unassigned

5 RJE Remote Job Entry

7 ECHO Echo

9 DISCARD Discard

11 USERS Active Users

13 DAYTIME Daytime

15 NETSTAT Who is Up or NETSTAT

17 QUOTE Quote of the Day

19 CHARGEN Character Generator

20 FTP-DATA File Transfer Protocol (data)

Page 37: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 37

21 FTP File Transfer Protocol

23 TELNET Terminal Connection

25 SMTP Simple Mail Transfer Protocol

37 TIME Time of Day

39 RLP Resource Location Protocol

42 NAMESERVER Host Name Server

6 . Router Configuration

43 NICNAME Who Is

53 DOMAIN Domain Name Server

67 BOOTPS Bootstrap Protocol Server

68 BOOTPC Bootstrap Protocol Client

69 TFTP Trivial File Transfer Protocol

75 Any Private Dial-out Service

77 Any Private RJE Service

79 FINGER Finger

123 NTP Network Time Protocol

133-159 Unassigned

160-223 Reserved

224-241 Unassigned

242-255 Unassigned

TOPOLOGY III:

Page 38: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 38

6 . Router Configuration

ROUTER CONFIGURATION FOR ACCESS LISTS:

Using the example above you can create a standard IP access list that blocks

host 172.22.5.2 from accessing subnet 172.22.2.0. The commands you need to do this are

given below.

RouterB#config t

Enter configuration commands, one per line. End with CNTL/Z.

RouterB(config)#access-list 1 deny 172.22.5.2

RouterB(config)#access-list 1 permit 0.0.0.0 255.255.255.255

RouterB(config)#int e0

RouterB(config-if)#ip access-group 1 out

Key Concepts for IP Access Lists:

1. Standard lists (1-99) test conditions of all IP packets from source address

2. Extended lists (100-199) can test conditions of

a. Source and destination address

b. Specific TCP/IP-suite protocols

Page 39: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 39

c. Destination ports

3. Wildcard bits indicate how to check the corresponding address bits

(0=check, 1=ignore)

Wildcard mask :

32-bit quantity used in conjunction with an IP address to determine which bits in an IP

address should be ignored when comparing that address with another IP address. A

wildcard mask is specified when setting up access lists.

a. A wildcard mask bit 0 means "check the corresponding bit value.

b. A wildcard mask bit 1 means "do not check (ignore) that corresponding bit value.

NOTE:

Wildcard masking for access lists operates differently from an IP subnet mask. A

zero in a bit position of the access list mask indicates that the corresponding bit in the

address must be checked; a one in a bit position of the access list mask indicates the

corresponding bit in the address is not 'interesting' and can be ignored.

How to use Wildcard mask bits -

1. IP access list test conditions:

Check for IP subnets: 172.30.16.0 to 172.30.31.0

Address and wildcard mask: 172.30.16.0 0.0.15.255

6 . Router Configuration

2. Test condition:

Ignore all the address bits (match any)

Accept any address: 0.0.0.0 255.255.255.255 (ignore all)

Abbreviate the expression using the key word "any"

3. Test condition:

Check all the address bits (match all)

Check for an IP host: 172.30.16.29 0.0.0.0 (check all bits)

Abbreviate the wildcard using the key word "host" followed by the IP address

STANDARD IP ACCESS LIST CONFIGURATION

Access list:

1. List kept by Cisco routers to control access to or from the router for a number of

services (for example, to prevent packets with a certain IP address from leaving a

particular interface on the router).

2. Command that creates an entry in a standard traffic filter list.

a. Standard access lists filter based on a 'source address' and mask.

b. Standard access lists permit or deny the entire TCP/IP protocol suite.

Page 40: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 40

Router(config)# access-list acl-number {permit|deny} source [mask]

a. IP standard access list 'acl-number' uses 1 - 99

b. permit|deny - does this entry allow or block the specified address

c. source - source IP addresses

d. mask - 0s = must match, 1s = don’t care positions

3. IP access-group - Command that links an existing access list to an outbound

interface.

Router(config-if)# ip access-group acl-number {in|out}

a. Activates the list on an interface

b. acl-number - the number of the access list to be linked to this interface

c. in/out - Selects whether the access list is applied to the incoming or

d. outgoing interface. If in or out is not specified, out is the default

4. Applying Access Lists:

Finally the instructions you all have been waiting for! Make sure you are in

enabled mode. Then use the command below:

6 . Router Configuration

r1#conf t

r1(config)#int ser0/0

r1(config-if)#access-group 101 out

r1(config-if)#access-group 102 in

STANDARD ACCESS LIST EXAMPLES:

1. Allow only traffic from a specific source network

Router(config)# access-list 1 permit 172.22.0.0 0.0.255.255

(implicit deny any - not visable in the list)

(access-list 1 deny 0.0.0.0 255.255.255.255)

Router(config)# interface ethernet 0

Router(config-if)# ip access-group 1 out

Router(config)# interface ethernet 1

Router(config-if)# ip access-group 1 out

2. Deny a specific host

Router(config)# access-list 1 deny host 172.22.2.3

Page 41: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 41

Router(config)# access-list 1 permit 0.0.0.0 255.255.255.255 (implicit deny any - not visable in the list)

(access-list 1 deny 0.0.0.0 255.255.255.255)

Router(config)# interface ethernet 0

Router(config-if)# ip access-group 1

3. Deny a specific subnet

Router(config)# access-list 1 deny 172.22.3.0 0.0.0.255

Router(config)# access-list 1 permit any

(implicit deny any - not visable in the list)

(access-list 1 deny 0.0.0.0 255.255.255.255)

Router(config)# interface ethernet 0

Router(config-if)# ip access-group 1

COMMAND SUMMARY:

Standard IP Access Lists

Access-list (list #) (permit | deny) (source address) (source wildcard mask)

>> (list #) - Standard IP access lists are represented by a number in the range of 1-

99 (in IOS versions 11.2 and greater, they can also be represented by text names).

>> (permit | deny) - Used to specify the nature of the access list line. It is either a

permit or a deny statement.

>> (source address) - The IP address of the source.

>> (source wildcard mask) - A wildcard mask applied to determine which bits of

the source address are significant.

FAQs:

1. Which layer of the OSI model router is associated with?

2. Which addresses router uses to switch or forward the packets to the destination?

3. “Router ports are administratively down”, comment.

4. Can a router be used to connect PSTN and IP networks?

5. Name a few dynamic routing protocols.

6. What is a metric?

7. Which is the most widely used routing protocol in internet?

8. What is the difference between RIPv1 and RIPv2?

PRACTICE ASSIGNMENTS:

1. Design a network with three routers and configure:

a. Static routing protocol

b. Dynamic routing protocol

2. On your administrative network

a. Block the access to chat (gtalk, yahoo messenger, etc.)

b. Block the access to www.orkut.com

Page 42: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 42

7. Socket Programming

Title: Write a program for TCP and UDP socket on Linux platform.

Aim: To develop the necessary skills for developing robust & scalable network

applications and to build necessary basic knowledge for managing networks.

Objective: After going through this assignment you will be in a position to:

1. To learn the basics of socket programming using TCP/UDP Sockets.

2. To learn port numbers.

3. To develop knowledge of threads for developing high performance scalable

applications.

4. To learn about raw sockets.

5. To learn the communication between server and client

Theory: Elaborate the following points:

1. What is socket and port?

2. Types of socket.

3. TCP socket and UDP socket.

4. Socket system calls

TCP socket system call

Page 43: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 43

Socket system call

1. Socket Function

int socket ( int family, int type, int protocol );

family: specifies the protocol family {AF_INET for TCP/IP}

type: indicates communications semantics

SOCK_STREAM stream socket TCP

SOCK_DGRAM datagram socket UDP

SOCK_RAW raw socket

protocol: set to 0 except for raw sockets

returns on success: socket descriptor {a small nonnegative integer}

on error: -1

Example:

if (( sd = socket (AF_INET, SOCK_STREAM, 0)) < 0)

err_sys (“socket call error”);

2. Connect Function

int connect (int sockfd, const struct sockaddr *servaddr, socklen_t addrlen);

sockfd: a socket descriptor returned by the socket function

*servaddr: a pointer to a socket address structure

addrlen: the size of the socket address structure

The socket address structure must contain the IP address and the port number for

the connection wanted. In TCP connect initiates a three-way handshake. connect

returns only when the connection is established or when an error occurs.

returns on success: 0

on error: -1

Example:

if ( connect (sd, (struct sockaddr *) &servaddr, sizeof (servaddr)) != 0)

err_sys(“connect call error”);

3. bind Function

int bind (int sockfd, const struct sockaddr *myaddr, socklen_t addrlen);

bind assigns a local protocol address to a socket.

protocol address: a 32 bit IPv4 address and a 16 bit TCP or UDP port number.

sockfd: a socket descriptor returned by the socket function.

*myaddr: a pointer to a protocol-specific address.

addrlen: the size of the socket address structure.

Servers bind their “well-known port” when they start.

returns on success: 0

on error: -1

Page 44: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 44

Example:

if (bind (sd, (struct sockaddr *) &servaddr, sizeof (servaddr)) != 0)

errsys (“bind call error”);

4. Listen Function

int listen (int sockfd, int backlog);

listen is called only by a TCP server and performs two actions:

Converts an unconnected socket (sockfd) into a passive socket. Specifies the maximum

number of connections (backlog) that the kernel should queue for this socket. listen is

normally called before the accept function.

returns on success: 0

on error: -1

Example: if (listen (sd, 2) != 0)

errsys (“listen call error”);

5. Accept Function

int accept (int sockfd, struct sockaddr *cliaddr, socklen_t *addrlen);

accept is called by the TCP server to return the next completed connection from the

front of the completed connection queue.

sockfd: This is the same socket descriptor as in listen call.

*cliaddr: used to return the protocol address of the connected peer process (i.e., the

client process).

*addrlen: {this is a value-result argument}

before the accept call: We set the integer value pointed to by *addrlen to the size of

the socket address structure pointed to by *cliaddr;

on return from the accept call: This integer value contains the actual number of

bytes stored in the socket address structure.

returns on success: a new socket descriptor

on error: -1

6. Close Function

int close (int sockfd);

close marks the socket as closed and returns to the process immediately.

sockfd: This socket descriptor is no longer useable.

Note – TCP will try to send any data already queued to the other end before the normal

connection termination sequence.

Returns on success: 0

on error: -1

Example: close (sd);

7. Socket Programming

Page 45: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 45

FAQ:

1. What is a socket?

2. What are the types of sockets?

3. What is the difference between select ( ) and poll ( )?

4. What is socket address?

5. List the socket primitives for TCP.

6. What is difference between TCP socket and UDP socket?

7. What is a port?

8. What is data structure used in socket system call?

Page 46: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 46

8.Configure Network Services

AIM: To configure the following network services

a. Remote Login Service – TELNET/SSH

b. FTP Server and Client.

c. APACHE WEB SERVER

OBJECTIVE: Configuring different protocols like Secure Shell Protocol (SSH),

TELNET, File Transfer Protocol (FTP) and web servers (APACHE) on a network.

THEORY: 1. What is SSH? What is the difference between SSH and Telnet?

2. Discuss in brief about Apache web services

3.What are different type of file transfer services available?

UNIT I: CONFIGURING SSH AND TELNET

This chapter describes how to configure Secure Shell Protocol (SSH) and Telnet on the

switches.

A: SSH ACCESS:

1. Define username and password

(config)# username cisco password cisco

2. Define hostname on device

(config)# hostname xyz

3. Define domain name

(config)# ip domain_name mydomain.com

4. Generate appropriate keys

(config)# crypto key generate rsa

(rsa is a security protocol)

5. Define version

(Default version is 1.5, if one wants to change, here is the procedure)

(config)# ip ssh version 2

6. Vty login

(config)# line vty 0 4

(vty: virtual terminal)

(config-line)# login local

(use local user database)

(config-line)#transport input ssh

(strictly defining access to SSH and NOT to TELNET)

Page 47: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 47

8. Configure Network Services

B. TELNET ACCESS:

1. Configure virtual terminal password

(config)# line vty 0 4

(vty: virtual terminal)

(config-line)# login

(config-line)# password sanjose

UNIT II: CONFIGURING FTP SERVER AND CLIENT

A. Install Internet Information Services and the FTP Service

Because FTP depends on Microsoft Internet Information Services (IIS), IIS and the

FTP Service must be installed on the computer. To install IIS and the FTP Service,

follow these steps.

NOTE: In Windows Server 2003, the FTP Service is not installed by default when you

install IIS. If you already installed IIS on the computer, you must use the Add or

Remove Programs tool in Control Panel to install the FTP Service.

1. Click Start, point to Control Panel, and then click Add or Remove Programs.

2. Click Add/Remove Windows Components.

3. In the Components list, click Application Server, click Internet Information

Services (IIS) (but do not select or clear the check box), and then click Details.

4. Click to select the following check boxes (if they are not already selected):

Common Files

File Transfer Protocol (FTP) Service

Internet Information Services Manager

5. Click to select the check boxes next to any other IIS-related service or

subcomponent that you want to install, and then click OK.

6. Click Next.

7. When you are prompted, insert the Windows Server 2003 CD-ROM into the

computer's CD-ROM or DVD-ROM drive or provide a path to the location of the

files, and then click OK.

8. Click Finish.

Page 48: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 48

8. Configure Network Services

IIS and the FTP service are now installed. You must configure the FTP Service before

you can use it.

B. Configure The FTP Service

To configure the FTP Service to allow only anonymous connections, follow these steps:

1. Start Internet Information Services Manager or open the IIS snap-in.

2. Expand Server_name, where Server_name is the name of the server.

3. Expand FTP Sites

4. Right-click Default FTP Site, and then click Properties.

5. Click the Security Accounts tab.

6. Click to select the Allow Anonymous Connections check box (if it is not already

selected), and then click to select the Allow only anonymous connections check

box.

When you click to select the Allow only anonymous connections check box,

you configure the FTP Service to allow only anonymous connections. Users cannot

log on by using user names and passwords.

7. Click the Home Directory tab.

8. Click to select the Read and Log visits check boxes (if they are not already

selected), and then click to clear the Write check box (if it is not already cleared)

9. Click OK.

10. Quit Internet Information Services Manager or close the IIS snap-in.

The FTP server is now configured to accept incoming FTP requests. Copy or move the

files that you want to make available to the FTP publishing folder for access. The default

folder is drive:\Inetpub\Ftproot, where drive is the drive on which IIS is installed.

C. Configuring APACHE web server:

I. Plan your folders:

1. Planning a good folder structure for organizing your websites is important.

Assuming that you have your own company, I recommend to create a "My

Company" folder in your "My Documents" folder. Instead of "My Company"

you might want to use the real name of your company. Next, create in the "My

Company" folder for example the following sub-folders: "Customers" and "My

Sites". The latter can be used to store sites that belong to your company.

Page 49: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 49

8. Configure Network Services

2. Next, create a folder for each customer under the Customer folder. Use for example

the name of the company or the name of the customer to name this folder. Then for

each customer create a folder with the same name as the domain of that customer.

3. Inside each domain folder, create a folder named "site" which will be used to store a

local copy of all the folders and files that are also on the (remote) web server

connected to the Internet. Try to keep files that shouldn't be on the actual web

server outside of this folder in order to use it to update the remote server without

too much of a hassle.

a. For example the site folder I have contains the following folders: cgi, logs,

and web. They are named thus because that's the name they have on the

server that hosts my website.

b. The folder named "web" is the document root, in this case, meaning that

documents and folders in this folder appear at the top level of the domain.

For example, if this folder contains a file "example.html" it will be

accessible as http://example.com/example.html assuming that the domain is

example.com.

c. Note that the cgi directory (cgi-bin) is outside the document root folder in

the file system, which is a good thing (This will be explained in an

upcoming article).

Page 50: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 50

8. Configure Network Services

II. Download APACHE:

1. The Apache web server is available in three different series: 1.3, 2.0, and

2.2. Since 2.0 is recommended over 1.3 for running on Windows XP, and

software like PHP as far as I know don't support 2.2 yet, I decided to install

the latest 2.0.x version which is 2.0.59 at this time of writing.

2. Go to the Apache HTTP server download page and select the series you

want to use (either 1.3 or 2.0) and download the Win32 binary. In my case I

downloaded apache_2.0.59-win32-x86-no_ssl.msi.

3. After you have downloaded the MSI file compare the MD5 signature with

the value published on the Apache website. Note: I am working on an

explanation on how to do this, for now read the instructions on the Apache

HTTP server download page.

III. Installing the APACHE server:

1. If you set up your day-to-day account properly on Windows XP you are working as

a limited user. For installation of the Apache HTTP server you need to have

Administrator rights. So go to the Windows XP Login screen by pressing the

Windows key (between the left Ctrl and left Alt on most keyboards) and the L key

together.

2. When started, the Apache HTTP server installation wizard displays a welcome

message. Click on the Next button to continue. Next, the Apache license is shown.

Read it carefully and if you accept the license, select the "I accept the terms in the

license agreement" option and press the Next button.

3. Next a "Read This First" document is displayed. Read it carefully before pressing

the Next button.

Page 51: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 51

8. Configure Network Services

4. Next, you can enter your server information. Since I don't need other computers on

the local network to be able to contact the web server I used localhost. If you have a

local network, and want other computers to be able to contact the computer, make

sure you use the right settings. If you don't know which option you want, use

localhost for now, since you can always change the configuration settings later on

in the configuration file of the Apache web server.

5. It is recommend to run the Apache HTTP server as a service. This way it is always

running and you don't need to start it manually. If you consider manually start and

stop because of security issues, then reconsider and use a firewall, preferable one

running on an external device like a router.

6. The next step allows you to select the install type of the Apache web server. The

default (Typical program features) is probably right for your situation, so press

Next.

7. Next, you can select the destination folder of the installation. Unless you prefer to

use a different folder for some or all of the software you install, I recommend to use

the default setting: C:\Program Files\Apache Group\

Page 52: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 52

8. Configure Network Services

8. Finally, after clicking on the Next button you can start the actual installation by

pressing the Install button. A few windows pop up and go automatically, and then a

Windows Security Alert window appears asking if you want to keep blocking this

(Apache HTTP server) program.

Windows Security Alert for the Apache HTTP server.

9. Since we don't want to make the web server available on the network we selected

the Keep Blocking option. Note that you can always change this into Unblock later

in case you decide to make the Apache HTTP server available on your network.

After selecting a button in the Windows Security Alter dialogue window the

window closes itself and the Apache HTTP Server 2.0 Installation Wizard reports

that the Apache HTTP server has been installed successfully. Click the Finished

button to close the HTTP server installation wizard.

IV. Testing the APACHE server installation:

1. In order to test your Apache web server installation, open a browser and enter

http://localhost/ into the address bar (unless you used a different value then

localhost in the Apache server information step). The Test Page for Apache

installation should be displayed into your browser.

Page 53: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 53

8. Configure Network Services

Part of the Apache HTTP server test page in Mozilla Firefox

2. If you don't get the test page it might be that the Apache web server was not able to

start for some reason, check the error.log file in the logs folder of the web server

(see the next section).

V. Understanding the apache folder structure:

1. It is important to understand some part of the Apache HTTP server folder structure,

or where is what located. I won't describe each and every item, but just mention the

important ones:

8. Configure Network Services

Page 54: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 54

Apache folder structure

• The bin folder

The bin folder contains amongst other files the server executable: Apache.exe and a

program to control the Apache HTTP server when ran as service: ApacheMonitor.exe. Also

contained in this folder are htpasswd.exe and htdigest.exe for making parts of your site(s)

restricted.

• The cgi-bin folder

The cgi-bin folder has one CGI program written in Perl, printenv.pl, which you can use

to test if your Perl installation is working in combination with the Apache HTTP server. If

you get a "500 Internal Server Error" when you enter http://localhost/cgi-bin/printenv.pl in

the address bar of your browser, you either have Perl not installed, or the configuration of

the web server is not right. You might want to check the error.log file in the logs folder in

the latter case.

• The conf folder

This folder holds the configuration files used by the Apache web server. Of each file

used by the server there is a copy which has .default in its name, e.g. httpd.default.conf.

The access.conf and srm.conf files are empty (except for comments) by default, and I

recommend to not use those files for configuring the server. The httpd.conf file has already

Page 55: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 55

been updated by the installation process. I list some of those modified settings below,

including a short description and the line number (which might differ with your version).

• Listen 80 - The port the Apache server is using. If you have already a web server

running, for example as part of Microsoft Internet Information Services (IIS), you

might want to change the number to something different (line 120).

• ServerAdmin admin@localhost - The email address of the server administrator,

which is used on, for example, error pages generated by the server (line 198).

• ServerName localhost:80 - The hostname and port the server uses (line 212).

Some of the other settings are omitted since they will be overridden by the name-based

virtual hosting set up discussed below.

• htdocs

This folder contains the default HTML page you see when you visit http://localhost/

with your web browser. Don't start adding your HTML documents and related files to this

folder, but read on.

• manual

This folder contains the Apache HTTP server documentation, available as

http://localhost/manual/. Note that this folder shows up under the document root thanks to

the AliasMatch directive in the httpd.conf server configuration file (line 491).

• logs

This folder contains (amongst others) the access.log and error.log files. If anything goes

wrong, for example the notorious 500 Internal Server Error, make sure that you check the

error.log file. With virtual hosting you can give each site its own log file (discussed below),

so be sure to check the right file(s).

FAQs:

1. Which are the ports used for FTP and TFTP services?

2. Why does an FTP service require two ports to connect to server?

3. What is SSH?

4. What is a web server? Name a few.

5. What is APACHE?

Page 56: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 56

9. Study Of Existing College Network

Title: Case Study of existing College network with IP Address Scheme.

Aim: To under stand the IP address schemes and Internet

Objective: After going through this assignment you will be in a position to:

1. Connect all of the departments in the campus to the network.

2. Provide internet connectivity to all departments and major Institutes.

3. Obtain sufficient international bandwidth to support the academic activities of the

staff and students of the departments and institutes.

4. Expand campus wide networking in other new institutes.

5. Operate and maintain the campus wide networks.

6. Deploy applications such as distance education and library functions based on the

networks.

Theory: Elaborate the following points:

1. Network hardware and software used.

2. Design of network

3. Working

4. Approximate cost

Activities:

1. Visit the server room and List out the hardware component used.

2. Find out the topology.

3. Find out how other departments are interconnected to each other.

FAQ:

1. Which topology is used in the lab?

2. What is a leased line?

3. What is broadband?

4. What is backbone cable?

5. Why FOC used as backbone cable?

Page 57: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 57

10. NS-2 Installation

AIM: Installation of NS-2

OBJECTIVE: This lab will introduce the installation procedure for network simulator

(NS) , more popularly called as NS-2.

THEORY:

1. What is NS/ NS-2?

2. Why NS2 is used?

3. What are the advantages of using NS2 ?

STEPS FOR INSTALLATION:

The following general steps should be followed to install NS2 on windows:

1. Requirements

a. Free disk space of 5GB required

b. Minimum 256MB RAM suggested

2. Assumptions

a. Windows installed in Drive partition “C”

3. Installation Instructions for CYGWIN

a. Download CYGWIN using setup.exe from http://www.cygwin.com

b. Run setup.exe

Page 58: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 58

10. NS-2 Installation

c. There are two ways to install after this step :

i. Install from Internet

(This option is generally chosen, as everything is done automatically.)

ii. Download and then Install

(This option is desired when needed to install on large no. of machines.)

d. Selecting Root directory where CYGWIN is installed

(Recommended root directory path is “C:\cygwin”.)

Page 59: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 59

10. NS-2 Installation

e. Selecting directory where installation files are stored:

f. Selecting connection to internet : Direct connection preferred

Page 60: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 60

10. NS-2 Installation

g. Selecting Mirror site to download cygwin:

Select one of the mirror site , generally preference is made to site that’s near to download location.

h. Selection of packages to install:

Since CYGWIN has lot of packages , its desirable to install all packages.

Page 61: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 61

In order to achieve this , Click view button , until it shows “full” .

In order to make all packages installed, click the each of “skip” entry. After this

step, the installation window looks like this. Just click “Next” to make cygwin

installed.

4. Installation Instructions for Network Simulator (NS-2)

a. Download NS-2 installation file from : http://www.isi.edu/nsnam/dist/ns-

allinone-

Page 62: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 62

2.27.tar.gz

b. Save the above file in : C:\cygwin\

c. Now open the cygwin window by clicking the cygwin shortcut on the desktop

d. Inorder to extract the NS installation file , go to the location where the

installation file is stored , by following commands:

_ cd c:

_ cd cygwin/

e. Extraction of files :

Extract the installation files by the following commands:

_ gzip –d ns-allinone-2.27.tar.gz

_ tar –xvf ns-allinone-2.27.tar

by the above commands there will be directory created in the name of ns-allinone-

2.27

f. Installing the packages from extracted files :

Commands to be executed :

_ cd ns-allinone-2.27

after the above step :

_ ./install

This command will initiate the process of installing NS2.

IMP NOTE: if in the process , you get a prompt saying “ package diff missing do u

want to proceed , press Y for proceeding or N for exiting. If all the above steps are

followed there should not be any error in installing NS2. if in any case if u get an

error message saying that package missing , it means that those packages are

skipped at the time of installation so u have to install those packages by doing setup

again .

g. Validating NS2:

Move to the folder containing NS-2(i.e. ns-2.27) and then type the following

command

./validate

This will test the installation of NS2 with the predefined examples.

NOTE (IMP):

Common errors and guidelines:

1) its always preferred to install cygwin as a normal user.

2) Check for display setting using at the prompt:

startx

This will open a Xserver window. Now open another instance of cygwin and

Standard working principles for NS:

Step 1: Open CYGWIN bash prompt

Step 2: go to location of TCL file

Step 3: type startx

Page 63: Computer Networking Lab Manulas for TE IT PUNE 2010

Network Laboratory SCOEIT 63

You will find the following screen:

After entering the startx command, the following screen appears:

FAQs:

1. What is NS2?

2. Where NS2 is used? Which is the other option that can be used instead of NS2?

3. On what all platforms the NS can run?

4. What all protocols does NS support?

5. Which scripting language NS2 uses?

EXERSIZE:

1. Simulate a simple network with ICMP command on NS2