You are on page 1of 44

`

Subject Code BITP404

Subject:-Transmission Control Protocol/Internet Protocol


Semester/Year:-VIII th Sem /4Th Year

Department of Information Technology

G.H.Raisoni College of Engineering, Nagpur


Department of Information Technology
_________________________________________________________

BITL404

TCP/IP
Session 2014-15

Total Hours: 30 hours


Evaluation Scheme: Practical

Practical List:Sr. No

Name of practical

Relevant course
outcome

1.

To Implement allocation of IP Address

C01

To Configure Internet IP address

C01

To Assign IP address using CIDR

C02

To Configure APACHE server

C02

To Decode header fields of IP datagram

C02

To Decode header fields of TCP header

C02

To configure a DNS Server

C03

Identify ,Download & Install open source tools related to


TCP/IP

C04

Compile & Test TTCP

C04

Course Outcomes:

Upon successful completion of the course, students will be able to

1. Understand the basics of TCP/IP.


2. Identify principal beyond TCP/IP involved in the real time applications.
3. Develop an appropriate mathematical formulation for the networking problems, and analyze
them in order to find the most suitable solution.
4. Understand advanced computing techniques and tools in the area of networking and TCP/TP
systems, its modeling and analysis.

In-Charge
Er S. A. Chhabria

PRACTICAL NO 1
Aim: To Implement allocation of IP Address
An Internet Protocol address (IP address) is a numerical label assigned to each device (e.g., computer, printer) participating in a
computer network that uses the Internet Protocol for communication. An IP address serves two principal functions: host or
network interface identification and location addressing. Its role has been characterized as follows: "A name indicates what we
seek. An address indicates where it is. A route indicates how to get there."
The designers of the Internet Protocol defined an IP address as a 32-bit number[1] and this system, known as Internet
Protocol Version 4 (IPv4), is still in use today. However, due to the enormous growth of the Internet and the predicted depletion of
available addresses, a new version of IP (IPv6), using 128 bits for the address, was developed in 1995.[3] IPv6 was standardized as
RFC 2460 in 1998,[4] and its deployment has been ongoing since the mid-2000s.
IP addresses are binary numbers, but they are usually stored in text files and displayed in human-readable notations, such
as 172.16.254.1 (for IPv4), and 2001:db8:0:1234:0:567:8:1 (for IPv6).
The Internet Assigned Numbers Authority (IANA) manages the IP address space allocations globally and delegates five
regional Internet registries (RIRs) to allocate IP address blocks to local Internet registries (Internet service providers) and other
entities.
IPv4 addresses
Decomposition of an IPv4 address from dot-decimal notation to its binary value.
In IPv4 an address consists of 32 bits which limits the address space to 4294967296 (232) possible unique addresses. IPv4 reserves
some addresses for special purposes such as private networks (~18 million addresses) or multicast addresses (~270 million
addresses).
IPv4 addresses are canonically represented in dot-decimal notation, which consists of four decimal numbers, each ranging from 0
to 255, separated by dots, e.g., 172.16.254.1. Each part represents a group of 8 bits (octet) of the address. In some cases of
technical writing, IPv4 addresses may be presented in various hexadecimal, octal, or binary representations.
Classless subnetting
IP networks are groups of adjacent addresses that are usually are routed similarly. Modern IP networks use Classless Inter-Domain
Routing where any subnetwork has a common prefix where all bits in the address are identical. Network blocks are written with
CIDR notation with an IP address giving the prefix, a slash character, and the number of bits in the prefix. For example,
192.0.2.0/24 indicates there are 24 bits in the network, and they are 192.0.2.
Classful subnetting (historical)
In the early stages of development of the Internet Protocol, network administrators interpreted an IP address in two parts: network
number portion and host number portion. The highest order octet (most significant eight bits) in an address was designated as the
network number and the remaining bits were called the rest field or host identifier and were used for host numbering within a
network.
This early method soon proved inadequate as additional networks developed that were independent of the existing networks
already designated by a network number. In 1981, the Internet addressing specification was revised with the introduction of
classful network architecture.
Classful network design allowed for a larger number of individual network assignments and fine-grained sub network design. The
first three bits of the most significant octet of an IP address were defined as the class of the address. Three classes (A, B, and C)
were defined for universal unicast addressing. Depending on the class derived, the network identification was based on octet
boundary segments of the entire address. Each class used successively additional octets in the network identifier, thus reducing the
possible number of hosts in the higher order classes (B and C). The following table gives an overview of this now obsolete system.

IPv6 addresses
Decomposition of an IPv6 address from hexadecimal representation to its binary value.
The rapid exhaustion of IPv4 address space, despite conservation techniques, prompted the Internet Engineering Task Force
(IETF) to explore new technologies to expand the addressing capability in the Internet. The permanent solution was deemed to be
a redesign of the Internet Protocol itself. This next generation of the Internet Protocol, intended to replace IPv4 on the Internet,
was eventually named Internet Protocol Version 6 (IPv6) in 1995. The address size was increased from 32 to 128 bits or 16 octets.
This, even with a generous assignment of network blocks, is deemed sufficient for the foreseeable future. Mathematically, the new
address space provides the potential for a maximum of 2128, or about 3.4031038 addresses.
The primary intent of the new design is not to provide just a sufficient quantity of addresses, but rather to allow an efficient
aggregation of subnetwork routing prefixes at routing nodes. As a result, routing table sizes are smaller, and the smallest possible
individual allocation is a subnet for 264 hosts, which is the square of the size of the entire IPv4 Internet. At these levels, actual
address utilization rates will be small on any IPv6 network segment. The new design also provides the opportunity to separate the
addressing infrastructure of a network segment, that is the local administration of the segment's available space, from the
addressing prefix used to route external traffic for a network. IPv6 has facilities that automatically change the routing prefix of
entire networks, should the global connectivity or the routing policy change, without requiring internal redesign or manual
renumbering.
The large number of IPv6 addresses allows large blocks to be assigned for specific purposes and, where appropriate, to be
aggregated for efficient routing. With a large address space, there is no need to have complex address conservation methods as
used in CIDR.
Many modern desktop and enterprise server operating systems include native support for the IPv6 protocol, but it is not yet widely
deployed in other devices, such as home networking routers, voice over IP (VoIP) and multimedia equipment, and network
peripherals.
CONCLUSION: thus we have studied allocation of IP Address

PRACTICAL NO 2
Aim: To Configuring Intranet IP address
Overview: create an internet that contains of 4 networks interconnected by 3 routers and assign IP subnet address to the host and
the router.
Theory:Step1: the IP address 192.168.0.0 has two octets of network prefix and two cotes of network suffix. Computer and record the
address mask in dotted decimal if the third octet is used for subnet addressing.
Step2: use five layers, 2 switches, four routers and 10 general purpose computers to form the intranet topology that figures out in
fig 01
Step3: use that third octet as a subnet octet and assign a unique subnet address to each of the five networks in your
intranet. Write down subnet address in doted decimal
Third octet
subnet Address
Network ID 01:
0010 0000
192.168.32.0
0100 0000
192.168.64.0
1000 0000
192.168.128.0
1010 0000
192.168.160.0
1110 0000
192.168.224.0
Step 4:
Assign an IP address to each router interface and configure each router with an address and mask for each of its interface.
Step 5: configure the routing table in each router with next hop information for each of the five possible destination networks.
Routing table for R1:
Subnet address
next Hop
Interface Node
192.168.32.0
m0
192.168.64.0
m1
192.168.128.0
192.168.32.4(R2)
m0
192.168.160.0
192.168.64.4(R3)
m1
192.168.192.0
192.168.32.4(R2)
m0
Routing table for R2:
Subnet address
192.168.32.0
192.168.64.0
192.168.128.0
192.168.160.0
192.168.192.0

next Hop

Subnet address
192.168.32.0
192.168.64.0
192.168.128.0
192.168.160.0
192.168.192.0

next Hop
192.168.64.1(R1)
192.168.64.1(R1)
192.168.64.1(R1)

Interface Node

Subnet address
192.168.32.0
192.168.64.0
192.168.128.0

next Hop
192.168.128.1(R2)
192.168.128.1(R2)
-

Interface Node
m0
m0

192.168.32.1(R2)
192.168.32.1(R3)
192.168.128.4(R4)

Interface Node
m0
m0
m1
m0
m1

Routing table for R3:


m0
m0
m0
m1
m1

Routing table for R4:

m0

`
192.168.160.0
192.168.128.1(R2)
m0
192.168.192.0
m1
Setp6: Assign each host in your intranet an IP address and configure each host to browse it address
Step 7: use ping to test that your address assignment and configuration works correctly. Ping a host a same network and a host an
each of the other network.
CONCLUSION: thus we have studied to assign the fixed length IP subnet address

`
PRACTICAL NO 3
Aim: - To Assign IP address using CIDR
Theory:
CIDR is a new addressing scheme for the Internet which allows for more efficient allocation of IP addresses than the old Class A,
B, and C address scheme.
With a new network being connected to the Internet every 30 minutes the Internet was faced with two critical problems:

Running out of IP addresses


Running out of capacity in the global routing tables

Running Out of IP Addresses


There is a maximum number of networks and hosts that can be assigned unique addresses using the Internet's 32-bit long
addresses. Traditionally, the Internet assigned "classes" of addresses: Class A, Class B and Class C were the most common. Each
address had two parts: one part to identify a unique network and the second part to identify a unique host in that network. Another
way the old Class A, B, and C addresses were identified was by looking at the first 8 bits of the address and converting it to its
decimal equivalent.
Address Class

# Network Bits

# Hosts Bits

Decimal Address Range

Class A

8 bits

24 bits

1-126

Class B

16 bits

16 bits

128-191

Class C

24 bits

8 bits

192-223

Using the old Class A, B, and C addressing scheme the Internet could support the following:

126 Class A networks that could include up to 16,777,214 hosts each


Plus 65,000 Class B networks that could include up to 65,534 hosts each
Plus over 2 million Class C networks that could include up to 254 hosts each

(Some addresses are reserved for broadcast messages, etc.). Because Internet addresses were generally only assigned in these
three sizes, there were a lot of wasted addresses. For example, if you needed 100 addresses you would be assigned the smallest
address (Class C), but that still meant 154 unused addresses. The overall result was that while the Internet was running out of
unassigned addresses, only 3% of the assigned addresses were actually being used. CIDR was developed to be a much more
efficient method of assigning addresses.
Global Routing Tables at Capacity
A related problem was the sheer size of the Internet global routing tables. As the number of networks on the Internet
increased, so did the number of routes. A few years back it was forecasted that the global backbone Internet routers were
fast approaching their limit on the number of routes they could

`
support.
Even using the latest router technology, the maximum theoretical routing table size is approximately 60,000 routing table entries.
If nothing was done the global routing tables would have reached capacity by mid-1994 and all Internet growth would be halted.
Two solutions were developed and adopted by the global Internet community:

Restructuring IP address assignments to increase efficiency


Hierarchical routing aggregation to minimize route table entries

Restructuring IP Address Assignments


Classless Inter-Domain Routing (CIDR) is a replacement for the old process of assigning Class A, B and C addresses with a
generalized network "prefix". Instead of being limited to network identifiers (or "prefixes") of 8, 16 or 24 bits, CIDR currently
uses prefixes anywhere from 13 to 27 bits. Thus, blocks of addresses can be assigned to networks as small as 32 hosts or to those
with over 500,000 hosts. This allows for address assignments that much more closely fit an organization's specific needs.
A CIDR address includes the standard 32-bit IP address and also information on how many bits are used for the network prefix.
For example, in the CIDR address 206.13.01.48/25, the "/25" indicates the first 25 bits are used to identify the unique network
leaving the remaining bits to identify the specific host.
Hierarchical Routing Aggregation to Minimize Routing Table Entries
The CIDR addressing scheme also enables "route aggregation" in which a single high-level route entry can represent many
lower-level routes in the global routing tables.
The scheme is similar to the telephone network where the network is setup in a hierarchical structure. A high level, backbone
network node only looks at the area code information and then routes the call to the specific backbone node responsible for that
area code. The receiving node then looks at the phone number prefix and routes the call to its subtending network node responsible
for that prefix and so on. The backbone network nodes only need routing table entries for area codes, each representing huge
blocks of individual telephone numbers, not for every unique telephone number. Currently, big blocks of addresses are assigned to
the large Internet Service Providers (ISPs) who then re-allocate portions of their address blocks to their customers. For example,
Pacific Bell Internet has been assigned a CIDR address block with a prefix of /15 (equivalent to 512 Class C addresses or 131,072
host addresses) and typically assigns its customers CIDR addresses with prefixes ranging from /27 to /19. These customers, who
may be smaller ISPs themselves, in turn re-allocate portions of their address block to their users and/or customers. However, in the
global routing tables all these different networks and hosts can be represented by the single Pacific Bell Internet route entry. In this
way, the growth in the number of routing table entries at each level in the network hierarchy has been significantly reduced.
Currently, the global routing tables have approximately 35,000 entries.
The Internet is currently a mixture of both "CIDR-sized" addresses and old Class A, B and C addresses. Almost all new routers
support CIDR and the Internet authorities strongly encourage all users to implement the CIDR addressing scheme. (We
recommend that any new router you purchase should support CIDR).
The conversion to the CIDR addressing scheme and route aggregation has two major user impacts:
Justifying IP Address Assignments
Where To Get Address Assignments
Even with the introduction of CIDR, the Internet is growing so fast that address assignments must continue to be treated as a
scarce resource. As such, customers will be required to document, in detail, their projected needs. Users may be required from
time to time to document their internal address assignments, particularly when requesting additional addresses. The current
Internet guideline is to assign addresses based on an organization's projected three month requirement with additional
addresses assigned as needed.

RFC 1517: Applicability Statement for the Implementation of CIDR


RFC 1518: An Architecture for IP Address Allocation with CIDR
RFC 1519: CIDR: An Address Assignment and Aggregation Strategy
RFC 1520: Exchanging Routing Information Across Provider Boundaries in the CIDR Environment

`
Conclusion:- The implementation of CIDR has been critical to the continued growth of the Internet, allowing more organizations
and users to take advantage of this increasingly vital global networking and information resource.

`
PRACTICAL NO 4
Aim : To Configuring APACHE server
Theory:Start/Stop/Restart scripts: The script is to be run with the qualifiers start, stop, restart or status.
i.e. /etc/rc.d/init.d/httpd restart. A restart allows the web server to start again and read the configuration files to pick up any
changes. To have this script invoked upon system boot issue the command chkconfig --add httpd. See Linux Init Process Tutorial
for a more complete discussion.
Also Apache control tool: /usr/sbin/apachectl start
Apache Control Command: apachectl:
apache2ctl directive
Directive Description
start

Start the Apache httpd daemon. Gives an error if it is already running.

stop

Stops the Apache httpd daemon.

graceful

Gracefully restarts the Apache httpd daemon. If the daemon is not running, it is started. This
differs from a normal restart in that currently open connections are not aborted.

restart

Restarts the Apache httpd daemon. If the daemon is not running, it is started. This command
automatically checks the configuration files as in configtest before initiating the restart to make
sure the daemon doesn't die.

status

Displays a brief status report.

fullstatus

Displays a full status report from mod_status. Requires mod_status enabled on your server and a
text-based browser such as lynx available on your system. The URL used to access the status

configtest

report can be set by editing the STATUSURL variable in the script.


Run a configuration file syntax test. -t

Apache Configuration Files:


/etc/httpd/conf/httpd.conf: is used to configure Apache. In the past it was broken down
three files.
These may now be all concatenated into one file.
/etc/httpd/conf.d/application.conf: All configuration files in this directory are included during Apache start-up. Used to
store application specific configurations.
/etc/sysconfig/httpd: Holds environment variables used when starting Apache.
into

Basic settings:
Change the default value for ServerName www.<your-domain.com>
Giving Apache access to the file system: It is prudent to limit Apache's view of the file system to only those directories necessary.
This is done with the directory statement. Start by denying access to everything, then grant access to the necessary directories.
Deny access completely to file system root ("/") as the default:

`
<Directory /> Options
None AllowOverride
None </Directory>Grant
access to a user's
directory:

<Directory
/home/user1/public_html>
AllowOverride None order
allow,deny
allow from all
Options Indexes FollowSymLinks
</Directory>

Includes

use the statement UserDir public_html which does this by default for every user account at $HOME/public_html. Change to a
comment (add "#" at beginning of line) from Fedora Core default UserDir disable.

File permissions: The Apache web server daemon must be able to read your web pages in order to feed thier contents to the
network. Use an appropriate umask and file protection. This works: chmod ugo+r -R public_html
One may also use groups to control permisions.
drwx------ 3 userx userx
You must allow the web server running as user "apache" to access the directory if it is to display pages held there.
Fix with command: chmod ugo+rx /home/userx drwxrxr-x 3 userx userx
To view the security context labels applied to your web page files use the command: ls -Z
The system enables/disables SELinux policies in the file /etc/selinux/config SELinux can be turned off by setting the
directive SELINUX. (Then reboot the system):
SELINUX=disabled
or using the command setenforce 0 to temporarily disable SELinux until the next reboot.
When using SELinux security features, the security context labels must be added so that Apache can read your files. The
default security context label used is inherited from the directory for newly created files. Thus a copy (cp) must be used
and not a move (mv) when placing files in the content directory. Move does not create a new file and thus the file does not
recieve the directory security context label. The context labels used for the default Apache directories can be viewed with
the command: ls -Z /var/www The web directories of users (i.e. public_html) should be set with the appropriate context
label (httpd_sys_content_t).

Assign a security context for web pages: chcon -R -h -t httpd_sys_content_t /home/user1/public_html Options:

-R: Recursive. Files and directories in current directory and all subdirectories.
-h: Affect symbolic links.
-t: Specify type of security context.
se the following security contexts:

Context Type

Description
Used for static web content. i.e. HTML web pages.

httpd_sys_content_t
httpd_sys_script_exec_t

Use for executable CGI scripts or binary executables.


CGI is allowed to alter/delete files of this context.

httpd_sys_script_rw_t
CGI is allowed to read or append files of this context.
httpd_sys_script_ra_t
CGI is allowed to read files and directories of this context.
httpd_sys_script_ro_t

Set
the
(or set to false)

Policy

following

options:

setsebool

httpd-option

Description
Allow httpd cgi support.

httpd_enable_cgi
httpd_enable_homedirs

Allow httpd to read home directories.


Allow httpd to run SSI executables in the same domain as system CGI scripts.

httpd_ssi_exec
Then restart Apache:
/etc/init.d/httpd restart
service httpd restart
The default SE boolean values are specified in the file: /etc/selinux/targeted/booleans
Configuring a "name based" virtual host:
A virtual host configuration allows one to host multiple web site domains on one server.
NameVirtualHost XXX.XXX.XXX.XXX
<VirtualHost XXX.XXX.XXX.XXX>
ServerName www.your-domain.com
configuration file (/var/named/...)
ServerAlias
your-domain.com
ServerAdmin user1@your-domain.com
DocumentRoot /home/user1/public_html

- CNAME (bind DNS alias www) specified in Bind


- Allows requests by domain name without the "www" prefix.

ErrorLog
logs/your-domain.com-error_log
TransferLog logs/your-domain.com-access_log
</VirtualHost>

true

`
You can specify more than one IP address. i.e. if web server is also being used as a firewall/gateway and you have an
external internet IP address as well as a local network IP address.
NameVirtualHost XXX.XXX.XXX.XXX
NameVirtualHost 192.168.XXX.XXX
<VirtualHost XXX.XXX.XXX.XXX 192.168.XXX.XXX>
..
..
Use your IP address for XXX.XXX.XXX.XXX, actual domain name and e-mail address.
One can use DNS views to provide different local network DNS results.
Note that Configure Apache for both requests http://www.domain-name.com and http://domain-name.com.
Once virtual hosts are configured, your default system domain (/var/www/html) will stop working. Your default domain now must be
configured as a virtual domain.
<Directory "/var/www/html">
... This part remains the same
..
</Directory>
# Add a VirtualHost definition for what was once the default.
<VirtualHost XXX.XXX.XXX.XXX> ServerName
www.your-domain.com ServerAlias your-domain.com
ServerAdmin user1@your-domain.com DocumentRoot
/var/www/html ErrorLog logs/error_log
TransferLog logs/access_log
</VirtualHost>
...
..
Forwarding to a primary URL. It is best to avoid the appearance of duplicated web content from two URLs such as
http://www.your-domain.com and http://your-domain.com. Supply a forwarding Apache "Redirect".
# Add a VirtualHost definition to forward to your primary URL
<VirtualHost XXX.XXX.XXX.XXX> ServerName
your-domain.com ServerAlias other-domain.com
ServerAlias www.other-domain.com
Redirect permanent / http://www.your-domain.com.com/ </VirtualHost>
...
Conclusion: thus a Configuring APACHE server studied

`
PRACTICAL NO 5
Aim: Decode the header fields of IP datagram
Theory:
The Internet Protocol (IP) uses a Datagram service to transfer packets of data between end systems using routers.
The IPv4 packet header consists of 20 bytes of data. An option exists within the header that allows further optional bytes to be
added, but this is not normally used (with the occasional exception of something called "Router Alert"). The full header is
shown below:

The header fields are discussed below:

Version (always set to the value 4 in the current version of IP)

IP Header Length (number of 32 -bit words forming the header, usually five)

Type of Service (ToS), now known as Differentiated Services Code Point (DSCP) (usually set to 0, but may indicate
particular Quality of Service needs from the network, the DSCP defines the way routers should queue packets while
they are waiting to be forwarded).

Size of Datagram (in bytes, this is the combined length of the header and the data)

Identification ( 16-bit number which together with the source address uniquely identifies this packet - used during
reassembly of fragmented datagrams)

Flags (a sequence of three flags (one of the 4 bits is unused) used to control whether routers are allowed to fragment a
packet (i.e. the Don't Fragment, DF, flag), and to indicate the parts of a packet to the receiver)

Fragmentation Offset (a byte count from the start of the original sent packet, set by any router which performs IP
router fragmentation)

Time To Live (Number of hops /links which the packet may be routed over, decremented by most routers - used to
prevent accidental routing loops)

Protocol (Service Access Point (SAP) which indicates the type of transport packet being carried (e.g. 1 = ICMP; 2=
IGMP; 6 = TCP; 17= UDP).

Header Checksum (A 1's complement checksum inserted by the sender and updated whenever the packet header is
modified by a router - Used to detect processing errors introduced into the packet inside a router or bridge where the
packet is not protected by a link layer cyclic redundancy check. Packets with an invalid checksum are discarded by all
nodes in an IP network)

Source Address (the IP address of the original sender of the packet)

Destination Address (the IP address of the final destination of the packet)

Options (not normally used, but, when used, the IP header length will be greater than five 32-bit words to indicate the
size of the options field)
Example Packet Decodes

Three activities were recorded:


1.

Exchange of ICMP ECHO messages

2.

TCP connection set-up and clear-down

3.

Transmission of a single UDP packet

The arp cache of the client is also shown below:


client# arp -a
Net to Media Table
Device
IP Address
Mask
Flags Phys Addr
------ -------------------- --------------- ----- --------------hme0 gateway
255.255.255.255
00:e0:f7:26:3f:e9
hme0 client
255.255.255.255 SP 08:00:20:86:35:4b
hme0 224.0.0.0
240.0.0.0
SM 01:00:5e:00:00:00
This shows the physical (MAC) address of the default router (gateway) and the physical (MAC) address of the client itself.
Although the examples consider only unicast (communication between a pair of nodes), it may be seen that the IP multicast
address 224.0.0.0 has also been associated with a multicast Ethernet address - one that has the first bit set on transmission (i.e. the
least significant bit of the first byte).
1: ICMP ECHO Response
This is an ICMP ECHO response (reply) message generated in response to an earlier ICMP ECHO request message sent by the
ping program.
Hexadecimal Dump of the Packet
0:
16:
32:
48:
64:
80:
96:

0800 2086 354b 00e0


f726
3fe9 0800 4500
0054 aafb 4000
fc01 fa30
8b85 e902 8b85
d96e 0000
45da 1e60 0000 335e
3ab8 0000
42ac 0809
0a0b 0c0d 0e0f 1011
1213 1415
1617 1819
1a1b 1c1d 1e1f 2021
2223 2425
2627 2829
2a2b 2c2d 2e2f 3031
3233 3435
3637

Decode of the Packet


ETHER: ----- Ether Header ----ETHER:
ETHER: Packet 2 arrived at 17:37:12.02
ETHER: Packet size = 98 bytes
ETHER: Destination = 8:0:20:86:35:4b, Sun
ETHER: Source
= 0:e0:f7:26:3f:e9, CISCO Router
ETHER: Ethertype = 0800 (IP)
ETHER:
IP:
----- IP Header -----

.. .5K..&?...E.
.T.@..0......
.n..E..`..3^:...
B...............
.......... !"#$%
&'()*+,-./012345
67

`
IP:
IP:
IP:
IP:
IP:
IP:
IP:
IP:
IP:
IP:
IP:
IP:
IP:
IP:
IP:
IP:
IP:
ICMP:
ICMP:
ICMP:
ICMP:
ICMP:
ICMP:

Version = 4
Header length = 20 bytes
Type of service = 0x00 (normal)
Total length = 84 bytes
Identification = 43771
Flags = 0x4
.1.. .... = do not fragment
..0. .... = last fragment
Fragment offset = 0 bytes
Time to live = 252 seconds/hops
Protocol = 1 (ICMP)
Header checksum = fa30
Source address = 139.133.233.2, server.abdn.ac.uk
Destination address = 139.133.217.110, client
No options
----- ICMP Header ----Type = 0 (Echo reply)
Code = 0
Checksum = 45da
Payload Data

2: ICMP ECHO Response


This is an ICMP ECHO response (reply) message generated in response to an earlier ICMP ECHO request message sent by the
ping program. A small amount of data is included with the ICMP message.
Hexadecimal Dump of the Packet
0:
16:
32:
48:
64:
80:
96:

0800 2086 354b 00e0


f726
3fe9 0800 4500
0054 aafb 4000
fc01 fa30
8b85 e902 8b85
d96e 0000
45da 1e60 0000 335e
3ab8 0000
42ac 0809
0a0b 0c0d 0e0f 1011
1213 1415
1617 1819
1a1b 1c1d 1e1f 2021
2223 2425
2627 2829
2a2b 2c2d 2e2f 3031
3233 3435
3637

Decode of the Packet


ETHER: ----- Ether Header ----ETHER:
ETHER: Packet 2 arrived at 17:37:12.02
ETHER: Packet size =
98 bytes
ETHER: Destination =
8:0:20:86:35:4b, Sun
ETHER: Source
= 0:e0:f7:26:3f:e9, CISCO Router
ETHER: Ethertype = 0800 (IP)
ETHER:
IP: ----- IP Header ----IP:
IP:
Version = 4
IP: Header length = 20 bytes
IP: Type of service = 0x00 (normal)
IP: Total length = 84 bytes
IP:
Identification = 43771
IP:
Flags = 0x4
IP:
.1.. .... = do not fragment
IP:
..0. .... = last fragment
IP:
Fragment offset = 0 bytes
IP:
Time to live = 252 seconds/hops
IP:
Protocol = 1 (ICMP)
IP:
Header checksum = fa30

.. .5K..&?...E.
.T.@..0......
.n..E..`..3^:...
B...............
.......... !"#$%
&'()*+,-./012345
67

`
IP: Source address = 139.133.233.2, server.abdn.ac.uk IP: Destination address =
139.133.217.110, client IP: No options
IP:
ICMP: ----- ICMP Header ----ICMP:
ICMP: Type = 0 (Echo reply) ICMP:
Code = 0
ICMP: Checksum = 45da ICMP:
Payload Data

Conclusion: thus we have studied how to decode the header fields of IP datagram

`
PRACTICAL NO 6
Aim:- To Decode header fields of TCP header
Theory:A connection was made to the telnet (terminal) port of the remote computer. The computer accepts the
connection and produces a login prompt to the client. Instead of proceeding to login to the server, the client
then decides to terminate the connection. In the TCP header, the SYN bit is set to indicate it is part of the
synchronization exchange at the start of a TCP connection. This is the connection request.
Hexadecimal Dump of the Packet
0: 00e0 f726 3fe9 0800 2086 354b 0800 4500 ..&?... .5K..E.
16: 002c 08b8 4000 ff06 9997 8b85 d96e 8b85 .,..@........n..
32: e902 9005 0017 7214 f114 0000 0000 6002 ......r.......`.
48: 2238 a92c 0000 0204 05b4
"8.,......
67
Decode of the Packet
ETHER: ----- Ether Header ----ETHER:
ETHER: Packet 3 arrived at 17:37:23.94
ETHER: Packet size = 58 bytes
ETHER: Destination = 0:e0:f7:26:3f:e9, CISCO Router
ETHER: Source
= 8:0:20:86:35:4b, Sun
ETHER: Ethertype = 0800 (IP)
ETHER:
IP: ----- IP Header ----IP:
IP: Version = 4
IP: Header length = 20 bytes
IP: Type of service = 0x00 (normal)
IP: Total length = 44 bytes
IP: Identification = 2232
IP: Flags = 0x4
IP:
.1.. .... = do not fragment
IP:
..0. .... = last fragment
IP: Fragment offset = 0 bytes
IP: Time to live = 255 seconds/hops
IP: Protocol = 6 (TCP)
IP: Header checksum = 9997
IP: Source address = 139.133.217.110, client
IP: Destination address = 139.133.233.2, server.abdn.ac.uk
IP: No options
IP:
TCP: ----- TCP Header ----TCP:
TCP: Source port = 36869
TCP: Destination port = 23 (TELNET)
TCP: Sequence number = 1913975060
TCP: Acknowledgement number = 0
TCP: Data offset = 24 bytes
TCP: Flags = 0x02

`
TCP:
TCP:
TCP:
TCP:
TCP:
TCP:
TCP:
TCP:
TCP:
TCP:
TCP:
TCP:

..0. .... = No urgent pointer


...0 .... = No acknowledgement
.... 0... = No push
.... .0.. = No reset
.... ..1. = Syn
.... ...0 = No Fin
Window = 8760
Checksum = 0xa92c
Urgent pointer = 0
Options: (4 bytes)
- Maximum segment size = 1460 bytes

The packet header shown is the first packet of the sequence.


Conclusion: thus a Decoding of header fields for TCP packet is studied

`
PRACTICAL NO 7
Aim: To configure a DNS Server
Theory:Two of the most popular ways to configure the program Bind to perform DNS services is in the role of (1) ISP
or (2) Web Host. 1. In an ISP configuration the DNS server must resolve IP addresses for any URL the user
wishes to visit. 2. In a purely web hosting configuration, Bind will only resolve for the IP addresses of the
domains which are being hosted. This is the configuration which will be discussed and is often called an
"Authoritative-only Nameserver". When resolving IP addresses for a domain, Internic is expecting a
"Primary" and a "Secondary" DNS name server. (Sometimes called Master and Slave) Each DNS name server
requires the file /etc/named.conf and the files it points to. This is typically two separate computer systems
hosted on two different IP addresses. It is not necessary that the Linux servers be dedicated to DNS as they
may run a web server, mail server, etc.
Primary server (master):
File: named.conf
Red Hat / Fedora Core / CentOS: /etc/named.conf
Ubuntu / Debian: /etc/bind/named.conf Place local definitions in /etc/bind/named.conf.local
options {
version "Bind";
- Don't disclose real version to hackers
directory "/var/named";
allow-transfer { XXX.XXX.XXX.XXX; }; - IP address of secondary DNS
recursion no;
fetch-glue no;
- Bind 8 only! Not used by version 9
};
zone "your-domain.com"{ type
master;
file "named.your-domain.com";
notify yes;
};
zone "0.0.127.in-addr.arpa"{ type
master;
file "named.local"; allowupdate { none; };
};
Note the omission of zone "."
File: /var/named/named.your-domain.com
/var/named/named.your-domain.com
$TTL 604800
statement. Measured in
seconds. This value is 7 days.
your-domain.com.
IN
2000021600 ; serial
greater than
2147483647 for a 32 bit processor.
86400 ; refresh
changes in serial
number. (86400 sec = 24 hrs)

- Bind 9 (and some of the later versions of Bind 8) requires $TTL

SOA ns1.your-domain.com. hostmaster.your-domain.com. (


- Many people use year+month+day+integer as a system. Never

- How often secondary servers (in seconds) should check in for

`
7200 ; retry
- How long secondary server should wait for a retry if contact failed.
1209600 ; expire
- Secondary server to purge info after this length of time.
604800 ) ; default_ttl
- How long data is held in cache by remote servers.
IN A
XXX.XXX.XXX.XXX - Note that this is the default IP address of the
domain.
I put the web server IP address here so that domain.com points to the
same servers as
www.domain.com
;
; Name servers for the domain
;
IN NS
ns1.your-domain.com.
IN NS
ns2.your-domain.com.
;
; Mail server for domain
;
IN MX
5 mail
- Identify "mail" as the node handling mail for the domain.
Do NOT specify
an IP address!
;
; Nodes in domain
;
node1 IN A
XXX.XXX.XXX.XXX
- Note that this is the IP address of node1
ns1
IN A
XXX.XXX.XXX.XXX
- Optional: For hosting your own primary name
server. Note that
this is the IP address of ns1
ns2
IN A
XXX.XXX.XXX.XXX - Optional: For hosting your own secondary
name server. Note
that this is the IP address of ns2
mail
IN A
XXX.XXX.XXX.XXX
- Identify the IP address for node mail.
IN MX
5 XXX.XXX.XXX.XXX
- Identify the IP address for mail server named
"mail".
;
; Aliases to existing nodes in domain
;
www IN CNAME
node1
- Define the webserver "www" to be node1.
ftp IN CNAME
node1
- Define the ftp server to be node1.

MX records for 3rd party off-site mail servers: your-domain.com.


IN MX 10 mail1.offsitemail.com. your-domain.com. IN MX 20
mail2.offsitemail.com.
Secondary server (slave):
File: named.conf
/etc/named.conf
options {
version "Bind";
directory "/var/named";
allow-transfer { none; };
recursion no;
fetch-glue no;

- Don't disclose real version to hackers

- Bind 8 only! Not used by version 9

`
};
zone "your-domain.com"{ type
slave;
file "named.your-domain.com"; - Specify slaves/named.your-domain.com for RHEL4 chrooted bind
masters { XXX.XXX.XXX.XXX; }; - IP address of primary DNS
};
zone "0.0.127.in-addr.arpa"{ type
master;
file "named.local";
};

/var/named/slaves
Create log file and set ownership and permission for file not created by installation:
touch /var/log/bindlog
chown root.bind /var/log/bindlog
chmod 664 /var/log/bindlog
Error in /var/log/messages:
transfer of 'yolinux.com/IN' from XXX.XXX.XXX.XXX#53: failed while receiving responses: permission
denied
Named needs write permission on the directory containing the file. This condition often occurs for a new
"slave" or "secondary" name server where the zone files do not yet exist. The default
drwxr-x--- 4 root named 4096 Aug 25 2004 named
drwxrwx--- 2 named named 4096 Sep 17 20:37 slaves
Fix: In named.conf specify that the slaves to go to slaves directory /var/named/chroot/var/named/slaves
with the directive:
file "slaves/named.your-domain.com"; Bind
Defaults:
Uses port 53 if none is specified with the listen-on port statement.
Bind will use random ports above port 1024 for queries. For use with firewalls expecting all DNS traffic on
port 53, specify the following option statement in /etc/named.conf querysource address * port 53;
Logging is to /var/log/messages
After the configuration files have been edited, restart the name daemon.
/etc/rc.d/init.d/named restart
File: /var/named/named.your-domain.com This is created for you by Bind on the slave (secondary) server
when it replicates from Primary server.

Test DNS:
Must install packages:
Test the name server with the host command in interactive mode: host
node.domain-to-test.com your-nameserver-to-test.domain.com

`
The name server may also be specified by IP address. or
Test the name server with the nslookup command in interactive mode: nslookup
> server your-nameserver-to-test.domain.com
> node.domain-to-test.com
> exit
Test the MX record if appropriate:
nslookup -querytype=mx domain-to-test.com
OR
host -t mx domain-to-test.com
Test using the dig command:
dig @name-server domain-to-query
OR
dig @IP-address-of-name-server domain-to-query
Chrooted DNS configuration:
This security feature forces even an exploited version of bind to only operate within the "chrooted" jail
/var/named/chroot which contains the familiar directories:
/var/named/chroot/etc: Configuration files
/var/named/chroot/dev: devices used by bind: o
/dev/null
o /dev/random o
/dev/zero
(Real devices created with the mknod command.)
/var/named/chroot/var: Zone files and configuration information.
These directories are generated and configured by the Red Hat/Fedora RPM package "bind-chroot".
If building from source you will have to generate this configuration manually:
mkdir -p /var/named/chroot
mkdir /var/named/chroot/dev
mknod /var/named/chroot/dev/null c 1 3
mknod /var/named/chroot/dev/zero c 1 5
mknod /var/named/chroot/dev/random c 1 8
chmod 666 -R /var/named/chroot/dev
mkdir -p /var/named/chroot/etc
ln -s /var/named/chroot/etc/named.conf /etc/named.conf
mkdir -p /var/named/chroot/var/named
ln -s /var/named/chroot/var/named/named.XXXX /var/named/named.XXXX
ln -s /var/named/chroot/var/named/named.YYYY /var/named/named.YYYY
...
mkdir -p /var/named/chroot/var/named/slaves
mkdir -p /var/named/chroot/var/named/data
mkdir -p /var/named/chroot/var/run
mkdir -p /var/named/chroot/var/tmp

`
chown -R named:named /var/named/chroot
chown -R root:named /var/named/chroot/var/named Load
Balancing of servers using Bind: DNS Round-Robin
This will populate name servers around the world with different IP addresses for your web server www.yourdomain.com
www0 IN A XXX.XXX.XXX.1 www1 IN A
XXX.XXX.XXX.2
www2
IN
A
XXX.XXX.XXX.3
www3
IN
A
XXX.XXX.XXX.4
www4
IN
A
XXX.XXX.XXX.5
www5
IN
A
XXX.XXX.XXX.6
www IN CNAME www0.your-domain.com. IN CNAME
www1.your-domain.com. IN CNAME www2.yourdomain.com. IN CNAME www3.your-domain.com.
IN CNAME www4.your-domain.com. IN CNAME
www5.your-domain.com. IN CNAME www6.yourdomain.com.
Conclusion: thus a Configuring a DNS Server has been implemented.

`
Practical No 8
Aim: - Identify download and install open source tool related to TCP/IP.
Theory:VMware, Inc. is a U.S. software company that provides cloud and virtualization software and services, and
claims to be the first to commercially successfully virtualize the x86 architecture. Founded in 1998, VMware
is based in Palo Alto, California. In 2004 it was acquired by and became a subsidiary of EMC Corporation,
then on August 14, 2007, EMC sold 15% of the company in a New York Stock Exchange IPO. The company
trades under the symbol VMW.
VMware's desktop software runs on Microsoft Windows, Linux, and Mac OS X, while its enterprise software
hypervisors for servers, VMware ESX and VMware ESXi, are bare-metal hypervisors that run directly on
server hardware without requiring an additional underlying operating system

Products
Desktop software

VMware Workstation (first product launched by VMware in 1999). This software suite allows users
to run multiple instances of x86 or x86-64 -compatible operating systems on a single physical PC.

VMware Fusion provides similar functionality for users of the Intel Mac platform, along with full
compatibility with virtual machines created by other VMware products.

VMware Player is freeware for non-commercial use, without requiring a licence for VMware
Workstation or VMware Fusion; or for commercial use with permission. Player versions before 3.0.1
could not create virtual machines.

Server software
VMware has produced two virtualization products for servers:
1.

VMware vSpherehttp://en.wikipedia.org/wiki/VMware - cite_note-40 (also called "ESXi"), an


enterprise-level product, can deliver greater performance than the freeware VMware Server, due to
lower system overhead. VMware ESXi, as a "bare-metal" product, runs directly on the server
hardware, allowing virtual servers to also use hardware more or less directly. In addition, VMware
ESXi integrates into VMware vCenter, which offers extra services

2.

VMware Server (formerly called "GSX Server"; obsolete as of


2013)http://en.wikipedia.org/wiki/VMware - cite_note-41 wasalso provided as freeware for
non-commercial use, like VMware Player, and can also set up virtual machines. As a "hosted"
application, VMware Server runs within an existing Linux or Windows operating system

Installation Step:1.Install the VMware Workstation a Windows host computers.


Note: To install Workstation on a Windows 7 host computer, you must log on as administrator.
If you are installing from a CD, put your CD in your CD-ROM drive, it will begin automatically.
If you are installing from a downloaded file, browse to the directory where you saved the downloaded installer
file and run the installer. The file name is similar with this: VMware-workstation-full-7.1.3-324285.exe.
Ad

2Click Next to dismiss the Welcome dialog box.

3 Choose the set up type you prefer. If you dont know it very well, choose typical. Then click next.

4 Choose the directory in which to install VMware Workstation. To install it in a directory other than the
default, click Change and browse to your directory of choice. If the directory does not exist, the installer
creates it for you. Click Next. Caution: Do not install VMware Workstation on a network drive.

5 Select if you want to check for product updates on startup. Deselect the check box if you do not want to
check it.

6 Select for if you like to feedback to VMware. Deselect the check box if you do not want to feedback.
Click next.

7 Select the shortcuts that you want the installer to create. Choices include Desktop, Start menu, and
Quick Launch toolbar. Deselect any shortcuts you do not want the installer to create.

8 The installer has gathered the necessary information and is ready to begin installing the software.If
you want to change any settings or information you provided, now is the time to make those changes. Click
Back until you reach the dialog box containing the information you want to change. If you do not need to
make any changes, click Continue. The installer begins copying files to your computer.

9
Enter your serial number, your name(Optional), company name(Optional),then click Next. Note: If you
skip this step, you must enter your serial number later, before you can power on a virtual machine.

10
Restart your computer, allow VMware Workstation to complete the installation, then double-click the
VMware Workstation icon on your desktop.

11
Select the Yes, I accept the terms in the license agreement option, then click Next.

12
Start the New Virtual Machine Wizard.
Choose File > New > Virtual Machine to begin creating your virtual machine.

13
Recommend you choose typical, then click next.

14
Begin to install a guest operating system.Choose how you will install the guest operating system, then click
next.

15
Here is how to install a windows 7 as a guest operating system. Enter the windows product key, full name,
password(optional) and click next

16 Name the virtual machine and choose the location for it.Click Browse if you want to change the default
location.Click next.

17 Installing a guest operating system inside your VMware Workstation virtual machine is the same as
installing it on a physical computer.
18 Power on your virtual machine by clicking the Power On button
Conclusion:- thus we have install download and read the open ended tools for TCP IP successfully.

`
PRACTICAL NO 09
Aim: To Compile & Test TTCP
Theory:TTCP is a utility program for measuring network throughput, popular on Unix systems. TTCP can be used for
both Windows and *nix systems alike. Testing can be done from a Windows machine to a *nix machine as
long as they both have a TTCP application installed.
TTCP is also available on Cisco IOS routers as a hidden command and can be setup as either the sender or
receiver. TTCP is installed on two machines. One will be the sender, the other the receiver. The receiver is
started first and waits for a connection. Once the two connect the sending machine sends data to the receiver
and displays the overall throughput of the network they traverse. The amount of data sent and other options
are configurable through a simple command line interface. The output is generally in kB/s (kilobytes per
second) instead of kbit/s (kilobits per second). Executing RUNTCP as a Started Task No network interface
device is required to execute in loopback mode. Data is not written to or read from the channel. Outbound data
is copied into the input buffers by the Local Network Interface (LNI). You can establish connections only to
your own host when operating in software loopback mode.
1. Using SAMP member RUNTCP as a model, create a started task JCL procedure in a JCL procedure
library at your site.
2. Substitute appropriate values for the TRGINDX, SSN, SRC, SOUT, and CMND parameters.
3. Issue an MVS START command to start the RUNTCP started task.
4. From an MVS console, issue this MVS command:
S RUNTCP
Testing TCPaccess in Loopback Mode
The local Internet address for loopback is 127.0.0.1. Read the TCPaccess Customization Guide for additional
information on testing TCPaccess in loopback mode.
1. Test the VTAM/TELNET interface by entering this VTAM LOGON command: LOGON
APPLID(ACCES) DATA(127.0.0.1)
Successful loopback returns the Server TELNET screen.
You might need to use the Assembler syntax for LOGON. Specify:
LOGON APPLID=ACCES, DATA=127.0.0.1
2. Enter bye to exit.
3. Test FTP and TELNET TSO commands by logging on to TSO and entering these commands:
TELNET - Returns TSO TELNET Screen. Enter bye to exit.
FTP - Returns FTP prompt. Enter end to exit.
FTP2 - Returns FTP2 login prompt. Enter bye to exit.
To use the FTP, FTP2, and TELNET commands, the LINK library must be available to your TSO STEPLIB
concatenation or in the MVS link list.
If you plan to include FTP data transfer in the IVP, you must issue a SITE UNIT(disk) where disk is a valid
DASD unit name at your installation.
Stopping the RUNTCP Started Task
Enter this MVS command from an MVS console to terminate the started task: P RUNTCP

`
If TCP access displays a WTOR prompt, enter a Y to continue termination. Verifying the
API Installation
This section describes the Installation Verification Procedures (IVPs) you run to ensure the TCP access API
installed correctly.
Compiling and Testing Sample C Socket Applications
If you have the IBM C/370 or SAS SAS/C C compiler, use the CLGSASC or CLGIBMC job in the SAMP
data set to compile, link, and execute one of the C Socket sample applications found in the SAMP data set -SHELLO, SWHOIS, or FINGERC.
The TCP access User's Guide describes how to run ACSHELLO or FINGER after compiling and linking.
Compiling and Testing Sample C Basic Applications
If you have the IBM C/370 or SAS SAS/C C compiler, use the CLGSASC or CLGIBMC job in the SAMP
data set to compile, link, and execute one of the C basic sample applications found in the SAMP data set BHELLO or BWHOIS.
The TCP access User's Guide describes how to run ACSHELLO or FINGER after creating it.
Testing TTCP TSO Command Processor
Execute the TTCP TSO command processor to exercise the TCPaccess API components. The TCPaccess
User's Guide describes how to run TTCP.
1. Execute this TTCP command in transmit mode to send data to the TCPaccess TCP discard port:
TTCP TRANS PORT(9) HOST(127.0.0.1)
This command sends 1024 buffers of length 1024 to the discard port. You receive a message on successful
completion.
2. Execute TTCP in two (2) TSO user address spaces so that one TTCP transmits data to the other receiving
TTCP.
In one TSO user address space, enter this command:
TTCP RECV PORT(2000)
In the other TSO user address space, enter this command:
TTCP TRANS PORT(2000) HOST(127.0.0.1)
TTCP sends 1024 buffers of length 1024 from the TTCP in transmit mode to the TTCP in receive mode. You
receive messages from each TTCP on successful completion. The TTCP in receive mode should be stopped
via TSO attention. Running the OpenEdition IVPs OpenEdition must be operational and you must have
TCPaccess defined in the BPXPRMxx PARMLIB member before you can run the IVPs. Refer to the
TCPaccess Planning Guide for the required statements. The OMVS shell does not have to be set up to run the
IVPs as batch jobs. Preparing to Run the IVPs Before you begin to run the OpenEdition IVPs, you might need
to make some changes. Review this list to identify any changes required. Is TCPaccess defined to OpenEdition
with an address family other than the AF_INET default of 2? If so, complete these steps:
For batch execution, add a GPARM parameter indicating the number being used. The GPARM parameter
is required for both MAKESERV and MAKECLNT.
GPARM=11
For interactive execution, indicate the number in t he program call.
ivpserv 11 & and ivpclnt 11
Do you want to improve performance of the IVP in loopback mode?
You can improve performance in loopback mode d by increasing the LOOPMTU value in the ACPCFGxx
HOST statement. The default is 8192.
Are you going to run one or both programs on UNIX? If so, you need to

`
Change the #define statement for ERRNO2 to map to 0
Comment out the #include for manifest.h
Are you running the IVP in other than loopback mode?
If running in other than loopback mode, modify the SERVADDR address in IVPCLNT to point to the IP
address where the server will be executing.
Running the IVPs in Batch Mode
1. Modify the MAKESERV JCL stream to conform to any standards you in place at your installation. Make
sure trgindx is replaced with the TCPaccess high-level qualifier being used. Submit the job.
2. When the MAKESERV job is in the GO step, modify and submit the MAKECLNT job.
3. The MAKECLNT job ends automatically. The following message in the SYSPRINT output from the GO
step indicates successful completion:
4. IVPCLNT: total bytes read = 52428800
5. MVS cancels the MAKESERV job.
Running the OpenEdition IVPs in the OMVS Shell
1. Use the TSO/E command, oput, to copy IVPSERV, IVPCLNT, and IVPMAKE to an appropriate HFS
directory under the names
a ivpserv.c
ivpclnt.c
Makefile.
Use the UNIX chmod cmmand to make any necessary permission changes.
2. To compile and link both programs, enter make
3. To start the server in the background, enter ivpserv &
4. Write down the process ID that is returned.
5. The program will return the message
IVPSERV: listening on port 2300 Enter
this command:
ivpclnt
6. Several messages will appear, indicating the data transfer is occurring, including this message
IVPCLNT: total bytes read = 52428800
7. When the command prompt reappears the client program has terminated.
8. Issue the kill command to terminate the server.
Conclusion: thus we Study how to compile & Test TTCP.

You might also like