Documente Academic
Documente Profesional
Documente Cultură
The service makes the earnesst attempt to deliver packets Delivery is not guaranteed Packets P k t may b l t d li t d delayed or delivered be lost, duplicated, d l d d li d out of sequence Packets are treated independently
Internet Protocol
Essentially, Essentially IP defines:
The basic unit of data transfer, Internet datagram A routing algorithm A set of rules that characterize the best best effort delivery system
Network Layer - an Overview Getting data packets from the source all the way to the destination Dealing with end-to-end transmission end to end Need to know
Topology of the communication subnet (routers) Chose paths (routing algorithms)
Network layer
transport segment from sending to receiving host on sending side encapsulates segments into datagrams on rcving side, delivers segments to transport layer l network layer protocols in every host, router router examines header fields in all IP datagrams passing through it i th h
5
application transport network data link physical
forwarding: move
analogy: gy routing: process of planning trip from source to dest forwarding: process of getting through single interchange
routing: determine
Subnets
Internetworks
Host A -> Host D 4 LANS 1 WAN LANS, S1, S2, S3: Switch or Router f1, f2: Interface Three links: S1 -> S2 -> s3
Links i Li k in an Internetwork I t t k
10
11
12
13
14
Datagram networks
no call setup at network layer routers: no state about end-to-end connections
no network-level concept of connection
Address Space Notations Classful Addressing Classless Addressing Network Address Translation (NAT)
16
15
Note Note
17
18
Figure 19.1 Dotted-decimal notation and binary notation for an IPv4 address
Note
19
20
Example 19.3
Find the error, if any, in the following IPv4 addresses. Note
Solution a. There must be no leading zero (045). b. There can be no more than four numbers. c. Each number needs to be less than or equal to 255. d. A mixture of binary notation and dotted-decimal notation is not allowed.
21 22
In l I classful addressing, the address f l dd i th dd space is divided into five classes: A, B C, D, d E. A B, C D and E
Example 19.4
Find the class of each address. a. 00000001 00001011 00001011 11101111 b. 11000001 10000011 00011011 11111111 c. 14.23.120.8 d. 252.5.15.111 Solution a. The first bit is 0. This is a class A address. b. The first 2 bits are 1; the third bit is 0. This is a class C address. c. The first byte is 14; the class is A. d. The first byte is 252; the class is E. 24
23
Table 19.1 Number of blocks and block size in classful IPv4 addressing
Note
25
26
IP Addressing: introduction
IP address: 32-bit identifier for host, host router interface interface: connection between host/router and physical link
router s routers typically have multiple interfaces host typically has one interface IP addresses associated with each interface
223.1.1.1 223.1.2.1 223.1.1.2 223.1.1.4 223.1.2.9
223.1.1.3
223.1.3.27
223.1.2.2
223.1.3.1
223.1.3.2
27
28
Subnets
IP address:
223.1.1.1 223.1.2.1 223.1.1.2 223.1.1.4 223.1.2.9
Note
Classful addressing, which is almost Cl f l dd i hi h i l t obsolete, is replaced with classless addressing. dd i S b tti Subnetting Supernetting
29 30
subnet part (high order bits) host part (low order bits)
223.1.1.3
Whats a subnet ?
device interfaces with same subnet part of IP address can physically reach each other without intervening router
223.1.3.1
subnet
223.1.3.2
Subnets
Recipe To determine the subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet.
223.1.1.0/24
223.1.2.0/24
Subnets
How many?
223.1.1.1
223.1.1.2
223.1.1.4
223.1.1.3
223.1.9.2
223.1.7.0
223.1.7.1
223.1.3.27 223 1 3 27
223.1.2.1
223.1.2.2
223.1.3.1
223.1.3.2
31
32
Classless Addressing
With classless addressing there are no classes but addresses are still granted in blocks. Restrictions: The addresses in a block must be contiguous The number of addresses in a block must be a power of 2 The first address must be evenly divisible by the number of addresses
Example 19.5
Figure 19.3 shows a block of addresses, in both binary and dotted-decimal notation, granted to a small dotted decimal business that needs 16 addresses. We can see that the restrictions are applied to this block. The addresses are contiguous. The number of addresses i a power of 2 (16 = 24) and th fi t address dd is f ), d the first dd is divisible by 16. The first address, when converted to a decimal number, is 3,440,387,360, which when divided by 16 results in 215,024,210.
33
34
Note
In IP 4 dd I IPv4 addressing, a block of i bl k f addresses can be defined as x.y.z.t /n t in which x.y.z.t defines one of the addresses and the /n d fi dd d th defines the mask. th k
35
36
Example 19.6
A block of addresses is granted to a small organization. We know that one of the addresses is 205.16.37.39/28. What is the first address in the block? Solution The binary representation of the given address is 11001101 00010000 00100101 00100111 If we set 3228 rightmost bits to 0, we get 11001101 00010000 00100101 0010000 or 205.16.37.32. This is actually the block shown in Figure 19.3.
38
Note
The first dd Th fi t address in the block can be i th bl k b found by setting the rightmost 32 n bit to 0 bits t 0s.
37
Example 19.7
Find the last address for the block were one of the addresses is 205.16.37.39/28 Solution The binary representation of the given address is 11001101 00010000 00100101 00100111 If we set 32 28 rightmost bit t 1 we get t i ht t bits to 1, t 11001101 00010000 00100101 00101111 or 205.16.37.47 This is actually the block shown in Figure 19.3. y g
40
Note
The l t dd Th last address in the block can be i th bl k b found by setting the rightmost 32 n bit to 1 bits t 1s.
39
Example 19.8
Find the number of addresses in the block were one of the addresses is 205.16.37.39/28 Solution The value of n is 28, which means that number of addresses is 2 3228 or 16.
Note
The Th number of addresses in the block b f dd i th bl k can be found by using the formula 32n 232 n.
41
42
Example 19.9
Another way to find the first address, the last address, and the number of addresses is to represent the mask as a 32 bit bi 32-bit binary ( 8 di it h d i l) number. Thi i (or 8-digit hexadecimal) b This is particularly useful when we are writing a program to find these pieces of information In Example 19 5 the information. 19.5 /28 can be represented as 11111111 11111111 11111111 11110000 (twenty-eight 1s and four 0s). Find a. The first address b. b The last address c. The number of addresses.
43 44
45
46
Note
The first dd Th fi t address in a block is i bl k i normally not assigned to any device; it i used as th network address th t is d the t k dd that represents the organization to the t th rest of the world. t f th ld
47
48
49
50
Each address in the block can be considered as a two-level id d t l l hierarchical structure: the leftmost n bits (prefi ) define (prefix) the network; the rightmost 32 n bits define the host.
51 52
53
54
Example 19.10
An ISP is granted a block of addresses starting with 190.100.0.0/16 (65,536 addresses). The ISP needs to distribute these addresses to three groups of customers as follows: a. The first group has 64 customers; each needs 256 addresses. b. The b Th second group h 128 customers; each needs 128 d has t h d addresses. c. The third group has 128 customers; each needs 64 addresses. Design the subblocks and find out how many addresses g y are still available after these allocations.
55
56
Number of granted addresses to the ISP: 65,536 Number of allocated addresses by the ISP: 40,960 Number of available addresses: 24,576
57 58
59
60
200.23.16.0/23
Send me anything with addresses beginning 200.23.16.0/20
200.23.18.0/23
Organization 2
Organization 2
200.23.20.0/23
200.23.20.0/23
Organization 7
. . .
. . .
. . .
. . .
Fly-By-Night-ISP Internet
200.23.30.0/23
ISPs-R-Us ISPs-R-Us Send me anything with addresses beginning 199.31.0.0/16 Organization 1 Send me anything with addresses beginning 199.31.0.0/16 or 200.23.18.0/23
200.23.30.0/23
200.23.18.0/23
61
62
IP addressing: the last word... Q: How does an ISP get block of addresses? A: ICANN: Internet Corporation for Assigned
Names and Numbers
10.0.0.1
10.0.0.3
All datagrams leaving local network have same single source NAT IP address: g 138.76.29.7, different source port numbers
Datagrams with source or destination in this network have 10.0.0/24 address for source, destination (as usual)
63
64
NAT
NAT : Network address translation Enables a user to have a large set of addresses internally and one address, or small set of addresses externally.
65
66
range of addresses not needed from ISP: just one IP address for all devices can change addresses of devices in local network without notifying outside world k h f d ld can change ISP without changing addresses of devices in local network d i i l l t k devices inside local net not explicitly addressable, addressable visible by outside world (a security plus).
67
68
69
70
Figure 19.13 An ISP and NAT (1,000 address and 100,000 customer)
71
72
2: NAT router changes datagram source addr from 10.0.0.1, 3345 to 138.76.29.7, 5001, , , updates table
NAT translation table WAN side addr LAN side addr 138.76.29.7, 5001 10.0.0.1, 3345
S: 10.0.0.1, 3345 D: 128.119.40.186, 80
10.0.0.1
1
10.0.0.4 10.0.0.2
138.76.29.7
S: 128.119.40.186, 80 , D: 138.76.29.7, 5001
4
10.0.0.3
#) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table
73 74
4: NAT router changes datagram dest addr from 138.76.29.7, 138 76 29 7 5001 t 10 0 0 1 3345 to 10.0.0.1,
NAT: Network Address Translation 16 bit port number 16-bit port-number field:
60,000 simultaneous connections with a single LAN side LAN-side address!
NAT is controversial:
routers should only process up to layer 3 violates end-to-end argument
NAT possibility must be taken into account by app designers, eg, P2P applications
10.0.0.4
solution 1: statically configure NAT to forward incoming connection requests at given port to server
e.g., (123.76.29.7, port 2500) always forwarded to 10.0.0.1 p port 25000
138.76.29.7
NAT router
76
learn public IP address (138.76.29.7) add/remove port dd/ t mappings (with lease times)
IGD
10.0.0.4 138.76.29.7
NATed li t t bli h NAT d client establishes connection to relay ti t l External client connects to relay relay bridges packets between to connections
2. connection to relay initiated by client Client Cli
NAT router
3. relaying established
10.0.0.1
NAT router
78
Note
79
80
81
82
Example 19.11
Expand the address 0:15::1:12:1213 to its original. Solution S l ti We first need to align the left side of the double colon to the left of the original pattern and the right side of the double colon to the right of the original pattern to find how many 0s we need to replace the double colon. y p
Table 19.5 Type prefixes for IPv6 addresses
83
84
85
86
87
88
89