IP ADDRESSING

Download Report

Transcript IP ADDRESSING

IP Addressing and Subnetting
Tony Madden
John Paul McCann
NEI
IP ADDRESSING
32 Bit Address
232 = 4.2 billion possible addresses
•
Decimal
192.5.5.0 Network.Network.Network.Host (N.N.N.H) (Class C Address)
•
Binary
11000000.00000101.00000101.00000000
•
Hex
C0
•
Government broken addressing system down into classes A, B, C, D, E
•
A – very large organisations (1 - 127, 00000001 - 01111111)
– Network.Host.Host.Host (N.H.H.H)
– The first bit of the Network address is reserved for ease of recognition i.e. 0 by routers
– 27 Networks (128) with 224 Nodes (16777214)
2
IP ADDRESSING
•
Government broken addressing system down into classes
•
B – large organisations
(128 - 191, 10000000 - 10111111)
– Network.Network.Host.Host (N.N.H.H)
– The two bits of the Network address are reserved for ease of recognition i.e. 10 by routers
– 214 Networks (16384) with 216 Nodes (65534)
•
C – small organisations
(192 - 223, 11000000 - 110111111)
– Network.Network.Network.Host (N.N.N.H)
– The three bits of the Network address are reserved for ease of recognition i.e. 110 by routers
– 221 Networks (2097150) with 28 Nodes (256)
3
IP ADDRESSING
NOTE:
•
Cisco state that you cannot use the first and last of any of the network or node ranges
as they are reserved for network or node addresses and broadcasts
•
Therefore:
– A = 27 – 2 = 126 Networks
224 – 2 = 16777212 Nodes
– B = 214 – 2 = 16382 Networks
216 – 2 = 65534 Nodes
– C = 221 – 2 = 2097148 Networks
28 – 2 = 254 Nodes
4
IP ADDRESSING
Internet addresses
• Assigned to us by the Network Information Centre upon application
•
•
•
A = 1 - 127*
B = 128 - 191
C = 192 - 223
Binary Chart - all binary no.s beginning with 0
Binary Chart - all binary no.s beginning with 10
Binary Chart - all binary no.s beginning with 110
»
Ref: Binary – Decimal Conversion Chart Appendix D P528 - 530
5
IP ADDRESSING AND SUBNETTING
Class C address
N.N.N.H
•
•
IP
Subnet Mask
Decimal
192. 5. 5. 0
255.255.255. 0
•
•
•
Host range 192.5.5.0 – 192.5.5.255
Cannot use 0 (0) Network address or 255 (11111111) Broadcast addresses
Usable Hosts 192.5.5.1 – 192.5.5.254
Binary
11000000.00000101.00000101.00000000
11111111.11111111.11111111.00000000
6
IP ADDRESSING AND SUBNETTING
Subnetting a Class C address N.N.N.H
• Subnet 192.5.5.0 into 2 subnets
192.5.5.0
•
Borrow 2 bits from the Host part of the IP address (N.N.N.H
11000000.00000101.00000101.00000000)
•
This now gives you a network address that is now 26 bits long and leaves 6 bits to
assign to node addresses.
•
You can borrow a minimum of 2 bits and a maximum of 6 bits from a class C IP
address
7
IP ADDRESSING AND SUBNETTING
Borrow 2 bits (subnetting into 2 subnetworks)
• (remember that you cannot use the first or last as they refer to the network address and the
broadcast address) 22 – 2 = 2
• There are in fact 4 subnet address, but only 2 of them are usable
• BINARY to DECIMAL
–
–
–
–
•
•
00
01
10
11
cannot use
64
128
cannot use
New Network address are 192.5.5.64 and 192.5.5.128
The Subnet Mask also changes
– To do this you must add the binary value of two bits borrowed (11000000 = 192)
– The new Subnet Mask is 255.255.255.192
•
•
•
IP Address
192.5.5.64
192.5.5.128
Subnet Mask
255.255.255.192
255.255.255.192
Range of Hosts
65 – 127
129 – 191
No. of Hosts
62
62
8
IP ADDRESSING AND SUBNETTING
Borrow 3 bits (subnetting into 4 subnetworks)
• 23 – 2 = 6
• There are in fact 8 subnet address, but only 6 of them are usable
• BINARY to DECIMAL
– 000
Cannot use
– 001
32
– 010
64
– 011
96
– 100
128
– 101
160
– 110
192
– 111
Cannot use
• New address 192.5.5.32, 192.5.5.64, 192.5.5.96, 192.5.5.128, 192.5.5.160,
192.5.5192.
• The Subnet Mask also changes
– To do this you must add the binary value of two bits borrowed (11100000 = 224)
– The new Subnet Mask is 255.255.255.224
9
IP ADDRESSING AND SUBNETTING
•
•
•
•
•
•
•
IP Address
192.5.5.32
192.5.5.64
192.5.5.96
192.5.5.128
192.5.5.160
192.5.5.192
Subnet Mask
255.255.255.224
255.255.255. 224
255.255.255. 224
255.255.255. 224
255.255.255. 224
255.255.255. 224
Range of Hosts
33 - 63
65 – 95
97 - 127
129 – 159
161 - 191
193 – 223
No. of Hosts
30
30
30
30
30
30
10
SUBNET MASKS
Why do you need a subnet mask?
Hosts and routers use the ANDing process to determine if a destination host is on the
same network or not. The ANDing operation happens any time a host wants to send a
packet to another host on an IP network.
The result of the 1st AND is to identify the network where the source host resides. It will
then compare the destination IP address to its own subnet mask (2nd AND) to
determine the network address of the destination host.
11
SUBNET MASKS
Host x (Source) on network 200.1.1.0 (Class C Network) has an IP address of 200.1.1.5 and
wants to send a packet to Host Z (Destination) on network 200.1.2.0 and has an IP
address of 200.1.2.8. All hosts on each network are connected to hubs or switches and
then to a router (Remember that with a class C network, ARIN assigns the first 3 octets (24
bits) as the network address, so these are two different networks.
•
•
•
Source Net
Subnet Mask
Host IP
200.1.1.0
255.255.255.0
200.1.1.5
Dest. Net
Subnet Mask
Host
200.1.2.0
255.255.255.0
200.1.2.8
12
SUBNET MASKS
•
Host X compares it’s own IP address to its own subnet mask using the ANDing process
•
•
•
•
Host X IP
200.1.1.5
11001000.00000001.00000001.00000101
Subnet Mask
255.255.255.0
11111111.11111111.11111111.00000000
ANDing result
11001000.00000001.00000001.00000000
The result of the 3rd step gives the network address 200.1.1.0
•
Next Host X compares the IP address of the Host Z dest. to its own subnet mask using the
ANDing process
•
•
•
•
Host Z IP
200.1.2.8
11001000.00000001.00000010.00001000
Subnet Mask
255.255.255.0
11111111.11111111.11111111.00000000
ANDing result
11001000.00000001.00000010.00000000
The result of the 3rd step gives the network address 200.1.2.0
13
SUBNET MASKS
Host X now knows that host Z is not in its Local Area Network (LAN) and it must send the
packet to its “Default Gateway” which is the IP address of the router interface of 200.1.1.1
on network 200.1.1.0. The router will then repeat the ANDing process to determine which
router interface to send the packet out.
Source Net 200.1.1.0
Dest Net 200.1.2.0
Subnet Mask 255.255.255.0
Host X
Subnet Mask 255.255.255.0
Router
Hub
Hub
Host Z
Host IP 200.1.2.8
Host IP 200.1.1.5
Router Interface
Router Interface
IP 200.1.1.1
IP 200.1.2.1
14