Network

Msc Computer Science Network Lab
Second Semester
 Calicut University


COMPUTER NETWORK - PRACTICAL SECTION

Objectives
To practically implement the theory portions covered in Computer Networks (CSS2C03).
To extend the programming knowledge acquired thru The Art of Programming Methodology
(CSS1C04).
Course Outline

1. Design a LAN with a given set of requirements. The design should include topology, hardware and software requirements like cable, connectors, hubs/ switches/bridges,interface cards along with a budget for the LAN.(Faculty in charge should give the requirements to the students).

2. Establish a LAN that consists of at least one server and two clients.

3. Study of network utilities in Linux/Windows (hostname, ping, ifconfig, ipconfig, netstat,nslookup, telnet, traceroute, finger, telnet, tracert, arp, ftp etc). Download



Programs

4. Implementation of TCP Client.
5. Implementation of TCP Server.
6. Write a program to check the Date and Time in TCP Date Time Client.
7. Write a program to check the Date and Time in TCP Date Time Server.
8. Implementation of UDP client and server.
9. Write a program to transfer Files using UDP. (Server , Client)
10. Implementation of transferring files using FTP. (Server, Client)
11. Write a program to simulate the sliding window protocol.(Server, Client)
      (What is Sliding Window?)

12. Study of Network Simulators (NS2/Glomosim).

Related Programs
 
 13. Write a program to check the given string is Palindrome or not using Server client Technology
14. Display IP-4 Address

How to Write Record Book?
15. A sample Echo Client Server Program using UDP and TCP with Algorithm 

Viva 
What is Sub netting?
What is Socket?

 ==============================================



LAN DESIGNING
AIM:
Design a LAN with a given set of requirements.


LAN (Local Area Network).
A LAN (Local Area Network) is an individual network that covers a single geographical area, providing networking services and applications to people within a common managerial structure, such as a single business, campus or region. A LAN is usually administered by a single organization. The administrative control that governs the security and access control policies are enforced on the network level. 
HUB
Networks using a Star topology require a central point for the devices to connect. Originally this device was called a concentrator since it consolidated the cable runs from all network devices. The basic form of concentrator is the hub. the hub is a hardware device that contains multiple, independent ports that match the cable type of the network. Most common hubs interconnect Category 3 or 5 twisted-pair cable with RJ-45 ends, although Coax BNC and Fiber Optic BNC hubs also exist. The hub is considered the least common denominator in device concentrators. Hubs offer an inexpensive option for transporting data between devices, but hubs don't offer any form of intelligence. Hubs can be active or passive.
An active hub strengthens and regenerates the incoming signals before sending the data on to its destination.
Passive hubs do nothing with the signal.

Switches
Switches are a special type of hub that offers an additional layer of intelligence to basic, physical-layer repeater hubs. A switch must be able to read the MAC address of each frame it receives. This information allows switches to repeat incoming data frames only to the computer or computers to which a frame is addressed. This speeds up the network and reduces congestion.Switches operate at both the physical layer and the data link layer of the OSI Model. 

 
Bridges
A bridge is used to join two network segments together, it allows computers on either segment to access resources on the other. They can also be used to divide large networks into smaller segments. Bridges have all the features of repeaters, but can have more nodes, and since the network is divided, there is fewer computers competing for resources on each segment thus improving network performance.Bridges can also connect networks that run at different speeds, different topologies, or different protocols. But they cannot, join an Ethernet segment with a Token Ring segment, because these use different networking standards. Bridges operate at both the Physical Layer and the MAC sublayer of the Data Link layer. Bridges read the MAC header of each frame to determine on which side of the bridge the destination device is located, the bridge then repeats the transmission to the segment where the device is located.

Routers
Routers Are networking devices used to extend or segment networks by forwarding packets from one logical network to another. Routers are most often used in large internetworks that use the TCP/IP protocol suite and for connecting TCP/IP hosts and local area networks (LANs) to the Internet using dedicated leased lines.Routers work at the network layer (layer 3) of the Open Systems Interconnection (OSI) reference model for networking to move packets between networks using their logical addresses (which, in the case of TCP/IP, are the IP addresses of destination hosts on the network). Because routers operate at a higher OSI level than bridges do, they have better packet-routing and filtering capabilities and greater processing power, which results in routers costing more than bridges.
Unlike bridges and switches, routers cannot compile routing tables from the information in the data packets they process. This is because the routing table contains more detailed information than is found in a data packet, and also because the router needs the information in the table to process the first packets it receives after being activated. A router can't forward a packet to all possible destinations in the way that a bridge can.
  • Static routers: These must have their routing tables configured manually with all network addresses and paths in the internetwork.
  • Dynamic routers: These automatically create their routing tables by listening to network traffic.
  • Routing tables are the means by which a router selects the fastest or nearest path to the next "hop" on the way to a data packet's final destination. This process is done through the use of routing metrics.
  • Routing metrics which are the means of determining how much distance or time a packet will require to reach the final destination. Routing metrics are provided in different forms.
  • hop is simply a router that the packet must travel through.
  • Ticks measure the time it takes to traverse a link. Each tick is 1/18 of a second. When the router selects a route based on tick and hop metrics, it chooses the one with the lowest number of ticks first.
You can use routers, to segment a large network, and to connect local area segments to a single network backbone that uses a different physical layer and data link layer standard. They can also be used to connect LAN's to a WAN's.

NICs (Network Interface Card)
Network Interface Card, or NIC is a hardware card installed in a computer so it can communicate on a network. The network adapter provides one or more ports for the network cable to connect to, and it transmits and receives data onto the network cable.Every networked computer must also have a network adapter driver, which controls the network adapter. Each network adapter driver is configured to run with a certain type of network adapter.




NETWORK UTILITY IN LINUX
AIM:
Study of network utilities in LINUX.


Study of network utilities in LINUX/Windows
The following commands enables you to quickly troubleshoot connection issues e.g. whether other system is connected or not , whether other host is responding or not.
hostname
finding host/domain name and IP address – hostname
hostname
with no options displays the machines host name
hostname –d
displays the domain name the machine belongs to
hostname –f
displays the fully qualified host and domain name
hostname –i
displays the IP address for the current machine

test network connection – ping
If you are having connectivity problems, you can use the ping command to check the destination IP address you want to reach and record the results. The ping command displays whether the destination responded and how long it took to receive a reply. If there is an error in the delivery to the destination, the ping command displays an error message.
You can use the ping command to:
  • Ping your computer (by address, not host name) to determine that TCP/IP is functioning. (Pinging your computer does not verify that your network adapter is functioning.)
  • Ping the local router to determine whether the router is running.
  • Ping beyond your local router.
  • ping
    It sends packets of information to the user-defined source. If the packets are received, the destination device sends packets back. Ping can be used for two purposes
    1. To ensure that a network connection can be established.
    2. Timing information as to the speed of the connection.
    If you do ping www.yahoo.com it will display its IP address. Use ctrl+C to stop the test.

getting network configuration – ifconfig
Network connections, routing tables, interface statistics – netstat
query DNS lookup name – nslookup
communicate with other hostname – telnet
outing steps that packets take to get to network host – traceroute
view user information – finger
checking status of destination host - telnet




ifconfig

View network configuration, it displays the current network adapter configuration. It is handy to determine if you are getting transmit (TX) or receive (RX) errors.

netstat

Most useful and very versatile for finding connection to and from the host. You can find out all the multicast groups (network) subscribed by this host by issuing "netstat -g"
netstat -nap | grep port will display process id of application which is using that port
netstat -a  or netstat –all will display all connections including TCP  and UDP  
netstat --tcp  or netstat –t will display only TCP  connection
netstat --udp or netstat –u will display only UDP  connection
netstat -g will display all multicast network subscribed by this host.






nslookup
If you know the IP address it will display hostname. To find all the IP addresses for a given domain name, the command nslookup is used. You must have a connection to the internet for this utility to be useful.
E.g. nslookup blogger.com
You can also use nslookup to convert hostname to IP Address and from IP Address from hostname.

traceroute
A handy utility to view the number of hops and response time to get to a remote system or web site is traceroute. Again you need an internet connection to make use of this tool.

finger
View user information, displays a user’s login name, real name, terminal name and write status. this is pretty old unix command and rarely used now days.

telnet
Connects destination host via telnet protocol, if telnet connection establish on any port means connectivity between two hosts is working fine.
telnet hostname port   will telnet hostname with the port specified. Normally it is used to see whether host is alive and network connection is fine or not.