IP Addressing & Network Address
Translation_2
Iheanetu, O.U.
Lecture 12
Class Work 1
1. List the classful address scheme
2. List the classless address scheme Convert to
Decimal dotted IP address
3. 11000000 10101000 01100100 00000001
4. 11100000 11100000 10001000 00011000
▪ Convert to Binary IP Address
5. 324.234.100.62
6. 100.124.45.55 2
Less Chaos!!!
3
4
Diagram of Subnet Masks of Class A, B & C
5
Subnetting
6
7
Subnetting
• A strategy used to partition a single physical network into
more than one logical sub- networks (Subnet)
• Designed by taking bits from the hostID and using these bits
to assign several other smaller subnets within the original
network
• Originally designed for solving the problem of shortage of
IP addresses over the internet
8
• Basically, IP addresses are grouped into two
hierarchies: netid and hostid.
▪ To locate a host on the Internet, the network is first
located using netid after which the host is traced.
• However, the entire network may be subdivided into
smaller networks (subnets). This process is called
subnetting.
9
Subnet Picture
10
Masking
▪ Masking is the process of extracting the address of the physical
network from the given IP address.
▪ Thus, with masking, the IP address can be extracted from both
sub-netted and unsub-netted networks.
▪ (a) Masks without sub-netting
11
Masking
(b) Masks with Subnetting
A subnet mask reveals how many bits in the IP addresses are used by the
network by masking the network portion of the IP address
Subnetting is done by changing the default subnets mask by
borrowing some bits from the host portion
1
NOTE
1. In packets routing, the router outside the organization routes
based on default mask, while the router within the organization
routes based on the subnet mask
▪ Devices in the same subnet separated by a router cannot
communicate
▪ Devices in the same subnet must be in the same IP network,
otherwise they cannot communicate
2. Identifying the netid of any IP address is a function of the mask.
▪ The byte(s) corresponding to the octets with 255 in the mask are
retained while the zeros in the mask are added.
3. For other bytes in the mask other than 255, the bit-wise
AND operator is used.
1
14
CIDR Concept
• Classless Inter Domain Routing
• Designed for keeping the internet from running out
of IP address
• Classful address schemes (Classes A,B & C) of
allocating addresses in 8-bit increments is wasteful
▪ Claa A – 16 million
▪ Class B – 65 thousand
▪ Class C - 256
15
▪ In CIDR is allocated in 1-bit increment as against 8-bit increment
▪ Use of CIDR noted addresses can be used to represent classful
address
▪ Class A/8
▪ Class B/16
▪ Class C/24
▪ Number next to the slash represents the number of bits assigned to
the network address
• Network ID - 192.168.1.0/24
• CIDR – 24
▪ 24 bits are ‘turned on’ in the subnet (have value=1)
▪ 11111111.11111111.11111111.00000000
▪ Subnet - 255.255.255.255.0
1
17
▪ Subnet – 255.255.248.0
▪ What is the CIDR?
▪ 128 64 32 16 8 4 2 1
▪ 248 = 128 + 64 + 32 + 16 + 8 =248
▪ = 5 bits
▪ 16 + 5 = 21
▪ CIDR = 21
18
Note These
▪ No of Networks = 2n
▪ n = No of bits taken from Host bits
▪ No of IP address in Network = 2n
▪ n = No of host bits
▪ No of Hosts (No. of Assignable IP address) = 2n -2
▪ n = No of host bits
▪ Broadcast address = IP address used for broadcast in the network or subnet
▪ 1st IP Address = NetID, Last IP Address = Broadcast ID
▪ CIDR = No of bits used for NetID
▪ NetID = IP address of the network part
▪ Host ID = IP Address of the Host part
▪ Subnet ID = IP address of the SubnetID
19
Class Work 2
• How do you figure out NetID given IP address and subnet
address???
• Example 1
• IP Address - 192.168.40.55
• Subnet – 255.255.248.0/21
• What is the NetID?
20
More Examples
1. 255.255.255.192
▪ What is the CIDR?
▪ What is the NetID?
(a) IP address = 192.168.45.55 and Subnet
255.255.255.192
(b) IP address = 202.10.133.11 and Subnet =
255.255.255.0
1. CIDR – 26 = 24 +2 = 26 (Use octet chart)
2a. IP = 192.168.45.55
• Subnet = 255.255.255.192 → All 1s. Use all for the netID
• 4th octet = 55 = 00 110 111
• Masked bits = 11 000 000 (192 in binary)
▪ Masked bits tell us that the bits are part of the netID = 1100000 = 128 +
64= 192
• Net ID = 192.168.45.0/26
• subnet= 255.255.255.192
• = 62 available host address (26 - 2 = 62)
▪ (2 bits reserved. 1 for broadcast = 63 → 192.168.45. 63. and 1 reserved for
the router)
2
22
Class Work 3
▪ IP Address - 210.150.7.80 Subnet - 255.255.255.192
▪ 192 = 1 1000000
▪ 80 = 0 1100000
▪ 01000000 = 64
▪ Bit-wise AND
▪ Netid = 210.150.7.64
23
Class Work 4
• IP Address - 192.168.45.55
• Subnet – 255.255.248.0/21
• What is the NetID?
24
• 255.255 All 1s. Use all for the netID
• 3rd octet = 45 = 00101 101
• Masked bits = 11111 000
▪ Masked bits tell us that the bits are part of the netID = 00101
= 32 + 8 = 40
• Net ID = 192.168.40.0/21
• subnet= 255.255.248.0
• No of Hosts = (23 + 28 )-2 = 211-2
▪ • = 2048 – 2 = 2046
25
▪ Find the
▪ (i) Net ID (ii) No of Networks (iii) No of Hosts
▪ (iv) No of IP addresses (v) Broadcast address
▪ (vi) SubnetID of the following
a. 192.168. 10.0/27
b. 192.168.10.0/26
c. 192.168.10.0/25
d. 192.168.10.0/28
e. 192.168.10.0/29
f. Find the C ID R
26
▪ 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 & last address in the block
▪ 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.
27
Solution
1a. 11001101 00010000 00100101 00100 I 11
▪ set 32 - 28 rightmost bits to 0, = 11001101
▪ 000100000100101 0010000 = 205.16.37.32. (or AND)
1b. Last Address = set the 32 - n right most bits in the binary notation
of the address to Is(or OR the mask complement)
2. See Solution on Page 562 of Text
VLSM
• Variable Length Subnet Mask
• Process of subnetting a subnet
• Subnet uses more than one mask in the same
network
• Helps to increase the usability of subnets as they
can be of variable lengths
2
29
Benefits of VLSM
• Provides flexibility that reduces number of wasted IP
addresses in a subnet
• By reducing IP wastage, more IPs are available to allocate to
other subnets
• Helpful to both public and private networks
30
Scenario
▪ Xamper has 4 departments to manage
▪ Sales & Purchase dept – 120 PCs,
▪ Development dept – 50 PCs,
▪ Accounts dept – 26 PCs,
▪ Management dept – 5 PCs
▪ Admin has IP – 192.168.1.0/24,
▪ IPs for each dept can be allocated by:
Select the block size that is >= the actual
requirement. Make a list of possible subnets
Slash Notation Hosts. Subnets
/24 256
/25 126
/26 62
/27 30
/28 14
/29 6
/30 2
3
32
▪ Arrange all segments in descending order based on the block size
order
▪ Sales and Purchase – 120
▪ Development dept – 50
▪ Accounts dept – 26
▪ Management dept – 5
33
▪ The highest IP available must be allocated to the dept with the
highest need
▪ Sales dept gets 192.168.1.0/25 = 126 addresses which caters for
120 PCs
▪ Subnet mask used = 255.255.255.128
34
▪ The next highest IP available must be allocated to the next dept
with the highest need
▪ Development dept gets 192.168.1.128/26 = 62 host addresses
which caters for 50 PCs
▪ Subnet mask used = 255.255.255.192
35
• Subnet IP 192.168.1.192/27 can fulfil the Accounts dept
need for 26 PCs as it has 30 available host addresses
• Subnet mask used = 255.255.255.224
• Subnet IP 192.168.1.224/29 can fulfil the Management dept
need for 5 PCs as it has 6 available host addresses
▪ Note 192.168.1.224/28 offers 14 host addresses which is
way beyond the requirements of Mgt dept
• Subnet mask used = 255.255.255.248
Broadcast ID for IP classes
• Class A
▪ IP – 192. 0.0.0
▪ Broadcast Address – 192. 255.255.255
• Class B
▪ IP – 190. 168.0.0
▪ Broadcast Address – 192. 168.255.255
• Class C
▪ IP – 190. 168.16.0
▪ Broadcast Address – 192. 168.16.255
3
37
IPV4 & IPV6 ADDRESSES
▪ IPv4 supports a maximum of approximately
▪ 4.3 billion unique IP addresses which are all used up
▪ IPv6 supports 340 undecillion, which is 340 trillion addresses
(a maximum number that will never b e depleted)
▪ Global adoption of IPv6 is about 34%
38
• IPv6 is the most recent version of Internet Protocol
(IP). It's designed to supply IP addressing and
additional security to support the predicted growth
of connected devices in IoT
▪ Consists of 8 groups of 4 hexadecimal digits (128 bits)
▪ A group of 4 zeros can be shortened using colon
▪ ‘:’ to replace the zeros
▪ Networks implement IPv6 concurrently with IPv4 in a
dual-stack design, while newer networks deploy IPv6
natively but still allow for compatibility with IPv4 if
needed.
39
▪ IPv6 is the named successor of IPV4 for the
following reasons:
▪ The five classes scheme and the two hierarchy structure
(netid and hostid) are grossly inadequate.
▪ Lack of adequate security measures for
encryption and authentication.
▪ Lack of adequate provisions for real-time audio and
video transmissions with reduced delays
40
▪ What Happened to IPv5??
IPv5
• IPv5 was also known as Internet Stream Protocol (ST)
• Designed for connection-oriented communications
across IP networks for voice and video support.
• Was used experimentally but was never publicly
adopted.
• Shared IPv4 problem – a limited number of possible IP
addresses. That led to the development and eventual
adoption of IPv6.
▪ But the name IPv5 had been used up.
4
Example ofIPv6 Address
• 2001:0db8:85a3:0000:0000:8a2e:0370:7334
• IP address is split into two 64 bit segments
• First 64 bits = NetID (For routing)
• Second 64 bits = HostID
4
43
• First 64 bits is split into 2 (48 bits and 16 bits
respectively)
▪ 48 bits are used for the global network addresses and routing
▪ 16 bits are used for subnets on an internal networks
IPv6 Address Types
• Global
• Internal Addresses
▪ Link Local
▪ Unique Local
4
Benefits of IPv6
• Handling of packets is more efficiently
• Improves performance
• Increase security
• Enables internet service providers to reduce the size of their
routing tables by making them more hierarchical.
4
IPv6 Features
• No Broadcasts, rather multicast. This means some protocols like
ARP are replaced with other solutions.
• Stateless Autoconfiguration (mini DHCP server): Routers running
IPv6 are able to advertise the IPv6 prefix and gateway address to hosts
so that they can automatically configure themselves and get access
outside of their own network.
• Address Renumbering: renumbering static IPv4 addresses on your
network is a pain.
▪ With stateless autoconfiguration for IPv6 you can easily swap the current
prefix with another one.
• Mobility: IPv6 has built-in support for mobile devices.
▪ Hosts will be able to move from one network to another and keep their
current IPv6 address.
4
IPv6 Features Cont’d
• No NAT / PAT (Port Address Translation): IPv6 assignable addresses are so
much that there is no need for NAT or PAT.
▪ Every device in your network can have a public IPv6 address.
• IP Security: IPv6 has native support for IP security built-in the protocol.
• Improved header: the IPv6 header is simpler and doesn’t require
checksums. It also has a flow label that is used to quickly see if certain
packets belong to the same flow or not.
• Migration Tools: IPv4 and IPv6 are not compatible so migration tools are
needed.
▪ There are multiple tunneling techniques that can be used to transport IPv6 over IPv4
networks (or the other way around).
▪ Running IPv4 and IPv6 simultaneously is called “dual stack”.
4
48
Review Questions
▪ What is the importance of addressing in networking?
▪ Distinguish between Datalink and Network addresses.
▪ Present briefly, the classes of IP Addresses stating the netid and the default subnet mask of each
of them.
▪ Explain the following terms as they apply to networking:
a. NAT (b) Sub-netting (c) Masking Compare and contrast IPV4 and IPV6
Addresses.
▪ Find the netids and hostids for the following IP addresses:
i. 120.125.77.100
ii. 93.130.10.70
iii. 222.16.107.110
Take-home Assignment 1
• Differentiate between a broadcast and multicast
• What solutions are used in place of ARPs?
• IPv6 assignable addresses are so much that there is
no need for NAT or PAT. Explain this statement
• What do you understand by
▪ “Dual stack”?
▪ Tunneling