2. - people

advertisement

DCN286 INTRODUCTION TO DATA

COMMUNICATION TECHNOLOGY

IP Routing and subnet

Application

TCP/IP model

Transport

Internet

Network Interface

Application

Presentation

Session

Transport

Network

Data Link

Physical

TCP/IP protocol suite

TCP/IP Internet Layer

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

1. Logical addressing

2. Routing and routing protocol

3. 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

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.

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.

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.

Routing table

• is a small inmemory database managed by the router's built-in hardware and software

• Contains destination network information

Example of routing table

Router

Router (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

Routing process (1)

1. Router receive frame

Preamble

7 bits

Ethernet Header

SFC Destination

1 bit 6

Source

6

Length

2

IP Packet Trailer

Data and

Pad

46-1500

FCS

4

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

Routing process (2)

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

4. Find out MAC address of destination interface by ARP

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

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

Routing table fields

1. Source

2. Subnet

3. Mask

4. Out Int (Output Interface)

5. Next-Hop (forward destination)

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

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

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)

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.

Routing updates

• Periodically update

• Declare route unusable without updates

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

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.

Valid network mask

Binary value

00000000

10000000

11000000

11100000

11110000

11111000

11111100

11111110

11111111

Decimal value

0

128

192

224

240

248

252

254

255

IP address class

Traditionally, 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 address

Class D: network 240 – 255 (Initial bit starts as 1111) experimental use

The 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.

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)

2^3

2^4

2^5

2^6

2^7

The powers of 2

2^0

2^1

2^2

2^8

2^9

2^10

2^11

2^12

2^13

Power calculation of 2

8

16

32

64

128

2

4

Decimal value

1

256

512

1024

2048

4096

8192

Binary Value

00000001

00000010

00000100

00001000

00010000

00100000

01000000

10000000

100000000

1000000000

10000000000

100000000000

1000000000000

10000000000000

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.)

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.

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) - 2

Original 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.

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) - 2

Original 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.

Increment Number in Class C

• Increment number (magic #) is 2^(8number_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

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 4 th octet to determine your network numbers.

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

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

Find the subnet address info

• Increment number (magic #) is 2^(8number_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

1 st subnet number, adding increment number to

1 st 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.

Subnet calculation example

192.168.10.0/27 (255.255.255.224)

2^3 – 2 = 6 subnets

Increment number is 256-224=32

4

5

0

1

2

# of subnet Subnet Lowest HOST IP address

192.168.10.0

192.168.10.1

192.168.10.32

192.168.10.33

192.168.10.64

192.168.10.65

3

6

Broadcast subnet

Highest HOST IP address

192.168.10.30

192.168.10.62

192.168.10.94

Broadcast address

192.168.10.31

192.168.10.63

192.168.10.95

192.168.10.96

192.168.10.97

192.168.10.126

192.168.10.127

192.168.10.128

192.168.10.129

192.168.10.158

192.168.10.159

192.168.10.160

192.168.10.161

192.168.10.190

192.168.10.191

192.168.10.192

192.168.10.193

192.168.10.222

192.168.10.223

192.168.10.224

192.168.10.225

192.168.10.254

192.168.10.255

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

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?

1 st Octet 2 nd Octet 3 rd Octet

IP address

192.168.10.100

Mark

255.255.255.224

11000000

11111111

10101000

11111111

00001010

11111111

Calculation Result 11000000 10101000 00001010

Decimal of the subnet number

192 168 10

4 th Octet

01100100

11100000

01100000

96

Subnet calculation clarification

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

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

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

Network address questions

W rite 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

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.

Answer q 2 and 3

2. 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.

Answer of Q4 -6

4. 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.

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.

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.

Download