How Internet works

Command-Line Interface for Intranets and the Internet

1. netstat [-a] [-b] [-e] [-f] [-n] [-o] [-p proto] [-r] [-s] [-t] [interval]

Description:

Displays protocol statistics and current TCP/IP network connections.

-a Displays all connections and listening ports.

-b Displays the executable involved in creating each connection

listening port. In some cases well-known executable host

multiple independent components, and in these cases the

sequence of components involved in creating the connection

or listening port is displayed. In this case the executable

name is in [] at the bottom, on top is the component it ca

and so forth until TCP/IP was reached. Note that this option

can be time-consuming and will fail unless you have suffices

permissions.

-e Displays Ethernet statistics. This may be combined with the

option.

-f Displays Fully Qualified Domain Names (FQDN) for foreign

addresses.

-n Displays addresses and port numbers in numerical form.

-o Displays the owning process ID associated with each connection

-p Shows connections for the protocol specified by proto; pro

may be any of: TCP, UDP, TCPv6, or UDPv6. If used with the

option to display per-protocol statistics, proto may be an

IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPv6.

-r Displays the routing table.

-s Displays per-protocol statistics. By default, statistics

shown for IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDP

the -p option may be used to specify a subset of the default

-t Displays the current connection offload state.

redisplay selected statistics, pausing interval seconds

between each display. Press CTRL+C to stop re-displaying

statistics. If omitted, netstat will print the current

configuration information once.

2. ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]

[-r count] [-s count] [[-j host-list] | [-k host-list]]

[-w timeout] [-R] [-S srcaddr] [-4] [-6] target_name

Options:

-t Ping the specified host until stopped.

To see statistics and continue - type Control-Break;

To stop - type Control-C.

-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 (IPv4-only).

-i TTL Time To Live.

-v TOS Type Of Service (IPv4-only).

-r count Record route for count hops (IPv4-only).

-s count Timestamp for count hops (IPv4-only).

-j host-lis Loose source route along host-list (IPv4-only).

-k host-list Strict source route along host-list (IPv4-only).

-w timeout Timeout in milliseconds to wait for each reply.

-R Use routing header to test reverse route also (IPv6-onl

-S srcaddr Source address to use (IPv6-only).

-4 Force using IPv4.

-6 Force using IPv6.

[Note: There's one special IP number everyone should know about:

127.0.0.1 - local-host (or loop-back).

This is used to connect ( through a browser, for example) to a Web server

on your own computer. (127 being reserved for this purpose.) You can use

this IP number at all times. It doesn't matter if you're connected to the

Internet or not. It's also called the loop-back address because you can ping

it and get returns even when you're offline (not connected to any network).

If you don't get any valid replies, then there's a problem with the computer's

Network settings. Here's a typical response to the 'ping' command]

3. tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout]

[-R] [-S srcaddr] [-4] [-6] target_name

Options:

-d Do not resolve addresses to hostnames.

-h maximum_hops Maximum number of hops to search for target.

-j host-list Loose source route along host-list (IPv4-only).

-w timeout Wait timeout milliseconds for each reply.

-R Trace round-trip path (IPv6-only).

-S srcaddr Source address to use (IPv6-only).

-4 Force using IPv4.

-6 Force using IPv6.

[Note: Here's an example which traces the route from some ISP in Los Angeles to

the main server at UCLA in California ( note how two computers relatively

close to each other may be routed way round about! ]

4. nbtstat [ [-a RemoteName] [-A IP address] [-c] [-n]

[-r] [-R] [-RR] [-s] [-S] [interval] ]

Displays protocol statistics and current TCP/IP connections using NBT

(NetBIOS over TCP/IP).

-a (adapter status) Lists the remote machine's name table given its name

-A (Adapter status) Lists the remote machine's name table given its IP address.

-c (cache) Lists NBT's cache of remote [machine] names and their

IP addresses

-n (names) Lists local NetBIOS names.

-r (resolved) Lists names resolved by broadcast and via WINS

-R (Reload) Purges and reloads the remote cache name table

-S (Sessions) Lists sessions table with the destination IP addresses

-s (sessions) Lists sessions table converting destination IP

addresses to computer NETBIOS names.

-RR (ReleaseRefresh) Sends Name Release packets to WINS and then,

starts Refresh

RemoteName Remote host machine name.

IP address Dotted decimal representation of the IP address.

Interval Redisplays selected statistics, pausing interval seconds

between each display. Press Ctrl+C to stop redisplaying

statistics.

5. route [-f] [-p] [-4|-6] command [destination]

[MASK netmask] [gateway] [METRIC metric] [IF interface]

Description:

Manipulates network routing tables.

-f Clears the routing tables of all gateway entries. If this is

used in conjunction with one of the commands, the tables are

cleared prior to running the command.

-p When used with the ADD command, makes a route persistent across

boots of the system. By default, routes are not preserved

when the system is restarted. Ignored for all other commands,

which always affect the appropriate persistent routes. This

option is not supported in Windows 95.

-4 Force using IPv4.

-6 Force using IPv6.

command One of these:

PRINT Prints a route

ADD Adds a route

DELETE Deletes a route

CHANGE Modifies an existing route

destination Specifies the host.

MASK Specifies that the next parameter is the 'netmask' value.

netmask Specifies a subnet mask value for this route entry.

If not specified, it defaults to 255.255.255.255.

gateway Specifies gateway.

interface the interface number for the specified route.

METRIC specifies the metric, ie. cost for the destination.

All symbolic names used for destination are looked up in the network database

file NETWORKS. The symbolic names for gateway are looked up in the host name

database file HOSTS.

If the command is PRINT or DELETE. Destination or gateway can be a wildcard,

(wildcard is specified as a star '*'), or the gateway argument may be omitted.

If Dest contains a * or ?, it is treated as a shell pattern, and only

matching destination routes are printed. The '*' matches any string,

and '?' matches any one char. Examples: 157.*.1, 157.*, 127.*, *224*.

6. arp -s inet_addr eth_addr [if_addr]

ARP -d inet_addr [if_addr]

ARP -a [inet_addr] [-N if_addr] [-v]

Description:

Displays and modifies the IP-to-Physical address translation tables used by

address resolution protocol (ARP).

-a Displays current ARP entries by interrogating the current

protocol data. If inet_addr is specified, the IP and Physical

addresses for only the specified computer are displayed. If

more than one network interface uses ARP, entries for each ARP

table are displayed.

-g Same as -a.

-v Displays current ARP entries in verbose mode. All invalid

entries and entries on the loop-back interface will be shown.

inet_addr Specifies an internet address.

-N if_addr Displays the ARP entries for the network interface specified

by if_addr.

-d Deletes the host specified by inet_addr. inet_addr may be

wildcarded with * to delete all hosts.

-s Adds the host and associates the Internet address inet_addr

with the Physical address eth_addr. The Physical address is

given as 6 hexadecimal bytes separated by hyphens. The entry

is permanent.

eth_addr Specifies a physical address.

if_addr If present, this specifies the Internet address of the

interface whose address translation table should be modified.

If not present, the first applicable interface will be used.

Example:

> arp -s 157.55.85.212 00-aa-00-62-c6-09 .... Adds a static entry.

> arp -a .... Displays the arp table.