Download network address -

Document related concepts

Dynamic Host Configuration Protocol wikipedia , lookup

Asynchronous Transfer Mode wikipedia , lookup

IEEE 802.1aq wikipedia , lookup

Net bias wikipedia , lookup

Distributed firewall wikipedia , lookup

AppleTalk wikipedia , lookup

IEEE 1355 wikipedia , lookup

Multiprotocol Label Switching wikipedia , lookup

Deep packet inspection wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

Airborne Networking wikipedia , lookup

Network tap wikipedia , lookup

Computer network wikipedia , lookup

I²C wikipedia , lookup

List of wireless community networks by region wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Zero-configuration networking wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Transcript
Chapter 19
Network Layer:
Logical Addressing
McGraw-Hill
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Network layer duties
McGraw-Hill
Figure 19.1
Internetwork
Data link layer responsible for data delivery
on the network from one node to the next
McGraw-Hill
Figure 19.3
McGraw-Hill
Network layer in an internetwork
Brief discussion of switches

How to connect multiple devices or to form a large
network?




Mesh topology
Star topology
Both are not practical and costly when applied to very
large networks because of:
 Number of links
 Length of the links
 Many links will stay idle for most of the time
Solution: Switched networks
 Examples on switching
Circuit-switches in telephony network
LAN switches in LAN connection, i.e. bridges, and layer-2 switches
Packet switches in packet switching networks, i.e. routers
McGraw-Hill
Figure 8.1 Switched network
 Switched network: consists of a series of interlinked
nodes called switches
 Switching devices: devices capable of creating a
temporary connections between two or more devices
linked to the switch and can forward the packet to the
next link along the path to its destination.
router
End system
McGraw-Hill
Switching
McGraw-Hill
Note
A circuit-switched network is made of a
set of switches connected by physical
links, in which each link is
divided into N channels.
McGraw-Hill
8-1 CIRCUIT-SWITCHED NETWORKS
A circuit-switched network consists of a set of switches connected by
physical links.
A connection between two stations is a dedicated path made of one or
more links.
 Each link is normally divided into (N) channels
Each connection uses only one dedicated channel on each link.
Switch
Path is
determined
during setup
phase
McGraw-Hill
Link divided
into 3
channels
End
system
Circuit Switching





Data is transmitted as stream of bits, no packetizing is needed
In circuit switching, the resources need to be reserved during the setup
phase; the resources remain dedicated for the entire duration of data
transfer until the termination phase
Not efficient for data communication and computer networks because a
computer can be connected to another computer through the circuit even
if there is no activity for long time.
Delay during data transfer is small (no waiting at each switch once the
circuit is established)
Used in the telephone network
McGraw-Hill
Figure 8.6 Delay in a circuit-switched network
McGraw-Hill
Packet switching - Virtual circuit

Virtual circuit - Connection-oriented : A connection (handshaking)
between the sender and the receiver is established and the complete
path for the packets to reach to the destination is determined before
transmission of any packets. This path is called virtual circuit or a
connection and the address given for each packet is the sequence
number of the virtual circuit called Virtual Circuit Identifier
(VCI)
 No physical dedicated path: the path can be used by other virtual
circuits
 Data is packetizied before transmission
 Packets are guaranteed to arrive in the order they were sent
 Packets are logically connected to each other, packets travel one
after the other
 The virtual circuit has to be terminated after all packets of a
message have been arrived
 If the virtual circuit router crashes all virtual circuits that go
through the router are terminated and paths are lost
 Used in WAN (Frame relay, ATM)
McGraw-Hill
Virtual circuit
Parameters such as buffer, bandwidth, delay requirements
were set in every switch along the path during setup
Connect
request
Connect
confirm
SW
1
Connect
request
SW
2
Connect
confirm
…
SW
n
Connect
request
Connect
confirm
Question: why called virtual-circuit?
Because resources, e.g., switches, buffers and lines, are shared
by packets from multiple connections, not dedicated to one
specific connection like in the telephone connection.
McGraw-Hill
Figure 8.13 Source-to-destination data transfer in a virtual-circuit network
McGraw-Hill
Figure 8.16 Delay in a virtual-circuit network
McGraw-Hill
Packet switching - Datagram

Datagram - Connectionless service :No handshaking, each
packet is sent and routed independently and can follow different paths
to reach to the destination. The full address of the source and
destination must be attached to each packet.




McGraw-Hill
No setup delay
Packets are not guaranteed to arrive in the order they were sent
Robust: If a router crashes only packets inside the router will be lost,
other packets can follow other path
Used in the Internet
Packet switching
Note
In datagram networks, there
is no resource reservation;
resources are allocated on demand.
McGraw-Hill
Figure 8.9 Delay in a datagram network
McGraw-Hill
Note
Switching in the Internet is done by
using the datagram approach
to packet switching at
the network layer.
McGraw-Hill
Figure 8.8 Routing table in a datagram network
McGraw-Hill
Note:
Communication at the network layer
in the Internet is connectionless.
McGraw-Hill
19.2 Addressing





The address in the network layer of the TCP/IP model is called Internet
Address or IP address
An IP address is a 32-bit address
The IP addresses are unique (each connection has a different address)
and universal (must be accepted by any host wants to connect to the
internet).
Consists of 4 octets (bytes)
Network IP addresses are managed by a nonprofit organization called
ICANN (International Corporation for Assigned Names and Numbers)
to avoid conflicts.


McGraw-Hill
Assigns addresses to regional Authorities which assign
numbers to ISPs
Assigns and manages DNS (Domain Name System)
The address space of IPv4 is
232
or
4,294,967,296.
McGraw-Hill
McGraw-Hill
Network + Host: Complete IP address
Network Address: Host part set to 0
Network ID: identifies the network to which the host is
connected
Host ID: identifies the interface of the network connection to
the host not the host itself
McGraw-Hill
Figure 19.9
McGraw-Hill
Dotted-decimal notation
Note:
The binary, decimal, and hexadecimal
number systems are reviewed in
Appendix B.
McGraw-Hill
Example 1
Change the following IP addresses from binary notation to dotteddecimal notation.
a.
10000001 00001011 00001011 11101111
b.
11111001 10011011 11111011 00001111
Solution
We replace each group of 8 bits with its equivalent decimal
number (see Appendix B) and add dots for separation:
a.
129.11.11.239
b.
249.155.251.15
McGraw-Hill
Example 2
Change the following IP addresses from dotted-decimal notation to
binary notation.
a.
111.56.45.78
b.
75.45.34.78
Solution
We replace each decimal number with its binary equivalent
(see Appendix B):
a.
b.
McGraw-Hill
01101111 00111000 00101101 01001110
01001011 00101101 00100010 01001110
Example
Find the error, if any, in the following IP
address:
75.45.301.14
Solution
In dotted-decimal notation,
each number is less than or
equal to 255; 301 is outside this range.
McGraw-Hill
Note:
In classful addressing, the address
space is divided into five classes: A, B,
C, D, and E.
McGraw-Hill
Finding the classes in binary and dotted-decimal notation
McGraw-Hill
Figure 19.11 Finding the address class
McGraw-Hill
Example 3
Find the class of each address:
a.
00000001 00001011 00001011 11101111
b.
11110011 10011011 11111011 00001111
Solution
See the procedure in Figure 19.11.
a.
b.
McGraw-Hill
The first bit is 0; this is a class A address.
The first 4 bits are 1s; this is a class E address.
Example 4
Find the class of each address:
a.
227.12.14.87
b.
252.5.15.111
c.
134.11.78.56
Solution
a.
b.
c.
McGraw-Hill
The first byte is 227 (between 224 and 239); the class is D.
The first byte is 252 (between 240 and 255); the class is E.
The first byte is 134 (between 128 and 191); the class is B.
Figure 19.13
McGraw-Hill
Netid and hostid
Classful Addressing

Class A
 Start with binary 0
 All 0 reserved (default route) or any network
 01111111 (127) reserved for loopback
 231 or 2,147,483,648 class A complete IP addresses
 27 =128 blocks (network addresses)
 Number of complete IP addresses in each block is 224=16777216 – (all
zeros host - network address, and all ones – broadcast address)
 Valid Range 1.x.x.x to 126.x.x.x (126 valid blocks)
 All allocated

Class B
 Start with binary 10
 Range 128.x.x.x to 191.x.x.x
 230 class B complete IP addresses
 214=16384 blocks (network addresses)
 Number of addresses in each block is 216=65536 – (all zeros host, and all
ones)
 All allocated
McGraw-Hill
Classful Addressing

Class C

Start with binary 110

Range 192.x.x.x to 223.x.x.x
 229 Class C complete IP addresses
 221=2097152 blocks (network addresses)
Number of addresses in each block is 256 – (all zeros host, and all ones)
class

Nearly all allocated
Class D
 Multicast addresses
 No network/host hierarchy


Private addresses
Range
10.0.0.0
to
10.255.255.255
224
172.16.0.0
to
172.31.255.255
220
192.168.255.255
216
192.168.0.0 to
McGraw-Hill
Total
Figure 19.14
McGraw-Hill
Blocks in class A
Note:
Millions of class A addresses are
wasted.
McGraw-Hill
Figure 19.15
McGraw-Hill
Blocks in class B
Note:
Many class B addresses are wasted.
McGraw-Hill
Note:
The number of addresses in class C
block is smaller than the needs of most
organizations.
McGraw-Hill
Figure 19.16
McGraw-Hill
Blocks in class C
Figure 19.17
McGraw-Hill
Network address
Note:
In classful addressing, the network
address is the one that is assigned to
the organization.
McGraw-Hill
Example 5
Given the address 23.56.7.91, find the network address.
Solution
The class is A. Only the first byte defines the netid. We can find the network
address by replacing the hostid bytes (56.7.91) with 0s. Therefore, the
network address is 23.0.0.0.
McGraw-Hill
Example 6
Given the address 132.6.17.85, find the network address.
Solution
The class is B. The first 2 bytes defines the netid. We can find the network
address by replacing the hostid bytes (17.85) with 0s. Therefore, the
network address is 132.6.0.0.
McGraw-Hill
Example 7
Given the network address 17.0.0.0, find the class.
Solution
The class is A because the netid is only 1 byte.
McGraw-Hill
Note:
A network address is different from a
netid. A network address has both
netid and hostid,
with 0s for the hostid.
McGraw-Hill
Figure 19.18
Sample internet
Class B
Class C
Class A
McGraw-Hill
Note:
IP addresses are designed with two
levels of hierarchy.
McGraw-Hill
Table 19.1 Default masks
Class
In Binary
In DottedDecimal
Using Slash
A
11111111 00000000 00000000 00000000
255.0.0.0
/8
B
11111111 11111111 00000000 00000000
255.255.0.0
/16
C
11111111 111111111 11111111 00000000
255.255.255.0
/24
McGraw-Hill
Note:
The network address can be found
by applying the default mask to any
address in the block (including itself).
It retains the netid of the block and
sets the hostid to 0s.
McGraw-Hill
Figure 19.19 A network with two levels of hierarchy
Addressing without Subnets
A class B “Flat Network”, more than 216=65536 hosts
How to manage?
Performance? Too many hosts on the same LAN (single
broadcast domain) will slowdown the LAN performance
Solution: Subnetting
McGraw-Hill
A campus network consisting of LANs for various departments.
McGraw-Hill
Reduces the
routing table
entries and size
McGraw-Hill
Subnetting







McGraw-Hill
Dividing the network into several smaller groups (subnets) with each
group having its own subnet IP address
Site looks to rest of internet like single network and routers outside
the organization route the packet based on the main Network address
Local routers route within subnetted network using subnet address
Host portion of address partitioned into subnet number (most
significant part) and host number (least significant part)
In this case, IP address will have 3 levels (Main network, subnet, host)
Subnet mask is a 32-bit consists of zeros and ones that indicates
which bits of the IP address are subnet number and which are host
number
Subnet mask when ANDed with the IP address it gives the
subnetwork address
Figure 19.23
Class B
McGraw-Hill
Subnet mask
Figure 19.20 A network with three levels of hierarchy (subnetted)
McGraw-Hill
Routers will use subnet mask 255.255.192.0
or /18
Example 8
A router outside the organization receives a packet with destination
address 190.240.7.91 /16. Show how it finds the network address to
route the packet.
Solution
The router follows three steps:
1. The router looks at the first byte of the address to find the
class. It is class B.
2. The default mask for class B is 255.255.0.0. or /16 The router
ANDs this mask with the address to get 190.240.0.0.
3. The router looks in its routing table to find out how to route the
packet to this destination. Later, we will see what happens if
this destination does not exist.
McGraw-Hill
Example 9
A router inside the organization receives the same packet with
destination address 190.240.33.91 /19. Show how it finds the
subnetwork address to route the packet.
Solution
The router follows three steps:
1. The router must know the mask. Is 255.255.224.0 or /19
2. The router applies the mask to the address, 190.240.33.91. The subnet
address is 190.240.32.0.
3. The router looks in its routing table to find how to route the packet to
this destination. Later, we will see what happens if this destination does
not exist.
McGraw-Hill
Address assignment with subnets and subnet routing
Assume each subnet has 100
nodes  we need only 7 bits
for the host, remaining 9 bits
of the host part will be
assigned to subnets
150.100.0.1
To the rest of
the Internet
Subnet Mask will be
255.255.255.128 or /25
H1
H2
150.100.12.154
150.100.12.176
150.100.12.128
R = Router
Subnet
address
150.100.12.129
H = Host
R1
150.100.12.4
H3
H4
150.100.12.24
150.100.12.55
150.100.12.0
150.100.12.1
1.A site with class B IP address: 150.100.0.0
R2
H5
2. Outside see all packets to any host within
150.100.15.54
the network is to get the packets to
network 150.100.0.0
150.100.15.0
3. Suppose a packet with 150.100.15.11 arrive at R1 from outside:
R1 finds the subnet first by doing the following:
150.100.15.11 & 255.255.255.128
= 10010110.01100100.00001111.00001011 & 11111111.11111111.11111111.10000000
= 10010110.01100100.00001111.00000000 i.e., 150.100.15.0
McGraw-Hill
150.100.15.11
Figure 8.7
Obtaining Host IP Address


Once a network administrator in an organization obtained a block of
addresses from its ISP, it can then assign individual IP addresses to the
host and router interfaces
It can be done in two ways:
 Manual configuration: IP address is stored manually by the
administrator in a configuration file



Solution is using a protocol called Dynamic Host Configuration
Protocol (DHCP)

McGraw-Hill
What about a diskless computer? Or first time booted computer with
a disk?
What about if the computer has moved from one subnet to another?
DHCP is a client-server program
21.1 Dynamic Host Configuration Protocol (DHCP)

McGraw-Hill
Dynamic Host Configuration Protocol (DHCP)
 A protocol that provide IP address, subnet mask, IP address of a
gateway router, and IP address of DNS server dynamically to a
host or to a diskless computer
 DHCP server keeps two databases (static IP addresses and unused
temporary Addresses.)
 Static IP addresses database maps physical addresses (MAC) to
permanent IP addresses (used for diskless workstations)
 When a host requests an address DHCP will look into the static
database first.

If no address match is found, DHCP will select the dynamic IP
database. DHCP will assign a Temporary Address: selected address
from a pool of free addresses and assign it to the host
 Leasing: DHCP server assigns an IP address for a host for a
specific period of time in order not to waste IP addresses

After the period expires, host must return the IP address or
renew the lease.
21.1 Address Resolution Protocol (ARP)


At the network level hosts and routers are
recognized by their IP address
Packets must pass through physical networks to
reach hosts and routers.


McGraw-Hill
At the physical network, hosts and routers are
recognized by their MAC addresses which is local
address.
ARP is a network layer protocol that translates
between Internet IP address and MAC sublayer
(layer-2) address
Figure 21.4 Four cases using ARP
McGraw-Hill
Figure 21.1 ARP operation
McGraw-Hill
Figure 21.3 Encapsulation of ARP packet
McGraw-Hill
Note
An ARP request is broadcast;
an ARP reply is unicast.
McGraw-Hill
Figure 20.5 IPv4 datagram format
+ Padding
McGraw-Hill
IPv4 datagram fields











Minimum Header length is 20 bytes without options.
With options the maximum can go to 60 bytes
Largest data that can be carried in the datagram is 65535 – 20 = 65515
Version field: will carry the version number which is 4 = (0100)2
Header length: the length of the header in bytes after dividing it by 4. Min is 20/4 = 5 =
(0101)2 and the max is 60/4 = 15 = (1111 )2
Total length: total length of the packet: header + data. Max = 65535 bytes
Identification, flags, and offset used for fragmentation and reassembly at the destination.
Packet can be fragmented at any node between the source and the destination but
reassembly is done ONLY at the destination node. Refer to Figure (20.10)
Time to Live is used to prevent lost packets from circulating between routers forever. This
field is set to certain value depending on the device operating system. Each router will
decrement this field by one and check the value. If the value is zero the packet will be
dropped.
Protocol: contains a code for what is being carried in the data field. Refer to table (20.4) and
Figure (20.8)
Header checksum used for checking if there is error in the header only. The checksum is
recomputed at each router between the source and the destination. Refer to Figure (20.13)
McGraw-Hill
Figure 20.8 Protocol field and encapsulated data
McGraw-Hill
Table 20.4 Protocol values in Hex
McGraw-Hill
Figure 20.9 Maximum transfer unit (MTU)
McGraw-Hill
Table 20.5 MTUs for some networks
McGraw-Hill
Figure 20.13 Example of checksum calculation in IPv4
McGraw-Hill
Flags used in fragmentation
M=1 means the packet is
not the last fragment
M=0 means the packet is
the last fragment
D=1 means Do not
fragment the packet
McGraw-Hill
Figure 20.10
Fragmentation and Reassembly
 Fragmentation takes place at the sender and routers
 Reassembly takes place at the receiver ONLY.
Fragment
at source
Reassemble
at destination
Source
IP
Router
Fragment
at router
Network
McGraw-Hill
Destination
IP
Network
Example: Fragmentation
Network packet total size (header + data) = 4000
bytes  can’t be carried in a single Ethernet frame.
 Data size = 4000 – 20 = 3980 bytes
Divide the data into two packets each has data of
size 1480 bytes, and one of size 3980 – 1480 -1480 =
1020 bytes
McGraw-Hill
Network Address Translation (NAT) –
Chapter 19 pages 563 - 566

How To save IP addresses;




McGraw-Hill
For home users – who are connected to the Internet by dial up,
dynamic addresses can be assigned to them for the connection period
For business customers and many home users (ADSL), they want to
stay connected continuously  each user must have its own IP
address  total number of IP number an ISP can provide will not be
enough to cover all customers (for example, class B block can support
65536 only)
Solution is using NAT enabled router
NAT: enables a company to have large set of unique
addresses internally (private addresses) and one address or
a small set of addresses externally (public)
Figure 19.13 An ISP and NAT
ISP has 1000 global IP
addresses ONLY
ISP has more than 1000
customers
McGraw-Hill
Private IP addresses
Range
10.0.0.0
to
10.255.255.255
224
172.16.0.0
to
172.31.255.255
220
192.168.255.255
216
192.168.0.0 to
McGraw-Hill
Total
Figure 19.10
McGraw-Hill
NAT
Figure 19.11 Address translation
McGraw-Hill
Figure 19.12 Translation
Source IP
200.24.5.8
McGraw-Hill
Network Address Translation (NAT)

How does it work?





Before the packet leaves the NAT router

McGraw-Hill
A company is connected to the ISP through a router with NAT software
(router is called NAT enabled router). The router has a unique IP address
given to the company by the ISP
NAT router maintains a translation table that has 65536 entries. Each
row has four fields: Private source address, source port number,
destination address, NAT port number = NAT table row number
Every machine within a company has a unique IP address selected from
the set of private addresses usually (10.x.y.z)
If a computer inside the company want to connect to a computer outside
the network, such as a Web server, the NAT router receives the packet
from the computer
The NAT router saves the computer's private IP address (source IP) and
port number (source port) to the address translation table stored in the
router. Then, the router replaces the sending computer's IP address with
the router's IP address (global IP address). The router replaces the
sending computer's source port with a port number equal to the
translation table row number where the router saved the sending
computer's address information.
Network Address Translation (NAT)

When the packet arrives to the NAT router

McGraw-Hill
When a packet arrives at the NAT router from the ISP router, the NAT router reads
the destination port number (NAT given port) on the arriving packet and then
uses it in the address translation table to extract the original computer private IP
address and original source port number. The destination port and the
destination IP are replaced by the original values retrieved from the table..
The packet is then sent to the destination computer.
PAT Translation table
Private
(local)
source
Address
Private
(local)
source Port
NAT
Port
172.18.3.1
6789
10000
172.18.3.2
6789
10001
...
...
…
McGraw-Hill
External
(remote) Address
25.8.3.2
25.8.3.2
...
Using PAT
allows
more than
one host to
contact
same
destination
NAT Example
NAT enabled router
Case 1: Host A in the figure sends a packet to IP address 216.109.118.73, port 80, with its
local port set to 6798. The resulting entry in the NAT box (assume that the current row
index is 9000) is
Row # 9000
Case 2: Supposed just after part (A) above, host B sends a packet to
the same destination address and port, with it's local port also set to
6798. The resulting entry in the NAT box
Row # 9001
McGraw-Hill
Advantages of using NAT




No need to be allocated range of global addresses from ISP:
just one global IP address is used for all devices  save IP
address
can change addresses of devices in local network without
notifying outside world
can change ISP without changing addresses of devices in local
network
Can be used as firewall. A computer on an external network cannot
connect to your computer unless your computer has initiated the
contact. You can browse the Internet and connect to a site, and even
download a file; but somebody else cannot use your IP address to
connect to a port on your computer. (** Internet routers do
not recognize and forward packets with private
destination IP addresses)
McGraw-Hill