DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

43
DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet

Transcript of DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Page 1: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY

IP Routing and subnet

Page 2: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

TCP/IP model

Application

Transport

Internet

Network Interface

Application

Presentation

Session

Transport

Network

Data Link

Physical

Page 3: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

TCP/IP protocol suite

Page 4: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

TCP/IP Internet Layer

• Defines how to deliver data from one host to another on various physical networks:

1. Logical addressing2. Routing and routing protocol3. Main protocols: IP, ARP, RARP (Reverse Address

Resolution Protocol), ICMP (Internet Control Message Protocol) and router protocols such as RIP (Routing Information Protocol) and OSPF (Open Shortest Path First).

4. PDU (Protocol Data Unit) is packet in layer 3

Page 5: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Switching

1. Switching is redirecting according to MAC address.

2. Switching is functioning only in Ethernet. (Please recall that Data Link header is also called as Ethernet header.)

3. Switching is in layer 2 Data Link layer

4. Switching is faster than routing

5. Switch can separate collision domain.

Page 6: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Routing

• If all traffics are in the same LAN (subnet), no routing is required. The computers talk to each other over network cable directly.

• Only internetwork (between different networks), the routing is required.

• Router can divide broadcast domain.

• Router can offer stronger security protection.

• Routing table could be updated by i) network engineer manually, or ii) routing protocols dynamically.

Page 7: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Routable and routing procotol

• Routable protocol: To redirect (forward) traffic to other networks according to the routing path defined by routing protocol. Example: TCP/IP, IPX/SPX.

• Routing protocol: To dynamically define, update and distribute the best (lowest cost) routing path between networks. Example: RIP, IGRP, EIGRP, OSPF and BGP, etc, etc.

• Routing table is to contain the final information. It is possible to have multiple entries with same routing costs.

Page 8: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Routing table• is a small in-

memory database managed by the router's built-in hardware and software

• Contains destination network information

Page 9: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Example of routing table

Page 10: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

RouterRouter (pronounced /'rautər/ in the USA and Canada, pronounced /'ru:tə/ in the UK and Ireland, or either pronunciation in Australia): a networking device whose software and hardware are usually tailored to the tasks of routing and forwarding information.

To be able to route packets, a router must know, at a minimum, the following:

• Destination address• Neighbor routers from which it can learn

about remote networks• Possible routes to all remote networks• The best route to each remote network• How to maintain and verify routing

information

Page 11: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Routing process (1)

2. Router de-encapsulate packet (TTL-1)

Ethernet Header IP Packet TrailerPreamble

7 bits

SFC

1 bit

Destination

6

Source

6

Length

2

Data and Pad

46-1500

FCS

4

1. Router receive frame

Page 12: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Routing process (2)

4. Find out MAC address of destination interface by ARP

3. Router review routing table and find the right path including the next interface to which the packet needs to be sent to

5. Re-encapsulate the IP packet in a new frame with the new source and destination MAC address. In the new frame, IP address information does not have change.

6. Send out the frame from the destination interface

Page 13: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Static routing

• Routing table could be updated by i) network engineer manually, or ii) routing protocols dynamically.

• Static route is to use command manually create or update routing entries in routing table.

Pros:1. Securer (Only network engineer can modify)2. Faster (No need for any further processing or calculation)Cons• Hard to expand• Wrongly configure is hard to troubleshooting

Page 14: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Routing table fields

1. Source

2. Subnet

3. Mask

4. Out Int (Output Interface)

5. Next-Hop (forward destination)

Page 15: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

IP Route command (1) - Optional

To specify routes by output interfaces:

router>en

Router#conf t

Router(config)#ip route 10.1.10.0 255.255.255.0 s0/0

Page 16: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

IP Route command (2) - Optional

Determine next hope

router>en

Router#conf t

Router(config)#ip route 10.1.10.0 255.255.255.0 10.1.11.1

Page 17: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

IGP (Interior Gateway Protocols) /

EGP (Exterior Gateway Protocols)

Routing protocols could be divided in Interior or Exterior routing protocols.

1. IGP (Interior Gateway Protocols) works in a single Autonomous System (AS). Examples are RIP, OSPF, IGRP, EIGRP, etc, etc.

2. EGP (Exterior Gateway Protocols) works between Autonomous Systems. The only viable example is BGP (Border Gateway Protocol)

Page 18: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Route table calculation (optional)

• Each router  contains  two  lists:  Tentative  and  Confirmed• Each  list  contains  a  set  of  triples -

(Destination,  Cost,  NextHop)• Note  that  "NextHop"  is  the  first  router  on the  path  from  the  source  S  to  Destination • After calculation, each router would build up

its own list.

Page 19: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Routing updates

• Periodically update

• Declare route unusable without updates

• Remove route entry after it was not usable for sometimes.

Page 20: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

VLSM (Variable Length Subnet Mask)

• Different to traditional classful subnet mask (class A – 255.0.0.0; class B – 255.255.0.0; class C – 255.255.255.0), VLSM is to support subnet and it is classless as its network mask could be 255.255.224.0.

• Old routers only support classful routing. The network mask is not included in routing update information. New router supports VLSM and mask is a part of update information.

Page 21: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Valid network mask

Binary value Decimal value

00000000 0

10000000 128

11000000 192

11100000 224

11110000 240

11111000 248

11111100 252

11111110 254

11111111 255

Page 22: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

IP address classTraditionally, the IP address was classified in classes:Class A: network 1 – 126 with subnet mask 255.0.0.0

(Initial bit starts as 0)Class B: network 128 – 191 with subnet mask

255.255.0.0 (Initial bit starts as 10)Class C: network 192 – 223 with subnet mask

255.255.255.0 (Initial bit starts as 110)Class D: network 224 – 239 (Initial bit starts as 1110)

for multicast IP addressClass D: network 240 – 255 (Initial bit starts as 1111)

experimental useThe special network 0 and127 are not included in

those official classical IP address. 127.0.0.1 is the loopback address which is used to test TCP/IP stacks.

Page 23: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Subnet

Subnet is to logically divide your network into many sub networks.

• In the same subnet, traffic is “local” and not gateway (router) is required. Network hosts would use ARP table for the MAC address of the destination machine and send the packet to it accordingly. If it is not local, packets would be forwarded to default gateway for future routing (redirecting).

• In addition, the broadcast would be limited to the small subnets leading to less “noise” in the network traffic.

• You can also use subnet to logically specify hosts for different departments. (for security control, connection, asset management, etc, etc)

Page 24: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Power calculation of 2The powers of 2 Decimal value Binary Value

2^0 1 00000001

2^1 2 00000010

2^2 4 00000100

2^3 8 00001000

2^4 16 00010000

2^5 32 00100000

2^6 64 01000000

2^7 128 10000000

2^8 256 100000000

2^9 512 1000000000

2^10 1024 10000000000

2^11 2048 100000000000

2^12 4096 1000000000000

2^13 8192 10000000000000

Page 25: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Subnet calculation

• Network address design would decide how many subnets would be yield for the additional subnet mask.

• Or, network design needs to make sure how many hosts could be placed in each subnet.

• Based on subnet calculation, find out network address and broadcast in each subnet. (Those two IP address cannot be used by any host.)

Page 26: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Several terms

• Subnet number: The numerically lowest number in a subnet to present the IP Subnet.

• Subnet broadcast address: The numerically highest number in a subnet. If a packet is sent to this address, it would be forwarded to all hosts in the IP Subnet.

• Subnet zero (zero subnet): The numerically smallest subnet number in any subnet scheme. It has all “0” in subnet portion. With classful IP addressing, it is one of the two reserved subnets and should not be used.

• Broadcast subnet: The numerically largest subnet number in any subnet scheme. It has all “1” in subnet portion. With classful IP addressing, it is one of the two reserved subnets and should not be used.

Page 27: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Define subnet number• Subnet bits (“1”) can tell how many subnet could be produced by the

mask. The formula is 2^(number of subnet “1” bits) - 2Original classfull network mask:• Class A network has the form N.H.H.H, the default subnet mask is 8 bits

long.• Class B network has the form N.N.H.H, the default subnet mask is 16

bits long.• Class C network has the form N.N.N.H, the default subnet mask is 24

bits long.

The additional subnet bits can generate subnet. For instance, You have an IP of 156.233.0.0 with a subnet mask of 7 bits. How many hosts and subnets are possible?There is additional 7 bits to the default subnet mask. The total number of bits in subnet are 16+7 = 23. This leaves us with 32-23 =9 bits for assigning to hosts. 7 bits of subnet mask corresponds to (2^7-2)=128-2 = 126 subnets. 9 bits belonging to host addresses correspond to (2^9-2)=512-2 = 510 hosts.

Page 28: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Define host number in each subnet• Subnet bits (“0”) can tell how many host could be contained in each

subnet. The formula is 2^(number of host “0” bits) - 2Original classfull network mask:• Class A network has the form N.H.H.H, the default host mask is 24 bits

long.• Class B network has the form N.N.H.H, the default host mask is 16 bits

long.• Class C network has the form N.N.N.H, the default host mask is 8 bits

long.

The additional subnet bits can generate subnet. For instance, You have an IP of 156.233.0.0 with a subnet mask of 7 bits. How many hosts and subnets are possible?There is additional 7 bits to the default subnet mask. The total number of bits in subnet are 16+7 = 23. This leaves us with 32-23 =9 bits for assigning to hosts. 7 bits of subnet mask corresponds to (2^7-2)=128-2 = 126 subnets. 9 bits belonging to host addresses correspond to (2^9-2)=512-2 = 510 hosts.

Page 29: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Increment Number in Class C

• Increment number (magic #) is 2^(8-number_of_subnet_bits). Or, 256 – subnet mask.

For instance, You have an IP of 192.168.42.0 with a subnet mask of 3 bits. What is the increment number?Beside the traditional class C network mask 255.255.255.0. The 3 bits means that the mask is 255.255.255.224. Increment number is 256 – 224 = 32.

Or, 2^(8-3) = 32

Page 30: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Increment Number in Class B (1) optional

Class B – borrowing in the 3rd octet

156.233.0.0 Borrow 3 bits Subnet Mask = 255.255.224.0

• Number of networks created 2^3-2 = 6 (Microsoft way is 2^3=8)• Number of useable networks created 2^3 = 8 – 2 = 6

• Number of host per network 2^5 X 256 = 8192

• The increment for each network is 32 in the 3rd octet (the number of unmasked bits in the 3rd octet is 5, this is the octet we borrowed from)

• If you need to determine the network number of subnet 6, multiply 6 X 32 = 192. The subnet 6 network address would be 156.233.192.0

• If you are borrowing in the 3rd octet, just ignore the 4th octet to determine your network numbers.

Page 31: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Increment Number in Class B (2) optional Class B – borrowing all the 3rd octet 156.233.0.0 Borrow 8 bits Subnet Mask = 255.255.255.0

• Number of networks created 2^8 = 256• Number of useable networks created 2^8 - 2 = 256 – 2 = 254

• Number of host per network 2^0 X 256 = 256

• The increment for each network is 256 in the 3rd octet. (The number of unmasked bits in the 3rd octet is 0, this is the octet we borrowed from. This means that the value of the 3rd octet increases by one each time.)

• If you need to determine the network number of subnet 26, simply insert that number into the 3rd octet slot. The subnet 26 network address would be 156.233.26.0

• If you need to determine the network number of subnet 100, simply insert that number into the 3rd octet slot. The subnet 100 network address would be 156.233.100.0

Page 32: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Increment Number in Class B (3) optional

• Class B – borrowing in the 4th octet•

• 156.233.0.0 Borrow 11 bits Subnet Mask = 255.255.255.224

• Number of networks created 2^11 -2 = 2046 (or 2^3 X 256 -2 = 2048 -2 = 2046) • Number of useable networks created 2^11 -2 = 2048 – 2 = 2046• Number of host per network 2^5 = 32 • The increment for each network is 32 in the 4th octet. (The number of masked bits in the 4th octet is 3, the

number of unmasked bits in the 4th octet is 5, this is the last octet we borrowed from. This means that the value of the 4th octet increases by the increment value.)

1. If you need to determine the network number of subnet 325, do the following: • Divide the desired subnet by 2 raised to the masked bits in the 4th octet • 325 / 2^3 or 325 / 8 = 40 remainder 5• The 40 is the value of the 3rd octet -- 156.233.40.?• To find the value of the 4th octet multiply the remainder (5) times the increment (32)• 32 X 5 = 160 This is the value of the 4th octet • The subnet 325 network address would be 156.233.40.160• --------------------------------------------------------------------------------2. If you need to determine the network number of subnet 40, do the following: • Divide the desired subnet by 2 raised to the masked bits in the 4th octet • 40 / 2^3 or 40 / 8 = 5 remainder 0• The 5 is the value of the 3rd octet -- 156.233.5.?• To find the value of the 4th octet multiply the remainder (0) times the increment (32)• 32 X 0 = 0 This is the value of the 4th octet• The subnet 40 network address would be 156.233.5.0

Page 33: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Find the subnet address info

• Increment number (magic #) is 2^(8-number_of_subnet_bits). Or, 256 – subnet mask.

• The zero subnet is as same as the original classful network address

• Add increment number to the zero subnet will get 1st subnet number, adding increment number to 1st subnet will get 2nd subnet number, etc, etc,.

• Broadcast address of each subnet is the address before next subnet number.

• After define the subnet number and broadcast address in the subnet, the address range for the host will be defined in the subnet.

Page 34: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Subnet calculation example192.168.10.0/27 (255.255.255.224)2^3 – 2 = 6 subnetsIncrement number is 256-224=32

# of subnet Subnet Lowest HOST IP address

Highest HOST IP address

Broadcast address

0 192.168.10.0 192.168.10.1 192.168.10.30 192.168.10.31

1 192.168.10.32 192.168.10.33 192.168.10.62 192.168.10.63

2 192.168.10.64 192.168.10.65 192.168.10.94 192.168.10.95

3 192.168.10.96 192.168.10.97 192.168.10.126 192.168.10.127

4 192.168.10.128 192.168.10.129 192.168.10.158 192.168.10.159

5 192.168.10.160 192.168.10.161 192.168.10.190 192.168.10.191

6 192.168.10.192 192.168.10.193 192.168.10.222 192.168.10.223

Broadcast subnet

192.168.10.224 192.168.10.225 192.168.10.254 192.168.10.255

Page 35: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Boolean AND

When two bits (binary numbers) are in such logical calculation:

If both bits are 1, final result is 1. Otherwise, final result is 0.

For example, 1 + 1 = 1; 1 + 0 = 0; 0 + 1=0

0 + 0 =0

Page 36: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Find resident subnet• Convert the questioned host IP address and subnet mask

into binary. Add them together by using Boolean AND calculation. Convert binary result to decimal value and it presents the resident subnet of the host.

Which subnet is 192.168.10.100 in when subnet mask is 255.255.255.224?

1st Octet 2nd Octet 3rd Octet 4th Octet

IP address 192.168.10.100

11000000 10101000 00001010 01100100

Mark 255.255.255.224

11111111 11111111 11111111 11100000

Calculation Result 11000000 10101000 00001010 01100000

Decimal of the subnet number

192 168 10 96

Page 37: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Subnet calculation clarification

In real world, you may hear the argument of subnet calculation:

• Microsoft: Number of subnets: 2^(number-of-subnet-bits) This is the number of subnets that are created.

• Cisco: Number of subnets: 2^(number-of-subnet-bits – 2) This is the number of subnets you can use to connect devices.

Page 38: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Network address questionsWrite the subnet, broadcast address, and

valid host range for each of the following:• 1. 172.16.10.5 255.255.255.128• 2. 172.16.10.33 255.255.255.224• 3. 172.16.10.65 255.255.255.192• 4. 172.16.10.17 255.255.255.252• 5. 172.16.10.33 255.255.255.240• 6. 192.168.100.25 255.255.255.252• 7. 192.168.100.17, with 4 bits of subnetting• 8. 192.168.100.66, with 3 bits of subnetting• 9. 192.168.100.17 255.255.255.248• 10. 10.10.10.5 255.255.255.252

Page 39: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Answer of q1

1. 172.16.10.5 255.255.255.128: Subnet is 172.16.10.0, broadcast is 172.16.10.127, and valid host range is 172.16.10.1 through 126. You need to ask yourself, “Is the subnet bit in the fourth octet on or off?” If the host address has a value of less than 128 in the fourth octet, then the subnet bit must be off. If the value of the fourth octet is higher than 128, then the subnet bit must be on. In this case, the host address is 10.5, and the bit in the fourth octet must be off. The subnet must be 172.16.10.0.

Page 40: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Answer q 2 and 32. 172.16.10.33 255.255.255.224: Subnet is

172.16.10.32, broadcast is 172.16.10.63, and valid host range is 172.16.10.33 through 10.62. 256 −224 32. 32 32 64—bingo. The subnet is 10.32, and the next subnet is 10.64, so the broadcast address must be 10.63.

3. 172.16.10.65 255.255.255.192: Subnet is 172.16.10.64, broadcast is 172.16.10.127, and valid host range is 172.16.10.65 through 172.16.10.126. 256 −192 64. 64 64 128, so the network address must be 172.16.10.64, with a broadcast of 172.16.10.127.

Page 41: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Answer of Q4 -64. 172.16.10.17 255.255.255.252: Subnet is

172.16.10.16, broadcast is 172.16.10.19, and valid hosts are 172.16.10.17 and 18. 256 −252 4. 4 4 8, plus 4 12, plus 4 16, plus 4 20—bingo. The subnet is 172.16.10.16, and the broadcast must be 10.19.

5. 172.16.10.33 255.255.255.240: Subnet is 172.16.10.32, broadcast is 172.16.10.47, and valid host range is 172.16.10.33 through 46. 256 −240 16. 16 16 32, plus 16 48. Subnet is 172.16.10.32; broadcast is 172.16.10.47.

6. 192.168.100.25 255.255.255.252: Subnet is 192.168.100.24, broadcast is 192.168.100.27, and valid hosts are 192.168.100.25 and 26. 256 −252 4. 4 4 8, plus 4 12, plus 4 16, plus 4 20, plus 4 24, plus 4 28. Subnet is 100.24; broadcast is 100.27.

Page 42: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Answer of Q7-8

7. 192.168.100.17, with 4 bits of subnetting: Subnet is 192.168.100.16, broadcast is 192.168.100.31, and valid host range is 192.168.100.17 through 30. 256 −240 16. 16 16 32. Subnet is, then, 100.16, with a broadcast of 100.31 because 32 is the next subnet.

8. 192.168.100.66, with 3 bits of subnetting: Subnet is 192.168.100.64, broadcast is 192.168.100.95, and valid host range is 192.168.100.65 through 94. 256 −224 32. 32 32 64, plus 32 96. Subnet is 100.64, and broadcast is 100.95.

Page 43: DCN286 INTRODUCTION TO DATA COMMUNICATION TECHNOLOGY IP Routing and subnet.

Question

Any question?

If you do not have question, please search internet and collect more information of router and its manufacturers.

1. Please be comfortable to introduce routing protocols.

2. Please be familiar with subnet calculation.