Ritesh’s Technical Blog

Archive for the ‘Networking’ Category

How TO convert an IP Address to a IP Number?

IP address (IPV4) is divided into 4 sub-blocks. Each sub-block has a different weight number.

To calculate IP Number the formula is given below

IP Number = 16777216*a + 65536*b + 256*c + d

where
IP Address = a.b.c.d


For example, if IP address is “127.4.5.13“, then its IP Number would be


IP Number = 16777216*127 + 65536*4 + 256*5 + 13
=
2130706432 + 262144 + 1280 + 13
=
2130969869

Advertisements

Windows Sockets

Windows Sockets is the mechanism for communication between applications running on

the same computer or those running on different computers which are connected to a

LAN or WAN. Windows Sockets defines a set of standard API’s that an application uses

to communicate with one or more other applications, usually across a network. Windows

Sockets supports initiating an outbound connection, accepting inbound connections,

sending and receiving data on those connections, and terminating a session.

Windows socket is a port of the Berkeley Sockets API that existed on Unix, with

extensions for integration into the Win16 and Win32 application environments. Windows

Sockets also includes support for other transports such as IPX/SPX and NetBEUI.

Windows Sockets supports point-to-point connection-oriented communications and

point-to-point or multipoint connectionless communications when using TCP/IP.

Windows Socket communication channels are represented by data structures called

sockets. A socket is identified by an address and a port,

for example;

131.107.2.200:80

The Telnet Command

Technically, telnet is a protocol. This means it is a language that computer use to

communicate with one another in a particular way. From your point of view, Telnet is a

program that lets you login to a site on the Internet through your connection to Teleport.

It is a terminal emulation program, meaning that when you connect to the remote site,

your computer functions as a terminal for that computer.

Once the connection is made, you can use your computer to access information, run

programs, edit files, and otherwise use whatever resources are available on the other

computer. What is available depends on the computer you connect to. Most of the times,

if you type ‘?’ or ‘help’, you would normally receive some type of information, menu

options, etc.

Note: telnet connections give you command-line access only. In other

words, instead of being able to use buttons and menus as you do with a

graphical interface, you have to type commands. However, telnet allows

you to use certain utilities and resources you cannot access with your

other Internet applications.

Usage: telnet hostname or IP address port(optional)

The Ping Command

The ping (Packet Internet Groper) is used to send ICMP (Internet Control Message

Protocol) packets from one host to another. Ping transmits packets using the ICMP

ECHO_REQUEST command and expects an ICMP ECHO_REPLY. Ping is the primary TCP/IP command used to troubleshoot connectivity, reachability, and name resolution.

Syntax

ping [-t] [-a] [-n Count] [-l Size] [-f] [-i TTL] [-v TOS] [-r Count] [-s Count] [{-j HostList | -k HostList}] [-w Timeout] [TargetName]

Switches:

t Ping the specifed host until interrupted.

a Resolve addresses to hostnames.

n count Number of echo requests to send.

l size Send buffer size.

f Set Don’t Fragment flag in packet.

i TTL Time To Live.

v TOS Type Of Service.

r count Record route for count hops.

s count Timestamp for count hops.

j host-list Loose source route along host-list.

k host-list Strict source route along host-list.

w timeout Timeout in milliseconds to wait for each reply.

Examples

The following example shows ping command output:

C:\>pimg example.microsoft.com

Pinging example.microsoft.com [192.168.239.132] with 32 bytes of data:

Reply from 192.168.239.132: bytes=32 time=101ms TTL=124

Reply from 192.168.239.132: bytes=32 time=100ms TTL=124

Reply from 192.168.239.132: bytes=32 time=120ms TTL=124

Reply from 192.168.239.132: bytes=32 time=120ms TTL=124

To pingthe destination 10.0.99.221 and resolve 10.0.99.221 to its host name, type:

ping -a 10.0.99.221

To ping the destination 10.0.99.221 with 10 Echo Request messages, each of which has a Data field of 1000 bytes, type:

ping-n 10 -l 1000 10.0.99.221

To ping the destination 10.0.99.221 and record the route for 4 hops, type:

ping-r 4 10.0.99.221

To ping the destination 10.0.99.221 and specify the loose source route of 10.12.0.1-10.29.3.1-10.1.44.1, type:

ping -j 10.12.0.1 10.29.3.1 10.1.44.1 10.0.99.221

The Netstat Command

Displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 statistics (for the IP, ICMP, TCP, and UDP protocols), and IPv6 statistics (for the IPv6, ICMPv6, TCP over IPv6, and UDP over IPv6 protocols). Used without parameters, netstat displays active TCP connections.

Syntax

netstat [-a] [-e] [-n] [-o] [-p Protocol] [-r] [-s] [Interval]

Switches:

-A Shows the addresses of any associated protocol control blocks.

-a Will show the status of all sockets. Sockets associated with network

server processes are normally not shown.

-I Shows the state of the network interfaces.

-m Prints the network memory usage.

n Causes netstat to show actual addresses as opposed to hostnames or

network names.

r Prints the routing table.

s Tells netstat to show the per protocol statistics.

t Replaces the queue length information with timer information.

Examples

To display both the Ethernet statistics and the statistics for all protocols, type the following command:

netstat -e -s

To display the statistics for only the TCP and UDP protocols, type the following command:

netstat -s -p tcp udp

To display active TCP connections and the process IDs every 5 seconds, type the following command:

nbtstat -o 5

To display active TCP connections and the process IDs using numerical form, type the following command:

nbtstat -n -o

The Finger Command

By default, finger will list the login name, full name, terminal name, and write status

(shown as a “*” before the terminal name if write permission is denied), idle time, login

time, office location, and phone number (if known) for each current user connected to the

network.

Syntax

finger [-l] [User] [@host] []

Switches:

b Brief output format

f Supresses the printing of the header line.

i Provides a quick list of users with idle time.

l Forces long output format.

p Supresses printing of the .plan file (if present)

q Provides a quick list of users.

s Forces short output form.

w Forces narrow output form.

Examples

To display information for user1 on the computer users.microsoft.com, type the following command:

finger user1@users.microsoft.com

To display information for all users on the computer users.microsoft.com, type the following command:

finger @users.microsoft.com

Some TCP/UDP Port numbers

Service Port Comments

TCP Ports

echo 7/tcp

discard 9/tcp sink null

systat 11/tcp users

daytime 13/tcp

netstat 15/tcp

qotd 17/tcp quote

chargen 19/tcp ttytst source

ftp-data 20/tcp

ftp 21/tcp

telnet 23/tcp

smtp 25/tcp mail

time 37/tcp timserver

name 42/tcp nameserver

whois 43/tcp nicname

nameserver 53/tcp domain

apts 57/tcp any private terminal service

apfs 59/tcp any private file service

rje 77/tcp netrjs

finger 79/tcp

http 80/tcp

link 87/tcp ttylink

supdup 95/tcp

newacct 100/tcp [unauthorized use]

hostnames 101/tcp hostname

iso-tsap 102/tcp tsap

x400 103/tcp

x400-snd 104/tcp

csnet-ns 105/tcp CSNET Name Service

pop-2 109/tcp Post Office Protocol version 2

pop-3 110/tcp Post Office Protocol version 3

sunrpc 111/tcp

auth 113/tcp authentication

sftp 115/tcp

uucp-path 117/tcp

nntp 119/tcp usenet readnews untp

ntp 123/tcp network time protocol

statsrv 133/tcp

profile 136/tcp

NeWS 144/tcp news

print-srv 170/tcp

https 443/tcp Secure HTTP

exec 512/tcp remote process execution;

authentication performed using

passwords and UNIX loppgin names

login 513/tcp remote login a la telnet;

automatic authentication performed

based on priviledged port numbers

and distributed data bases which

identify “authentication domains”

cmd 514/tcp like exec, but automatic

authentication is performed as for

login server

printer 515/tcp spooler

efs 520/tcp extended file name server

tempo 526/tcp newdate

courier 530/tcp rpc

conference 531/tcp chat

netnews 532/tcp readnews

uucp 540/tcp uucpd

klogin 5 43/tcp

kshell 5 44/tcp krcmd

dsf 555/tcp

remotefs 556/tcp rfs server

chshell 562/tcp chcmd

meter 570/tcp demon

pcserver 600/tcp Sun IPC server

nqs 607/tcp nqs

mdqs 666/tcp

rfile 750/tcp

pump 751/tcp

qrh 752/tcp

rrh 753/tcp

tell 754/tcp send

nlogin 758/tcp

con 759/tcp

ns 760/tcp

rxe 761/tcp

quotad 762/tcp

cycleserv 763/tcp

omserv 764/tcp

webster 765/tcp

phonebook 767/tcp phone

vid 769/tcp

rtip 771/tcp

cycleserv2 772/tcp

submit 773/tcp

rpasswd 774/tcp

entomb 775/tcp

wpages 776/tcp

wpgs 780/tcp

mdbs 800/tcp

device 801/tcp

maitrd 997/tcp

busboy 998/tcp

garcon 999/tcp

blackjack 1025/tcp network blackjack

bbn-mmc 1347/tcp multi media conferencing

bbn-mmx 1348/tcp multi media conferencing

orasrv 1525/tcp oracle

ingreslock 1524/tcp

issd 1600/tcp

nkd 1650/tcp

dc 2001/tcp

mailbox 2004/tcp

berknet 2005/tcp

invokator 2006/tcp

dectalk 2007/tcp

conf 2008/tcp

news 2009/tcp

search 2010/tcp

raid-cc 2011/tcp raid

ttyinfo 2012/tcp

raid-am 2013/tcp

troff 2014/tcp

cypress 2015/tcp

cypress-stat 2017/tcp

terminaldb 2018/tcp

whosockami 2019/tcp

servexec 2021/tcp

down 2022/tcp

ellpack 2025/tcp

shadowserver 2027/tcp

submitserver 2028/tcp

device2 2030/tcp

blackboard 2032/tcp

glogger 2033/tcp

scoremgr 2034/tcp

imsldoc 2035/tcp

objectmanager 2038/tcp

lam 2040/tcp

interbase 2041/tcp

isis 2042/tcp

rimsl 2044/tcp

dls 2047/tcp

dls-monitor 2048/tcp

shilp 2049/tcp

NSWS 3049/tcp

rfa 4672/tcp remote file access server

complexmain 5000/tcp

complexlink 5001/tcp

padl2sim 5236/tcp

man 9535/tcp

UDP Ports

echo 7/udp

discard 9/udp sink null

systat 11/udp users

daytime 13/udp

netstat 15/udp

qotd 17/udp quote

chargen 1 9/udp ttytst source

time 37/udp timserver

rlp 39/udp resource

name 42/udp nameserver

whois 43/udp nicname

nameserver 53/udp domain

bootps 67/udp bootp

bootpc 68/udp

tftp 69/udp

sunrpc 111/udp

erpc 121/udp

ntp 123/udp

statsrv 133/udp

profile 136/udp

snmp 161/udp

snmp-trap 162/udp

at-rtmp 201/udp

at-nbp 202/udp

at-3 203/udp

at-echo 204/udp

at-5 205/udp

at-zis 206/udp

at-7 207/udp

at-8 208/udp

biff 512/udp used by mail system to notify users

of new mail received; currently

receives messages only from

processes on the same machine

who 513/udp maintains data bases showing who’s

logged in to machines on a local

net and the load average of the

machine

syslog 514/udp

talk 517/udp like tenex link, but across

machine – unfortunately, doesn’t

use link protocol (this is actually

just a rendezvous port from which a

tcp connection is established)

ntalk 518/udp

utime 519/udp unixtime

router 520/udp local routing process (on site);

uses variant of Xerox NS routing

information protocol

timed 525/udp timeserver

netwall 533/udp for emergency broadcasts

new-rwho 550/udp new-who

rmonitor 560/udp rmonitord

monitor 561/udp

meter 571/udp udemon

elcsd 704/udp errlog copy/server daemon

loadav 750/udp

vid 769/udp

cadlock 770/udp

notify 773/udp

acmaint_dbd 774/udp

acmaint_trnsd 775/udp

wpages 776/udp

puparp 998/udp

applix 999/udp Applix ac

puprouter 999/udp

cadlock 1000/udp

hermes 1248/udp

wizard 2001/udp curry

globe 2002/udp

emce 2004/udp CCWS mm conf

oracle 2005/udp

raid-cc 2006/udp raid

raid-am 2007/udp

terminaldb 2008/udp

whosockami 2009/udp

pipe_server 2010/udp

servserv 2011/udp

raid-ac 2012/udp

raid-cd 2013/udp

raid-sf 2014/udp

raid-cs 2015/udp

bootserver 2016/udp

bootclient 2017/udp

rellpack 2018/udp

about 2019/udp

xinupagesrver 2020/udp

xinuexpnsion1 2021/udp

xinuexpnsion2 2022/udp

xinuexpnsion3 2023/udp

xinuexpnsion4 2024/udp

xribs 2025/udp

scrabble 2026/udp

isis 2042/udp

isis-bcast 2043/udp

rimsl 2044/udp

cdfunc 2045/udp

sdfunc 2046/udp

dls 2047/udp

shilp 2049/udp

rmontor_scure              5145/udp

xdsxdm 6558/udp

isode-dua 17007/udp


Archives

Blog Stats

  • 55,046 hits