Subnetting & CIDR

Tahir Azim

Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT)

Umar Kalim (NIIT) .com) Courtesy Nick McKeown (Stanford).11g-based wireless networks by unwrapping short 802.11g packets and rebundling them into a larger packet to reduce the impact of mandatory gaps between packets (jwire. FAST-NU Islamabad • Assignment 1 deadline extended to Tuesday due to no BIT-7 classes on Monday • From last time: – Packet bursting: An approach to increasing the speed of 802.Announcements • Participate in NASCON.

82 netmask ffffff00 broadcast 171.Subnetting • Subnetting is a form of hierarchical routing.15. Courtesy Nick McKeown (Stanford). • Can also be represented by a “prefix + length”.EDU > ifconfig hme0 hme0: flags=863<UP.NOTRAILERS.MULTICAST> mtu 1500 inet 171.15. and the last 8 bits are the host ID.64. • Subnets are usually represented via an address plus a subnet mask or “netmask”.64.g.Stanford.15/24. • e.BROADCAST. Umar Kalim (NIIT) .64.0/24. 171. e.RUNNING.64.g.15.255 • Netmask ffffff00: the first 24 bits are the subnet ID. nickm@elaine17. or just 171.

Company 2 14 16 10 Net ID Host-ID e. Site 2 14 16 2 14 16 10 Net ID 0000 Host-ID Subnet Host ID (12) 10 Net ID 1111 Host-ID Subnet Host ID (12) Subnet ID (20) Subnet ID (20) e.g. Umar Kalim (NIIT) . Dept 2 14 16 2 14 16 1111011011 10 Net ID 000000 Host-ID Subnet Host ID (10) 10 Net ID Host-ID Subnet Host ID (6) Subnet ID (22) Subnet ID (26) Courtesy Nick McKeown (Stanford).Subnetting CLASS “B” e.g.g.

then the subnet and finally the host Courtesy Nick McKeown (Stanford).Routing in the presence of subnets • The rest of the Internet is not aware of subnets within a network • Levels: site. Umar Kalim (NIIT) . subnet. host • Routing now involves delivery to the site.

74.1.64.1.178 bbr2-rtr 171.1.1 Gates-rtr 171.132/30 171.0/24 171.131 171.1.148 Courtesy Nick McKeown (Stanford).74.0.com border2-rtr 171.net hpr1-rtr 171.144/28 To: cogentco.64.0/16 AS 32 171.64.64.64.1.58 EndHost 171.1.64.133 Class B Address 171.1.74.64.161 171.64.160/27 171.152 171.64.64.64. Umar Kalim (NIIT) .64.1.64.Example of subnetting To: cenic.1.

g. and y indicates the length of the prefix.9.255. e.Classless Interdomain Routing (CIDR) Addressing     The IP address space is broken into line segments.9/16 represents the block containing addresses in the range: 128.16.9/16 142. Block of 2 addresses. The prefix 128.0 … 128. Each block is described by a prefix.9.9.14 .g. A prefix is of the form x/y where x indicates the prefix of all addresses in the block.0. 128.9. block of 128 addresses etc. Umar Kalim (NIIT) 232-1 128.0 65/8 128.0.12/19 0 216 Courtesy Nick McKeown (Stanford).255. or blocks  e.

9.9.25/24 128.9.9/16 0 232-1 128.16/20 128.14 Most specific route = “longest matching prefix” Courtesy Nick McKeown (Stanford).9.16.9.Classless Interdomain Routing (CIDR) Addressing 128.19/24 128.176/20 128. Umar Kalim (NIIT) .

E. and so reduce the size of their address table. it can (sometimes) aggregate them to form a shorter prefix.0/24.9.14.9.9. Umar Kalim (NIIT) ISP Choice:  . In principle. Courtesy Nick McKeown (Stanford). Other routers can refer to this shorter prefix. an organization can keep its prefix if it changes service providers.Classless Interdomain Routing (CIDR) Addressing Prefix aggregation:   If a service provider serves two organizations with prefixes. it can tell other routers to send it all packets belonging to the prefix 128. ISP serves 128.14.0/23.g.0/24 and 128.15.

Size of the Routing Table at the core of the Internet Source: http://www.cidr-report. Umar Kalim (NIIT) .org/ Courtesy Nick McKeown (Stanford).

Jan 2006 11 14 17 20 23 Prefix length (bits) Courtesy Nick McKeown (Stanford).Prefix Length Distribution Number of entries 100000 80000 60000 40000 20000 0 8 Source: Geoff Huston. Umar Kalim (NIIT) .

Umar Kalim (NIIT) .Examples Courtesy Nick McKeown (Stanford).

170.199. which means that we must keep the first 27 bits as is and change the remaining bits (5) to 0s.Finding the first address • What is the first address in the block if one of the addresses is 167.199.82/27? • Solution: The prefix length is 27. Umar Kalim (NIIT) . The following shows the process: Address in binary: 10100111 11000111 10101010 01010010 Keep the left 27 bits: 10100111 11000111 10101010 01000000 Result in CIDR notation: 167.64/27 Courtesy Nick McKeown (Stanford).170.

120.84.Finding the first address • What is the first address in the block if one of the addresses is 140.24/20? Courtesy Nick McKeown (Stanford). Umar Kalim (NIIT) .

minus one • OR • Set all bits that are not part of the CIDR prefix to 1 Courtesy Nick McKeown (Stanford). Umar Kalim (NIIT) .Finding the last address in the block • To the first address. add the number of addresses.

84.24/20.120. • Solution: The prefix length is 20.Example • Find the number of addresses in the block if one of the addresses is 140. Courtesy Nick McKeown (Stanford). Umar Kalim (NIIT) . The number of addresses in the block is 232−20 or 212 or 4096. Note that this is a large block with 4096 addresses.

120.120.Example 2 • Find the last address in the block if one of the addresses is 140.(0101 1111)2. set all bits that are not part of the CIDR prefix to 1 • 140.84. – Or. To find the last address.255 Courtesy Nick McKeown (Stanford). Umar Kalim (NIIT) .120.0/20 and the number of addresses is 4096. we need to add 4095 (4096 − 1) to the first address. (1111 1111)2 = 140. • Solution – We found in the previous examples that the first address is 140.95.120.80.24/20.

Sign up to vote on this title
UsefulNot useful