Professional Documents
Culture Documents
Network Programming
By
Dr.LOGANATHAN V & Team
Organised By
Network Essentials
What is a Network
Why Network
How Network
Network Essentials
Types of Network
Centralised
Peer to peer ( WorkGroup )
Domain (client-Server based)
Topologies
Media
Coaxial cable
UTP & STP cable
Fibre optic cable
Networking Devices
MODEM
HUB
REPEATER
BRIDGE
NIC
CSU/DSU
ROUTER
SWITCH
Protocols
Routable & Non Routable
Packet Encapsulation
The data is sent down the protocol stack
Each layer adds to the data by prepending headers
4Bytes
TCP/IP Model
Network Interface Layer:The Network Interface Layer contains the protocols that enable
the TCP/IP to communicate with physical network.
TCP/IP System
Network Interface Layer
Physical Network
ETHERNET
IP
Packaging
Addressing
Routing
IP Addressing
Physical Address:-
IP Addressing
00-43-95-e0-5d-c9
00-43-95-e0-5d-c9
00-43-95-e0-5d-c9
00-43-95-e0-5d-c9
IP Addressing
Ethernet Adapter:Ethernet adapter card uses 48 bit MAC address for communication in a
network.
MAC address
Vendor ID
Product ID
MAC Address
Vendor ID is a unique ID assigned for that particular vendor.
Product ID is a serial number of that product produced by that
vendor.
MAC Address
00-40-95
Vendor ID
e0-5d-c7
Device ID
Host id
Class C
Class D
Class E
Purpose
Class A, B, C
Commercial
Class D
Multicasting
Class E
Experimental
IP Address
W.X.Y.Z
X.Y.Z
W.X.Y.Z
W.X
Y.Z
W.X.Y.Z
W.X.Y
Network ID
Host ID
Domain Configuration
Class A
Class B
Class C
Class A
1-126.X.Y.Z
Class B
128-191.X.Y.Z
Class C
192-223.X.Y.Z
127.x.y.z
No of
Networks
Class A
126
Class B
16,384
65,534
Class C
2,097,152
254
No of Hosts/Network
16,777,214
Beginning
Range
Ending Range
Class A
1.0.0.1
126.255.255.254
Class B
128.0.0.1
191.255.255.254
Class C
192.0.0.1
223.255.255.254
Subnet Mask
What is a Subnet Mask?
Assume a Network with two hosts
Host 1
Host 2
The above hosts use the subnet mask to identify which part of the IP
and which is host ID.
Whereas TCP/IP protocol uses the subnet mask to determine
destination host address is located on local subnet or remote subnet.
Subnet Mask
The IP (Class B)
171.100.250.72
Net ID
Host ID
255.255.0.0
Subnet Mask
Table Showing various subnet mask for various classes
Class
IP
Net ID
Host ID
Subnet Mask
Class A
W.X.Y.Z
X.Y.Z
255.0.0.0
Class B W.X.Y.Z
W.X
Y.Z
255.255.0.0
Class C W.X.Y.Z
W.X.Y
255.255.255.0
Subnet Mask
To find sub-Network address in an IP
Logical AND
IP Address
= sub-Net ID
Subnet Mask
Subnet Mask
IP Address
171.100.250.72
10101011.01100100.11111010.01001000
11111111.11111111.00000000.00000000
Net ID
171.100.0.0
10101011.01100100.00000000.00000000
Host ID
250.72
00000000.00000000
Subneting
Using few bits of Host id to address subnet
Routing
Routing
Static routing
Dynamic Routing
IP Datagram
Vers
16
Len
TOS
24
31
Total Length
Identification
TTL
19
Flags
Protocol
Fragment Offset
Header Checksum
Padding
Data...
Field
Vers
Len
TOS
T. Length
Ident.
Flags
Frag Off
Purpose
IP version number
Length of IP header (4 octet units)
Type of Service
Length of entire datagram (octets)
IP datagram ID (for frag/reassembly)
Dont/More fragments
Fragment Offset
Field
TTL
Protocol
Purpose
Time To Live - Max # of hops
Higher level protocol (1=ICMP,
6=TCP, 17=UDP)
Checksum Checksum for the IP header
Source IA Originators Internet Address
Dest. IA
Final Destination Internet Address
Options
Source route, time stamp, etc.
Data...
Higher level protocol data
ARP/RARP Header
TCP
UDP
User Datagram Protocol (UDP)
One-to-one or one-to-many,connectionless and unreliable protocol
Used for the transmission of small amount of data
Accuracy is not of prime concern
The overhead of establishing a TCP connection is not warranted
TCP Segment
10
16
Source Port
19
24
31
Destination Port
Sequence Number
Acknowledgment Number
Len
Reserved
Flags
Window
Checksum
Urgent Pointer
Options...
Padding
Data...
Field
Source Port
Destination Port
Sequence Number
Acknowledgment #
Len
Flags
Window
Checksum
Urgent Pointer
Options
Purpose
Identifies originating application
Identifies destination application
Sequence number of first octet in the segment
Sequence number of the next expected octet (if ACK flag set)
Length of TCP header in 4 octet units
TCP flags: SYN, FIN, RST, PSH, ACK, URG
Number of octets from ACK that sender will accept
Checksum of IP pseudo-header + TCP header + data
Pointer to end of urgent data
Special TCP options such as MSS and Window Scale
UDP datagram
0
16
31
Source Port
Destination Port
Length
Checksum
Application data
Field
Source Port
Destination Port
Length
Checksum
Purpose
16-bit port number identifying originating application
16-bit port number identifying destination application
Length of UDP datagram (UDP header + data)
Checksum of IP pseudo header, UDP header, and data
TELNET
FTP
HTTP
DHCP
DNS
SMTP
SNMP
LPD
TCP/IP COMMANDS
PING
FTP
ARP
IPCONFIG
NSLOOKUP
ROUTE
TRACERT
Berkley Sockets
Sockets
Sockets
Client-Server Communication
Socket Procedures
Socket()
Close()
Bind()
Listen()
Connect()
Accept()
THANK YOU
TCP Header
Source
portport
address
Source
address
Sequence Number
Acknowledgement Number
H Len
reserved
Checksum
CONTROL
Window Size
Urgent pointer
IP Header
Version IHL
TOS
Identification
TTL
Protocol
Total Length
Flags
Fragment Offset
Header Checksum
Source IP Address
Destination IP Address
Options and Padding