IP SUBNETTING AND ADDRESSING

Download IP Subnetting and. Addressing. Indian Institute of Technology Kharagpur. Prof Indranil Sengupta. Computer Science and Engineering. Indian I...

0 downloads 577 Views 100KB Size
Indian Institute of Technology Kharagpur

IP Subnetting and Addressing Prof Indranil Sengupta Computer Science and Engineering Indian Institute of Technology Kharagpur

Lecture 6:

IP Subnetting and Addressing

On completion, the student will be able to: 1. 2. 3. 4.

Explain the concept of IP subnets, and subnet masks. Compare the benefits of using subnets against multiple address classes. Explain the concept of variable length subnet mask (VLSM) with example. Explain how classless inter-domain routing (CIDR) helps in better address assignment.

1

IP Subnetting

IP Subnet • Basic concept: ¾A subset of a class A, B or C network.

• IP addresses that do not use subnets consists of ƒ a network portion, and ƒ a host portion. ¾Represents a static two-level hierarchical addressing model.

2

IP Subnet (contd.) • IP subnets introduces a third level of hierarchy. ƒ a network portion ƒ a subnet portion ƒ a host portion ¾Allow more efficient (and structured) utilization of the addresses. ¾Uses network masks.

Natural Masks • Network mask 255.0.0.0 is applied to a class A network 10.0.0.0. ¾In binary, the mask is a series of contiguous 1’s followed by a series of contiguous 0’s. 11111111 00000000 00000000 00000000

Network portion

Host portion

3

Natural Masks (contd.) • Provide a mechanism to split the IP address 10.0.0.20 into ¾a network portion of 10, and ¾a host portion of 20. Binary

Decimal IP address:10.0.0.20

00001010 00000000 00000000 00010100

Mask:

11111111 00000000 00000000 00000000

255.0.0.0

Network

Host

Natural Masks (contd.) • Class A, B and C addresses ¾Have fixed division of network and host portions. ¾Can be expressed as masks. ƒ Called natural masks.

• Natural Masks ¾Class A :: 255.0.0.0 ¾Class B :: 255.255.0.0 ¾Class C :: 255.255.255.0

4

Creating Subnets using Masks • Masks are very flexible. ¾Using masks, networks can be divided into smaller subnets.

• How? ¾By extending the network portion of the address into the host portion.

• Advantage gained: ¾We can create a large number of subnets from one network. ¾Can have less number of hosts per network.

Example: Subnets • Network mask 255.255.0.0 is applied to a class A network 10.0.0.0. ¾This divides the IP address 10.5.0.20 into ƒ a network portion of 10, ƒ a subnet portion of 5, and ƒ a host portion of 20. ¾The 255.255.0.0 mask borrows a portion of the host space, and applies it to network space.

5

Subnets (contd.) • What happens? ¾Initially it was a single large Class A network (224-2 hosts). ¾We have now split the network into 256 subnets. ƒ From 10.0.0.0 to 10.255.0.0. ƒ The hosts pet subnet decreases to 65,534.

Subnets (contd.) Decimal

Binary

IP address: 10.5.0.20 00001010 00000101 00000000 00010100 Mask:

255.255.0.0 11111111 11111111 00000000 00000000 Network

Subnet

Host

6

Default Mask and Subnet mask IP Address 144.16.72.57

Default Mask 255.255.0.0

AND

IP Address 144.16.72.57

Subnet Mask 255.255.192.0

Network Address 144.16.0.0

Network Address 144.16.64.0

AND 192: 1100 0000 72: 0100 1000

Subnets vrs Multiple Address Classes • Subnets ¾Management of subnets is done by local network administrator. ¾Single entry in external router tables.

• Multiple Address Classes ¾Multiple entries in external router tables. ¾Additional overhead on the backbone (external) routers.

7

Comparison R

R MULTIPLE ADDRESS CLASSES

SUBNETS R

R

R

R

Variable Length Subnet Masks (VLSM) • Basic concept ¾The same network can be configured with different masks. ¾Can have subnets of different sizes. ¾Allows better utilization of available addresses.

8

Example: VLSM • Suppose we are assigned a Class C network 192.203.17.0. ¾To be divided into three subnets. ƒ Corresponding to three departments. ƒ With 110, 45 and 50 hosts respectively.

D1 (110)

D2 (45)

D3 (50)

The Example (contd.) • Available subnet options ¾The network mask will be the Class C natural mask 255.255.255.0 ¾Subnet masks of the form 255.255.255.X ƒ Can be used to divide the network into more subnets.

9

The Subnet Options X 128

X (in No. of binary) Subnets 1000 0000 2

No. of Hosts 128

192

1100 0000

4

64

224

1110 0000

8

32

240

1111 0000

16

16

248

1111 1000

32

8

252

1111 1100

64

4

• Cannot satisfy the requirements.

The VLSM Option • Basic concept: ¾Use the mask 255.255.255.128 to divide the network address into two subnets with 128 hosts each. ƒ 192.203.17.0 (.0 to .127) ƒ 192.203.17.0 (.128 to .255)

10

The VLSM Option (contd.) ¾Next subnet the second .128 subnet using a mask of 255.255.255.192. ƒ Creates two subnets, 64 hosts each 192.213.17.128 (.128 to .191) 192.213.17.128 (.192 to .255)

The VLSM Option (contd.) 192.203.17.0 Mask: 255.255.255.128 192.203.17.0 (.0 to .127)

192.203.17.0 (.128 to .255) Mask: 255.255.255.192

192.213.17.128 (.128 to .191) 192.213.17.128 (.192 to .255)

11

HIDDEN SLIDE Interface 1 :: 128 hosts Network number: 192.203.17.0 Network mask: 255.255.255.128 Address: 192.203.17.0 -- .127 Interface 2 :: 64 hosts Network number: 192.203.17.128 Network mask: 255.255.255.192 Address: 192.203.17.128 -- .191 Interface 3 :: 64 hosts Network number: 192.203.17.192 Network mask: 255.255.255.192 Address: 192.203.17.192 -- .255

Running out of IP addresses • Growing demand for IP addresses. ¾Severe strain on the classful model. ¾Due to wastage of address space.

• Measures taken: ¾Creative allocation of IP addresses. ¾Classless Inter-Domain Routing (CIDR). ¾Private IP addresses, and Network Address Translation (NAT). ¾IP version 6 (IPv6).

12

CIDR: Introduction • The size of the global routing tables have grown very fast in recent years. ¾Caused routers to become saturated.

• CIDR is a new concept to manage IP networks. ¾Classless Inter Domain Routing. ¾No concept of class A, B, C networks. ¾Reduces sizes of routing tables.

Basic Idea Behind CIDR • An IP address is represented by a prefix, which is the IP address of the network. • It is followed by a slash, followed by a number M. ¾M: number of leftmost contiguous bits to be used for the network mask. ¾Example: 144.16.192.57 / 18

13

CIDR: An Important Rule • The number of addresses in each block must be a power of 2. • The beginning address in each block must be divisible by the number of addresses in the block. ¾A block that contains 16 addresses cannot have beginning address as 144.16.223.36. ¾But the address 144.16.192.64 is possible.

Example: CIDR • An organization is allotted a block with beginning address: 144.16.192.24 / 29

What is the range of the block? Start addr: 10010000 00011000 11000000 00011000 End addr: 10010000 00011000 11000000 00011111 There are 8 addresses in the block.

14

Recent Trend • Move on to CIDR addressing. ¾Existing classful networks can also be represented using this notation. ƒ Class A: W.X.Y.Z / 8 ƒ Class B: W.X.Y.Z / 16 ƒ Class C: W.X.Y.Z / 24

• Recent routers support CIDR.

15

SOLUTIONS TO QUIZ QUESTIONS ON LECTURE 5

Quiz Solutions on Lecture 5 1. What does the port number in a TCP connection specify? It specifies the communicating processes on the two end systems. 2. Why is it necessary to have both IP address and port number in a packet? IP address identifies the host computer. Port number identifies a running process in the host computer.

16

Quiz Solutions on Lecture 5 3. Which of the layers TCP, UDP and IP provides for reliable communication? Only TCP provides reliable communication. 4. Both UDP and IP transmit datagrams. In what ways are they different? UDP carries the port numbers of source and destination, and an optional checksum, in addition.

Quiz Solutions on Lecture 5 5. What are well-known port numbers? Port numbers that are assigned to standard programs and known publicly are called well-known port numbers. They lie in the range 1 and 1023. 6. What are ephemeral port numbers? They are temporary and short-lived port numbers assigned by client on a per connection basis. They range from 1024 to 65535.

17

Quiz Solutions on Lecture 5 7. With respect to a transport level connection, what are the five components in an association? a) The protocol (TCP or UDP). b) Local host IP address (32-bit value). c) Local port number (16-bit value). d) Remote host IP address (32-bit value). e) Remote port number (16-bit value).

Quiz Solutions on Lecture 5 8. Why is the pseudo-header used in calculating TCP checksum? To protect TCP from misdelivery from IP. 9. What are the different fields in the pseudo header? Source IP address, destination IP address, protocol, segment length.

18

Quiz Solutions on Lecture 5 10. Suppose that 5000 bytes are transferred over TCP. The first byte is numbered 20050. What are the sequence numbers for each segment if data is sent in four segments with the first two segments carrying 1000 bytes and the last two segment carrying 1500 bytes? Segment 1 Î 20,050

(20,050 to 21,049)

Segment 2 Î 21,050

(21,050 to 22,049)

Segment 3 Î 22,050

(22,050 to 23,549)

Segment 4 Î 23,550

(23,550 to 25,049)

Quiz Solutions on Lecture 5 11. What is the purpose of the PSH flag in the TCP header? To “push” TCP data. Typically used to indicate end of message. 12. What is the purpose of the ACK flag in the TCP header? To indicate that the “Acknowledgement” field is in use.

19

Quiz Solutions on Lecture 5 13. If you are developing a network application on a reliable LAN environment, which of TCP or UDP would you prefer, and why? UDP, because reliability of transmission need not be worried about. And UDP is faster than TCP.

QUIZ QUESTIONS ON LECTURE 6

20

Quiz Questions on Lecture 6 1. For the subnet mask 255.255.192.0, how many hosts per subnet are possible? 2. In classful addressing, if we are using the subnet mask 255.255.192.0, which address class does it correspond to? 3. What is the subnet address if the destination IP address is 144.16.34.124 and the subnet mask is 255.255.240.0 ? 4. What is the natural mask for a class C network?

Quiz Questions on Lecture 6 5. Using simple subnets, is it possible to divide a network into unequal sized subnets? 6. For an IP address 10.17.5.122 and subnet mask 255.255.128.0, what is the subnet address? How many hosts per subnet are possible? 7. Among multiple network classes and subnets, which alternative imposes more burden on the external router?

21

Quiz Questions on Lecture 6 8. Using VLSM, give a scheme to split a class C address into four subnets where the number of hosts required are: 100, 55, 20, 30

9. If the number of hosts required are 100, 50, 50 and 20, can VLSM be used? 10. Can the following be the beginning addresses in CIDR based addressing? 144.16.192.32/28 10.17.18.42/28

188.15.170.55/28 200.0.100.80/28

Quiz Questions on Lecture 6 11. For a CIDR address of the form W.X.Y.Z/20, what is the maximum number of hosts possible in the network? 12. Which of the following can be the starting address of a CIDR block that contains 512 addresses? 144.16.24.128 144.16.24.0

144.16.75.0 144.16.0.0

22

Indian Institute of Technology Kharagpur

23