Computer Networks
Computer Networks
2) Ring
3) Star
Twisted-Pair Cable:
Twisted-pair cable is a type of cabling that is used for telephone
communications and most modern Ethernet networks. A pair of wires forms a
circuit that can transmit data. The pairs are twisted to provide protection
against crosstalk, the noise generated by adjacent pairs. When electrical current
flows through a wire, it creates a small, circular magnetic field around the wire.
When two wires in an electrical circuit are placed close together, their magnetic
fields are the exact opposite of each other. Thus, the two magnetic fields cancel
each other out. They also cancel out any outside magnetic fields. Twisting the
wires can enhance this cancellation effect. Using cancellation together with
twisting the wires, cable designers can effectively provide self-shielding for wire
pairs within the network media.
Two basic types of twisted-pair cable exist:
1) Unshielded Twisted Pair (UTP)
2) Shielded Twisted Pair (STP)
Coaxial Cable:
Coaxial cable consists of a hollow outer cylindrical conductor that
surrounds a single inner wire made of two conducting elements. One of these
elements, located in the center of the cable, is a copper conductor. Surrounding
the copper conductor is a layer of flexible insulation. Over this insulating material
is a woven copper braid or metallic foil that acts both as the second wire in the
circuit and as a shield for the inner conductor. This second layer, or shield, can
help reduce the amount of outside interference. Covering this shield is the cable
jacket.
Coaxial cable supports 10 to 100 Mbps and is relatively inexpensive,
although it is more costly than UTP on a per-unit length. However, coaxial cable
can be cheaper for a physical bus topology because less cable will be needed.
Coaxial cable can be cabled over longer distances than twisted-pair cable. For
example, Ethernet can run approximately 100 meters (328 feet) using twisted-pair
cabling. Using coaxial cable increases this distance to 500m (1640.4 feet).
Optical Fiber:
Optical Fiber cables use optical fibers that carry digital data signals in the
form of modulated pulses of light. An optical fiber consists of an extremely thin
cylinder of glass, called the core, surrounded by a concentric layer of glass,
known as the cladding. There are two fibers per cableone to transmit and one
to receive. The core also can be an optical-quality clear plastic, and the cladding
can be made up of gel that reflects signals back into the fiber to reduce signal
loss.
HUB:
A hub works in the physical layer of the OSI model. It is basically a nonintelligent device, and has no decision making capability. What a Hub basically
does is take the input data from one of the ports and broadcast the information
to all the other ports connected to the network. Due to their design, they
increase the chances for collisions. Hubs flood incoming packets to all ports all
the time. Hubs pose a security risk since all packets are flooded to all ports all
the time. If a user has packet sniffing software, they can extract data from the
network and potentially decode it and use it. Hubs make it easy to "spy" on
users on the same LAN as you.
SWITCHES:
A switch is an intelligent device that works in the data link layer. The term
intelligent refers to the decision making capacity of the Switch. Since it works in
the Data link layer, it has knowledge of the MAC addresses of the ports in the
network.
BRIDGE:
A bridge is a computer networking device that builds the connection with
the other bridge networks which use the same protocol. It works at the Data
Link layer of the OSI Model and connects the different networks together and
develops communication between them. It connects two local-area networks;
two physical LANs into larger logical LAN or two segments of the same LAN that
use the same protocol.
Apart from building up larger networks, bridges are also used to segment
larger networks into smaller portions. The bridge does so by placing itself
between the two portions of two physical networks and controlling the flow of
the data between them.
ROUTER:
Routers are network layer devices and are particularly identified as Layer3 devices of the OSI Model. They process logical addressing information in the
Network header of a packet such as IP Addresses. Router is used to create larger
complex networks by complex traffic routing. It has the ability to connect
dissimilar LANs on the same protocol. It also has the ability to limit the flow of
broadcasts. A router primarily comprises of a hardware device or a system of
the computer which has more than one network interface and routing software.
When a router receives the data, it determines the destination address by
reading the header of the packet. Once the address is determined, it searches in
its routing table to get know how to reach the destination and then forwards
the packet to the higher hop on the route. The hop could be the final
destination or another router.
Routing tables play a very pivotal role in letting the router makes a
decision. Thus a routing table is ought to be updated and complete.
BROUTER:
Brouter (Bridging Router) is a device which has two functions.
Brouter acts as a router for known protocols (known by the router and those on
the network) and hence works in the network layer. For data packets with
unknown protocols, it acts as a bridge by connecting two different networks
which is the function of a bridge - and this works in the data-link layer.
MODEM:
A modem is a device that makes it possible for computers to
communicate over telephone lines. The word modem comes from Modulate
and Demodulate. Because standard telephone lines use analog signals, and
computers digital signals, a sending modem must modulate its digital signals
into analog signals. The computers modem on the receiving end must then
demodulate the analog signals into digital signals.
java.io.BufferedReader;
java.io.BufferedWriter;
java.io.InputStream;
java.io.InputStreamReader;
java.io.OutputStream;
java.io.OutputStreamWriter;
java.net.ServerSocket;
java.net.Socket;
{
int numberInIntFormat = Integer.parseInt(number);
int returnValue = numberInIntFormat*2;
returnMessage = String.valueOf(returnValue) + "\n";
}
catch(NumberFormatException e)
{
//Input was not a number. Sending proper message back to client.
returnMessage = "Please send a proper number\n";
}
Outputs:
to set them to obtain their IP addresses automatically. Are you sure you want to
enable Internet Connection Sharing?
11. Click Yes.
The connection to the Internet is shared to other computers on the local area network
(LAN).
The network adapter that is connected to the LAN is configured with a static IP
address of 192.168.0.1 and a subnet mask of 255.255.255.0
On the client computer
To connect to the Internet by using the shared connection, you must confirm the
LAN adapter IP configuration, and then configure the client computer. To confirm
the LAN adapter IP configuration, follow these steps:
1. Log on to the client computer as Administrator or as Owner.
2. Click Start, and then click Control Panel.
3. Click Network and Internet Connections.
4. Click Network Connections.
5. Right-click Local Area Connection and then click Properties.
6. Click the General tab, click Internet Protocol (TCP/IP) in the connection uses
the following items list, and then click Properties.
7. In the Internet Protocol (TCP/IP) Properties dialog box, click Obtain an IP
address automatically (if it is not already selected), and then click OK.
Note: You can also assign a unique static IP address in the range of 192.168.0.2 to
192.168.0.254. For example, you can assign the following static IP address, subnet
mask, and default gateway:
8. IP Address 192.168.31.202
9. Subnet mask 255.255.255.0
10. Default gateway 192.168.31.1
11. In the Local Area Connection Properties dialog box, click OK.
ping:
ping sends an ICMP ECHO_REQUEST packet to the specified host. If the host
responds, you get an ICMP packet back. Sound strange? Well, you can ping an IP
address to see if a machine is alive. If there is no response, you know something is
wrong.
traceroute:
Tracert is a command which can show you the path a packet of information takes
from your computer to one you specify. It will list all the routers it passes through
until it reaches its destination, or fails to and is discarded. In addition to this, it will
tell you how long each 'hop' from router to router takes.
nslookup:
Displays information from Domain Name System (DNS) name servers.
NOTE :If you write the command as above it shows as default your pc's server name
firstly.
machines in some respects and using the network simulation cradle produces
results closer to real world network stacks
icast.) over networks
(wireless, wireline, satellite)
NS-2 COMPONENTS:
The tclobject is considered as the ancestor class of the ns-2components, ns object is
the super class of all basic network comp
3onents such as nodes and links. The basic network component such as nodes and
links. The basic networks components are further divided into two subclasses,
connector and classifier, based on the possible output data paths. The basic network
objects that have only one output data path are under the connector class, and
switching objects that have possible multiple output data paths are under the
classifier class.
EVENTS SCHEDULER:
In NS, an event scheduler keeps track of simulation time and fires all the events in
the scheduled for the current time by invoking appropriate network components.
Network components communicate with one another passing packet; however this
does not consume actual simulation time.All the network components that need to
spend some simulation time handling a packets i.e., need a delay use the events
scheduler by issuing an event for the packet and waiting for the events to be forced
to itself before doing further action handling a packet.
NODE AND ROUTING:
Node is a compound object composed of a node entry object and classifiers. There
are types of nodes in NS.A unicast node has an
address classifier that does explicitly notified in the input of the OTcl script, right
after creating a scheduler object, that all the nodes that will be created are multicast
nodes. After specifying the node the user an also select a specific routing protocol
other than using a default one.
LINK:
A link is another major compound object in NS.when a user creates a link using a
duplex-link member function of the simulator object; simplex links in both
directions are created. One thing to note is that output queue of a node is actually
implemented as a part of simplex link object.packets
TRACING:
In TS, network activities traced around simplex links if the simulator is directed to
trace network activities, the links created after the command will have the following
trace objects inserted. When each trace object receives a packet, it writes to the
specified trace file without consuming any simulation time, and passes the packet to
the next network object.
QUEUE MONITOR:
Basically, tracing objects are designed to record packet arrival time at which they
are located although user gets enough information from the trace, they might be
interested in what is going on inside a specific output queue. When a packet arrives,
snoop queue .object notifies the queue monitor object of this event the queue monitor
using this information monitors the queue.
ADVANTAGES:
-2 is originally based on the source code of the BSD kernel.
vents,
CONCLUSION:
Ns-2 provides a very convenient platform for testing different TCP congestion
control protocols in many scenarios. It is a good foundation towards an
implementation for TCP congestion control algorithms.
19. NS-2 Code to Printing Message set sim [new Simulator] $sim at 1 puts
\Hello World!\ $sim at 1.5 exit $sim run 20. NS-2 OTCL Code
o set a 5
o set b $a
o set c [expr $a + $b]
o set d [expr [expr $a - $b] * $c]
o incr x
o incr x -1
o set y [pow x 2]
o set y [expr x*x]
o int: set c [expr 1/6]
o float: set c [expr 1.0 / 6.0 ]
o Display: puts "Must enter atleast one Arguments"
o Control structures: if {$x > 0} {
return $x } else { return [expr -$x] } Open file for NS tracing set f [open out.tr w]
$ns trace-all $f
Theory:
The world experiences the Internet through the use of the World Wide Web, e-mail,
and file-sharing programs. These applications, as well as others, provide the human
interface to the underlying network, allowing you to send and receive information
with relative ease. Most of the applications are intuitive; they can be accessed and
used without the need to know how they work. As you continue to study the world
of networking, it becomes more important to know how an application is able to
format, transmit, and interpret messages that are sent and received across the
network.
Application Layer Protocol Functions
Both the source and destination devices use application layer protocols during a
communication session. For the communications to be successful, the application
layer protocols implemented on the source and destination host must match.
Protocols perform the following tasks:
Establish consistent rules for exchanging data between applications and services
loaded on the participating devices.
Specify how data inside the messages is structured and the types of messages that
are sent between source and destination. These messages can be requests for
services, acknowledgments, data messages, status messages, or error messages.
Define message dialogues, ensuring that a message being sent is met by the
expected response and that the correct services are invoked when data transfer
occurs. Many different types of applications communicate across data networks.
1. FTP
2. Telnet
FTP
FTP is another commonly used application layer protocol. FTP was developed to
allow file transfers between a client and a server. An FTP client is an application
that runs on a computer that is used to push and pull files from a server running the
FTP daemon (FTPd). To successfully transfer files, FTP requires two connections
between the client and the server: one for commands and replies, and the other for
the actual file transfer. The client establishes the first connection to the server on
TCP port 21. This connection is used for control traffic, consisting of client
commands and server replies. The client establishes the second connection to the
server over TCP port 20. This connection is for the actual file transfer and is created
every time a file is transferred. The file transfer can happen in either direction, as
shown in . The client can download (pull) a file from the server or upload (push) a
file to the server.
FTP Process
Telnet Services and Protocol
Long before desktop computers with sophisticated graphical interfaces existed,
people used text-based systems that were often just display terminals physically
attached to a central computer. After networks were available, people needed a way
to remotely access the computer systems in the same manner that they did with the
directly attached terminals. Telnet was developed to meet that need. It dates back to
the early 1970s and is among the oldest of the application layer protocols and
services in the TCP/IP suite. Telnet is a client/server protocol that provides a
standard method of emulating text-based terminal devices over the data network.
Both the protocol itself and the client software that implements
the protocol are commonly referred to as Telnet.
Telnet Service
Appropriately enough, a connection using Telnet is called a VTY (Virtual Terminal)
session, or connection. Telnet specifies how a VTY session is established and
terminated. It also provides the syntax and order of the commands used to initiate
the Telnet session, and it provides control commands that can be issued during a
session. Each Telnet command consists of at least 2 bytes. The first byte is a special
character called the Interpret as Command (IAC) character. As its name implies,
the IAC character defines the next byte as a command rather than text. Rather than
using a physical device to connect to the server, Telnet uses software to create a
virtual device that provides the same features of a terminal
session with access to the server command-line interface (CLI).
To support Telnet client connections, the server runs a service called the Telnet
daemon. A virtual terminal connection is established from an end device using a
Telnet client application. Most operating systems include an application layer Telnet
client. On a Microsoft Windows PC, Telnet can be run from the command prompt.
Other common terminal applications that run as Telnet clients are HyperTerminal,
Minicom, and TeraTerm. When a Telnet connection is established, users can
perform any authorized function on the server, just as if they were using a commandline session on the server itself. If authorized, they can start and stop processes,
configure the device, and even shut down the system.