Download presentation
Presentation is loading. Please wait.
Published byLucas Owens Modified over 8 years ago
1
IP Logical Networks COMP 3270 Computer Networks Computing Science Thompson Rivers University
2
An IPv4 address is a 32-bit address that uniquely and universally defines the connection of a device (for example, a computer or a router) to the Internet. Classless Addressing Network Address Translation (NAT) Topics discussed in this section:
3
Classful addressing, which is almost obsolete, is replaced with classless addressing.
4
1. Classless Addressing Classless Addressing handles address blocks rather than classful networks. An IP logical network is implemented over an address block.
5
Example of address block: The next figure shows a block of addresses, in both binary and dotted-decimal notation, granted to a small business that needs 16 addresses. We can see that the restrictions are applied to this block. 1. The addresses are contiguous. 2. The number of addresses is a power of 2 (16 = 2 4 in this example). 3. The host id of the first address is 0. 4. The host id of the last address has all bit 1s.
6
Example: A block of 16 addresses granted to a small organization ☺ ☺ Which part is changing? ☺ ☺ How to represent the address block, i.e., the address of the address block?
7
In IPv4 addressing, a block of addresses can be defined as x.y.z.t /n in which x.y.z.t defines the first address and the /n defines the mask. The mask decides the size of an address block, which is 2 32-n. 205.16.37.32/28; Size: 2 4 = 16
8
The first address in the block can be found by setting the rightmost 32 − n bits to 0s. That is the result of BIT_AND with the mask.
9
Example: A block of addresses is granted to a small organization. The mask /28 is used in the address block. We know that one of the addresses is 205.16.37.39. What is the first address in the block? Find the last address for the block. Find the number of addresses in the block. 11001101 00010000 00100101 00100111 => 11001101 00010000 00100101 00100000 … 11001101 00010000 00100101 00101111
10
An example network configuration: for the block 205.16.37.32/28 All the addresses in an address block can be reached through one router. Any address in the bock AND /28 becomes the first address. This query, Dest addr AND /28 == 205.16.37.32 ???, is used in IP packet forwarding in the intermediate routers An example of routing entry in the rest of the Internet: 205.16.37.32 /28 xxx.xxx.xxx.xxx yyy
11
The first address in a block is normally not assigned to any device; it is used as the network address that represents the organization to the rest of the world. The last address is not assigned to any device; it is used as the broadcast address in the logical network represented by the network address.
12
Two levels of hierarchy in an IPv4 address
13
Each address in the block can be considered as a two-level hierarchical structure: the leftmost n bits (prefix) define the network; the rightmost 32 − n bits define the host.
14
Subnetting using larger netmask: Subdivision of a network, i.e., address block Supernetting using smaller netmask: Aggregation of networks, i.e., address blocks Subnetting and supernetting
15
Subnetting – at the edge networks
16
Configuration and addresses in a subnetted network 00000000 ~ 00011111 00100000 ~ 00101111 00110000 ~ 00111111... 00000000 ~... 00111111 All addresses in the address block, 17.12.14.0/26, can be reached through this router. bit patterns
17
Three-level hierarchy in an IPv4 address
18
17.12.14.0 /26 (… 00000000) ~ 17.12.14.63 /26 (… 00111111) 17.12.14.0 /27 (… 00000000) ~ 17.12.14.31 /27 (… 00011111) 17.12.14.0 /27 (… 00000000) ~ 17.12.14.31 /27 (… 00011111) 17.12.14.32 /27 (… 00100000) ~ 17.12.14.63 /27 (… 00111111) 17.12.14.32 /28 (… 00100000) ~ 17.12.14.47 /28 (… 00101111) 17.12.14.48 /28 (… 00110000) ~ 17.12.14.63 /28 (… 00111111)
19
00000000 ~ 00011111 00100000 ~ 00101111 00110000 ~ 00111111... 00000000 ~... 00111111 All addresses in the address block, 17.12.14.0/26, can be reached through this router. bit patterns
20
Exmaple: (very important) 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 second group has 128 customers; each needs 128 addresses. c.The third group has 128 customers; each needs 64 addresses. Design the sub-address blocks and find out how many addresses are still available after these allocations. 256 = 2 8 64 = 2 6 128 = 2 7 1 st group: 64 x 256=> 2 14 2 nd group: 128 x 128=> 2 14 3 rd group: 128 x 64=> 2 13
21
190.100.0.0 /16 => 11000000 01100100 00000000 00000000 /16 1 st group: 64 x 256=> the required size: 2 14 2 nd group: 128 x 128=> the required size: 2 14 3 rd group: 128 x 64=> the required size: 2 13 2 14 2 15 2 16 2 13
22
190.100.0.0 /16 => 11000000 01100100 00000000 00000000 /16 1 st group: 64 x 256=> the required size: 2 14 2 nd group: 128 x 128=> the required size: 2 14 3 rd group: 128 x 64=> the required size: 2 13 190.100.0.0/16 190.100.0.0/17 190.100.128.0/17 190.100.0.0/18 190.100.64.0/18 190.100.128.0/19
23
Group 1: For this group, each customer needs 256 addresses. This means that 8 (= log 2 256) bits are needed to define each host. The prefix length is then 32 − 8 = 24. The addresses are 11000000 01100100 00000000 00000000 /24 ~ 11000000 01100100 00111111 00000000 /24 190.100.0.0/18 for the subblock 11000000 01100100 00000000 00000000 /16 64 x 256 => 2 14 ~ ~ ~
24
Group 2: For this group, each customer needs 128 addresses. This means that 7 (= log 2 128) bits are needed to define each host. The prefix length is then 32 − 7 = 25. The addresses are 11000000 01100100 01000000 00000000 /25 ~ 11000000 01100100 01111111 10000000 /25 190.100.64.0/18 for the subblock 11000000 01100100 00000000 00000000 /16 ~ ~ ~ 2 nd group: 128 x 128
25
Group 3: For this group, each customer needs 64 addresses. This means that 6 (= log 2 64) bits are needed to each host. The prefix length is then 32 − 6 = 26. The addresses are Number of granted addresses to the ISP: 65,536 Number of allocated addresses by the ISP: 40,960 ☺ ☺ Number of available addresses: 24,576 => ??? 11000000 01100100 10000000 00000000 /26 ~ 11000000 01100100 10011111 11000000 /26 190.100.128.0/19 for the subblock 11000000 01100100 00000000 00000000 /16 ~ ~ ~
26
Allocated subblocks: 190.100.0.0/18 11000000 01100100 00000000 00000000 190.100.64.0/18 11000000 01100100 01000000 00000000 190.100.128.0/19 11000000 01100100 10000000 00000000 ☺ ☺ What are the remained subblocks? 190.100.160.0/19 190.100.192.0/18 11000000 01100100 00000000 00000000 /16
27
190.100.0.0/16 190.100.0.0/18 190.100.0.0/24 190.100.63. 0/24 … 190.100.64.0/18 190.100.12 8.0/19
28
Supernetting or address aggregation Between networks Too many networks => difficulty for routing and forwarding Routing: need to exchange much data => traffic overhead Forwarding: big routing table size => slow decision process Classless addressing Base address (i.e., the first address in the address block) + netmask, i.e., network address X.Y.36.0/22represents the next four address blocks. 110xxxxx yyyyyyyy 00100100........: X.Y.36.0/24 110xxxxx yyyyyyyy 00100101........: X.Y.37.0/24 110xxxxx yyyyyyyy 00100110........: X.Y.38.0/24 110xxxxx yyyyyyyy 00100111........: X.Y.39.0/24 11111111 11111111 11111100 00000000: /22 BIT_AND operation with any one of the above four networks will produce the same result, i.e., the base network address 110xxxxx yyyyyyyy 00100100 00000000 24 – 22 = 2 => 4 address blocks can be aggregated into one entry. One routing entry of destination X.Y.36/0/22 can be used in the routing table for the above four networks. E.g., 192.24.44/22 192.24.44.0/24 198.162.22.254 eth0 192.24.45.0/24 198.162.22.254 eth0 => 192.24.44.0/22 198.162.22.254 eth0 192.24.46.0/24 198.162.22.254 eth0 192.24.47.0/24 198.162.22.254 eth0
29
In this section, we have studied address blocks. Let's go to 3.3.3 'Deliver, and IP packet forwarding'. IP packet forwarding/delivering uses address blocks. We will come back here later.
30
R1 198.162.22.0/24 R2 192.24.44.0/24 192.24.45.0/24 192.24.46.0/24 192.24.47.0/24 eth0: 198.162.22.8 eth1: 198.162.22.254 44 -> 00101100 45 -> 00101101 46 -> 00101110 47 -> 00101111 252 11111100 Network addressMaskNext hopInterface 192.24.44.0 … /22 … 198.162.22.254 … eth0 … /22 -> 11111111 11111111 11111100 192.24.45.7 & 255.255.252.0 -> 192.24.44.0 ☺ ☺ Routing table at R1 for the 4 networks? Example of routing and address aggregation
31
2. NAT(Network Address Translation) How to use private IP addresses: How to use private IP addresses: ☺ ☺ Do we really have to use public IP addresses for home computers? Accessibility to the public network from a private network Called Internet sharing on Windows system Called IP masquerading on Linux system
32
NAT(Network Address Translation) Several variants Address translation Port address translation Reverse address translation... Natural for firewalling Load sharing with port/address redirection But end-to-end inconsistency; not fit to IPsec (IP Security) ☺ ☺ Private address?
33
Address blocks for private networks Range 10.0.0.0 to 10.255.255.255 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 127.0.0.0/8 for localhost ☺ ☺ Can you give the addresses of the above address blocks? 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
34
An Example of ISP and NAT Many computers on the left share 1000 addresses. Supported by NAT
35
172.18.0.0/16 208.38.45.135 SA: 172.18.3.1 DA: 208.38.45.135 ☺ ☺ Can the packet arrive at the destination? Yes! ☺ ☺ How? ☺ ☺ Can the response message come back to the source? No! ☺ ☺ Why?
36
Basic idea of NAT Cannot access directly. ☺ ☺ Why? 208.38.45.135 It has a private address 172.18.3.30 that is the default gateway of all other internal computers, and a public address 200.24.5.8 Destination 208.38.45.135 Source 208.38.45.135 ☺ ☺ Destination address? ☺ ☺ Source address? NAT changes the source address for outgoing traffic and the destination address for incoming traffic. Default router ☺ ☺ What if several computes in the private network wants to communicate with computers outside at the same time?
37
Address translation NAT It keeps a pool of public addresses routable to the NAT gateway from outside. Default router ☺ ☺ What if only one public address is available?
38
translation table Private Address Transport Protocol Private Port External Port External Address Internal Port Transport Protocol 172.18.3.1TCP23458025.8.3.21400TCP 172.18.3.2TCP12348025.8.3.21401TCP... NAT 2345;80 | 172.18.3.1;25.8.3.2 1400;80 | 200.24.5.8;25.8.3.2 200.24.5.8;25.8.3.2 | 1400;80 172.18.3.1;25.8.3.2 | 2345;80 Port translation NAT It has one public IP address. 25.8.3.2 172.18.3.1 200.24.5.8 172.18.3.2 This triple is unique in NAT for a pair of private address and port address
39
☺ ☺ Is nested NAT possible?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.