Download Introduction - University of Virginia

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Higher Layers - for Lab 1
• IP and TCP Headers
• Subnetting
• ifconfig and netstat commands
© Jörg Liebeherr (modified by M. Veeraraghavan)
1
IP Datagram Format
• 20 bytes  Header Size  24 * 32 bit-words = 60 bytes
• 20 bytes  Total Length  216 bytes = 65536 bytes
>= five 32-bit words
version
(4 bits)
header
length
Type of Service/TOS
(8 bits)
Identification (16 bits)
TTL Time-to-Live
(8 bits)
Total Length (in bytes)
(16 bits)
flags
(3 bits)
Protocol
(8 bits)
Fragment Offset (13 bits)
Header Checksum (16 bits)
Source IP address (32 bits)
Destination IP address (32 bits)
Options (if any, <40 bytes)
DATA
0
31
32-bit word
© Jörg Liebeherr (modified by M. Veeraraghavan)
2
TCP Header Format
• TCP packets have a 20 byte header + a data field of  0 bytes
IP header TCP header
20 bytes
TCP data
20 bytes
0
15 16
Source Port Number
31
Destination Port Number
Sequence number (32 bits)
header
length
0
Flags
TCP checksum
20 bytes
Acknowledgement number (32 bits)
window size
urgent pointer
Options (if any)
DATA
© Jörg Liebeherr (modified by M. Veeraraghavan)
3
Internet Address Classes
• IP distinguishes 5 classes of addresses.
Class A
Class B
Class C
Class D
0
network id
host
7 bits
24 bits
1 0
network id
host
14 bits
16 bits
1 1 0
1 1 1 0
network id
host
21 bits
8 bits
multicast group id
28 bits
Class E
1 1 1 1 0
(reserved for future use)
27 bits
© Jörg Liebeherr (modified by M. Veeraraghavan)
4
Subnet Masks
• Routers and hosts use a subnet mask to separate the
subnetwork id from the host id.*
Class B
1 0
network id
host
14 bits
with
subnetting
1 0
16 bits
network id
14 bits
Subnet
mask
(255.255.255.0)
*
subnet id
host
8 bits
8 bits
111111111111111111111111
00000000
24 bits
8 bits
There are different ways of subnetting. Subnetting with mask 255.255.255.00 is
most common.
© Jörg Liebeherr (modified by M. Veeraraghavan)
5
Configuring a Network Interface
• The ifconfig command is used for setting and testing
network interfaces (in Unix systems) that run TCP/IP
• Ifconfig must be run at boot time to initialize the network
interfaces.
• Ifconfig -a plots a report on all interfaces.
: aida:/ ; ifconfig -a
ed1: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,
MULTICAST> mtu 1500
inet 128.238.42.114 netmask 0xffffff00 broadcast
128.238.42.255
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
© Jörg Liebeherr (modified by M. Veeraraghavan)
6
Netstat command
• The netstat command plots (a lot of) network related data
structures in the operating system.
• Netstat -i plots information on the network interfaces.
: aida:/ ; netstat -i
Name Mtu
Network
Address
Ipkts Ierrs
ed1
1500 128.238.42/24 aida
2394482 35664
lo0
16384 your-net
localhost
153
0
© Jörg Liebeherr (modified by M. Veeraraghavan)
Opkts Oerrs Coll
346880
223 119591
153
0
0
7