1 of 23

IP Addresses and Subnetting

NET 150

2 of 23

Network Addressing

Remember- Most modern network have two types of addresses

  • MAC Addresses:
    • Layer 2
    • ”burned” into the NIC
    • Used by NIC to “pick up” packets addressed to it
  • IP Addresses
    • Layer 3
    • Assigned by Network Admin
    • It is the “Street address and Zipcode” that uniquely identifies a host on the network

3 of 23

IP Address

  • 32-bit number – just a string of 32 1’s and 0’s

  • Typically displayed as four 8-bit numbers with dots in between
    • called dotted decimal notation
    • Each 8-bit number is called an octet

Computer sees:

10000001101010100001001011011100

We interpret as dotted decimal:

129.170.18.220

4 of 23

IP Place Values

  • Learning the first 8 place values in Binary can help

  • The highest value in an octet is 255

  • Looking at the place values, all 1’s in the 8 bits is
    • 128+64+32+16+8+4+2+1 = 255
  • 35 in Binary:

5 of 23

Network Addressing: IP Address

  • IP Address includes both the Network ID (zip code) and Host ID (street address)
  • Net ID is always at the beginning of the address
  • Tricky bit:
    • IP address is always 32 bits but…
    • Net ID can be different lengths – anywhere from 8 to 30 bits.
    • Host ID is whatever is left over
    • Subnet Mask – defines how many bits are in the Net ID

6 of 23

Network Addressing: IP Address (3)

  • Example:

Binary IP Address:

10000001101010100001001011011100

Translated to dotted decimal:

129.170.18.220

Subnet mask is /24

Means first 24 bits are Network ID

So,

Network ID is 129.170.18

Host ID is 220

7 of 23

Subnet Mask

The subnet mask uses 1 and 0 bits to indicate that the corresponding bit of the IP address is either the:

  • network (1) or
  • the host (0) portion.

Dotted Decimal

Binary Octets

Host

172.16.4.35

10101100

00010000

00000100

00100011

Mask

255.255.255.0

11111111

11111111

11111111

00000000

IP Address: 172.16.4.35 / 24

8 of 23

Subnet Mask

  • Basically, a Subnet Mask indicates how many bits are used for the Network and how many for the Host

  • Orange: Octets contain part of Net ID and Part of Host ID

11111111.11111111.11111111.00000000

/24

255.255.255.0

24 bits for Net ID, 8 Bits for Host ID

11111111.11111111.11111100.00000000

/22

255.255.252.0

22 bits for Net ID, 10 Bits for Host ID

11111111.11111111.11111111.11000000

/26

255.255.255.192

26 bits for Net ID, 6 Bits for Host ID

9 of 23

Subnet Mask

Subnet Mask Values Within an Octet

Mask (Decimal)

Mask (Binary)

Network Bits

Host Bits

0

00000000

0

8

128

10000000

1

7

192

11000000

2

6

224

11100000

3

5

240

11110000

4

4

248

11111000

5

3

252

11111100

6

2

254

11111110

7

1

255

11111111

8

0

10 of 23

Network Prefixes

  • Prefix Mask (aka CIDR Notation):
      • The address is followed by a number that represents the number of bits (prefix length), beginning from the left, that apply to the network.
      • A slash (/) is used to separate the address and the prefix length.

192.168.10.2/24��Means that the first 24 bits are the network portion.�The last 8 bits are the host portion.

11 of 23

Subnet Mask

IP Address: 10.24.36.2 / 8 Subnet Mask?

IP Address: 10.24.36.2 / 12 Subnet Mask?

IP Address: 10.24.36.2 / 16 Subnet Mask?

IP Address: 10.24.36.2 / 23 Subnet Mask?

IP Address: 10.24.36.2 255.255.224.0 Prefix Mask?

IP Address: 10.24.36.2 255.255.255.192 Prefix Mask?

IP Address: 10.24.36.2 255.255.255.252 Prefix Mask?

IP Address: 10.24.36.2 255.254.0.0 Prefix Mask?

IP Address: 10.24.36.2 255.255.240.0 Prefix Mask?

12 of 23

Subnetting

Organizations are “assigned” a network address to use on the Internet

    • aka their zipcode

  • For example, Champlain College:

  • 216.93.144.0/20 (or 255.255.240.0)

  • This means that all Champlain IP’s have to start with the same 20 bits

13 of 23

Champlain Network Assignment

  • 216.93.144.0/20 assigned to Champlain

  • Green is NetID, Red is Host ID
  • All of our system’s IP addresses have to use the same first 20 bits
  • For Hosts – we can use the remaining 12 however we want!

Decimal

216

93

144

0

Binary

1101 1000

0101 1101

1001 0000

0000 0000

Subnet Mask

1111 1111

1111 1111

1111 0000

0000 0000

14 of 23

Subnetting

  • However, most organizations need more than one “network”

  • As we have learnt, there are limits to how many hosts can be on a network because too many will cause broadcast issues.

  • Therefore, organizations can use some of their host bits to create new networks

15 of 23

Champlain Network Assignment

  • Remember: Champlain can’t change first 20,
  • but changing mask to /24 can take some more bits from the host to make more networks

  • Green: Original Net ID
  • Orange: New bits for Net ID
  • Red: Host ID

Decimal

216

93

144

0

Binary

1101 1000

0101 1101

1001 0000

0000 0000

Subnet Mask

1111 1111

1111 1111

1111 1111

0000 0000

/24

16 of 23

Champlain Network Assignment

  • With /24 (or 255.255.255.0) as the mask, each of these are now different networks
    • 216.93.144.0/24
    • 216.93.145.0/24
    • 216.93.146.0/24
    • 216.93.159.0/24

17 of 23

Rules about IP Addresses

  • All 0’s in the Host ID refers to the Network itself – cannot be assigned to a host

  • All 1’s in the Host ID is the broadcast – cannot be assigned to a host

18 of 23

Subnet Table: �How many Host IPs can be assigned

MASK

CIDR/

Net Bits

Host Bits

# 0f IP’s

Total IPs

IPs usable for Hosts

255.255.240.0

/20

12

212

4096

4094

255.255.248.0

/21

11

211

2048

2046

255.255.252.0

/22

10

210

1024

1022

255.255.254.0

/23

9

29

512

510

255.255.255.0

/24

8

28

256

254

255.255.255.128

/25

7

27

128

126

255.255.255.192

/26

6

26

64

62

255.255.255.224

/27

5

25

32

30

255.255.255.240

/28

4

24

16

14

255.255.255.248

/29

3

23

8

6

255.255.255.252

/30

2

22

4

2

19 of 23

Private and Reserved IP Ranges

Private Ranges not routable on Internet

  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/24

Reserved Ranges

  • 127.0.0.0/8 Loopback
  • 169.254.0.0/16 Link-Local Host Only
  • 224.0.0.0/4 Multicast

20 of 23

Subnetting Example

21 of 23

Review Subnet Table

MASK

Net Bits

Host Bits

# 0f IP’s

Total IPs

IPs usable for Hosts

255.255.240.0

/20

12

212

4096

4094

255.255.248.0

/21

11

211

2048

2046

255.255.252.0

/22

10

210

1024

1022

255.255.254.0

/23

9

29

512

510

255.255.255.0

/24

8

28

256

254

Four Networks:

  • Central Campus: 1,000 Hosts
  • West Campus: 500 Hosts
  • East Campus: 500 Hosts
  • Wireless Network: 1,600 Hosts

So, Four Networks:

  • Central Campus: 1,000 Hosts can use /22 (or 255.255.252.0)
  • West Campus: 500 Hosts can use /23 (or 255.255.254.0)
  • East Campus: 500 Hosts can use /23 (or 255.255.254.0)
  • Wireless Network: 1,600 Hosts can use /21 (or 255.255.248.0)

22 of 23

Example Subnet Assignments

1st Octet

2nd Octet

3rd Octet

4th Octet

Assigned Net

153

104

0

0

Binary

1101 1000

0101 1101

0000 0000

0000 0000

Subnet Mask

1111 1111

1111 1111

0000 0000

0000 0000

/16

Wireless Net

153

104

8

0

Binary

1101 1000

0101 1101

0000 1000

0000 0000

Subnet Mask

1111 1111

1111 1111

1111 1000

0000 0000

/21

Central Campus

153

104

28

0

Binary

1101 1000

0101 1101

0001 1100

0000 0000

Subnet Mask

1111 1111

1111 1111

1111 1100

0000 0000

/22

West Campus

153

104

58

0

Binary

1101 1000

0101 1101

0011 1010

0000 0000

Subnet Mask

1111 1111

1111 1111

1111 1110

0000 0000

/23

East Campus

153

104

60

0

Binary

1101 1000

0101 1101

0011 1100

0000 0000

Subnet Mask

1111 1111

1111 1111

1111 1110

0000 0000

/23

Green: Net Bits

Purple: Subnet Bits

Red: Host bits

23 of 23

Subnet Example