You are on page 1of 42

Introduction to Routing and

Switching Network
Nguyn Quc nh

Faculty of IT, Ho Chi Minh City University of Industry


Dec 2013

Part 1
Introduction

What is this course?

Look deeper into switching network

Questions

Where do my packets go?

Do they go thru shortest way?

What if my routers/switches go down?

Learn to play around with Cisco routers (and


switches) via GNS3
3

Instructor

Nguyn Quc nh nqdinh@hui.edu.vn

My site https://sites.google.com/site/nqdinhddt :

Lecture notes, update information. Check it out.

Course Schedule (lecture)


1.

Introduction (this)

2.

Router design

3.

Distance vector routing and RIP

4.

Link state routing and OSPF

5.

Border gateway protocol

6.

Switching network and Spanning Tree Protocol

7.

Virtual LAN

8.

Multicast

9.

Virtual Circuit
5

Course Schedule (lab)


1. Starting with GNS3
2. Static routing
3. RIP(v2, ng)
4. OSPF
5. VLAN
6. VLAN and RIP/OSPF
7. MPLS
8. Review
6

News

# 1:

You are not required to go to class

big problems (simulation) for teams

# 2:

the lab will go fast

Connecting Devices

Quick Review Layer

TCP/IP protocol suite

Sort of Connecting Devices

10

Repeater

A repeater connects segments of LAN together

A repeater has no filtering function.

Operate in PHY layer, it forwards every packet


11

Hub or Multiport-repeater

12

Bridge/Lan Switch

13

Bridge/Lan Switch

A bridge operates in PHY and Data link layer;


thus more complex than repeater or hub.

A bridge connects segments of LAN together

Terms:

Bridge was coined in the early 1980s

Nowadays, term LAN switch is used instead.

Ethernet switch is used in the context of Ethernet


14

Ethernet Hubs vs. Ethernet Switches

Ethernet hubs

Ethernet switches

15

Router

Operate up to layer 3

Interconnect IP network

Router edit IP packet it forwards

16

Router and Bridge

An enterprise network (e.g., university network) with a


large number of local area networks (LANs) can use
routers or bridges

1980s: LANs interconnection via bridges

Late 1980s and early 1990s: increasingly use of routers

Since mid1990s: LAN switches replace most routers

17

Router vs Bridge
Routers

Each hosts IP address


must be configured
If network is reconfigured,
IP addresses may need to
be reassigned

Bridges

Routing done via RIP or


OSPF
Each router manipulates
packet header (e.g.,
reduces TTL field)

MAC addresses are


hardwired
No network configuration
needed
No routing protocol
needed (sort of)

learning bridge algorithm

spanning tree algorithm

Bridges do not manipulate


frames
18

Q: What is the major difference between a switch


and a router?

A switch is a physicallayer device, whereas a


router is a link layer device.

A switch is more complex than a router.

A switch is a linklayer device, whereas a router is


a network layer device.

A switch can look at the contents of a packet


passing through it, while a router can not.

19

Addresses in Sending Packets

20

Hey, There are 2 Addresses


MAC address: 00:20:af:03:98:28

IP (network) address: 128.143.71.21

Why two addresses?


128.143.71.21
00:20:af:03:98:28

21

Why 2 Addresses

We wanna keep data link layer and network layer


independent so that

Data link layer could work with other network layer besides
IP

IP could run on any data link layer (Ethernet, FDDI, ATM)


which may have different addresses

We want efficiency.

Hardware must have an address. Why?

Hardware address should not originate from network


address. Why?

Actually, each HTTP message contains 3 addresses


inside.
22

Send a packet from


128.143.71.21 is not on my local network.
T Therefore,
to Neon
To
I need to send the packet to my
default
gateway withisaddress
128.143.137.1
128.143.71.21
on my local
network.
DNS:
DNS:
The is
IPisthe
address
address
ofaddress
Therefore, I can send the packet directly.
ARP:What
What
theIPMAC
ofneon.tcpip-lab.edu
neon.tcpip-lab.edu?
is
of
128.143.137.1?
ARP:
The MAC address of
128.143.71.21
128.143.137.1 is 00:e0:f9:23:a8:20

frame

ARP: What is the MAC address


ofARP:
128.143.71.21?
The MAC address of
128.143.137.1 is 00:20:af:03:98:28

frame

23

ARP role?

Sending to host on the same subnet = direct


forwarding

Does not use a router

Direct connection between 2 routers

Require the knowledge of the MAC address on a LAN

The ARP and RARP protocols perform the translation


between IP addresses and MAC layer addresses
IP address
(32 bit)

ARP
RARP

Ethernet MAC
Address
(48 bit)
24

Example
ARP Request from T:

Source hardware address: 00:a0:24:71:e4:44

Source protocol address:

128.143.137.144

Target hardware address:

00:00:00:00:00:00

Target protocol address:

128.143.137.1

ARP Reply from Router137:

Source hardware address: 00:e0:f9:23:a8:20

Source protocol address:

128.143.137.1

Target hardware address:

00:a0:24:71:e4:44

Target protocol address:

128.143.137.144
25

Test your understanding

Q1: What are the MAC and IP addresses at points 1 and 2 for
packets sent by M1 or M4 to M3 (Mx = mac address)
Q2: What must the router do when it receives a packet to M2 for the
first time?

26

TCP/IP layers in example

t.hui.edu.vn router71.hui.edu.vn
128.143.137.144 128.143.137.1
00:e0:f9:23:a8:20

router137.hui.
edu.vn
128.143.71.1

to.hui.edu.vn
128.143.71.21
27

TCP/IP layers in example


Send HTTP Request to
To

Frame is an IP
datagram

Establish a connection to 128.143.71.21 at port


80
Open TCP connection to
128.143.71.21 port 80
IP datagram is a TCP
segment for port 80
Send IP adata-gram
to
Send a datagram (which contains
connection
Send
IP datagram 128.143.71.21
to
request)
to 128.143.71.21
128.143.71.21
Frame is an IP
Send the datagram to 128.143.137.1 datagram

Send Ethernet frame to


t.hui.edu.vn
00:e0:f9:23:a8:20
router71.hui.edu.vn

128.143.137.144

128.143.137.1
00:e0:f9:23:a8:20

Send the datagram


to 128.143.7.21

Send Ethernet frame to


00:20:af:03:98:28 to.hui.edu.vn
router137.hui.

edu.vn
128.143.71.1

128.143.71.21
28

IP addresses

You know it already: x.x.x.x

Theoretically, up to 232 4 billion hosts

Practically, about 768 millions (Jul 2010, ISC


Survey), still huge!
Routing table with 768M entries? No no.

29

Hierarchical Addressing

The network prefix identifies a network and the host


number identifies a specific host (actually, interface
on the network).
network prefix

host number

How do we know how long the network prefix is?

Before 1993: The network prefix is implicitly defined

After 1993: The network prefix is indicated by a


netmask.
30

Hierarchical Addressing

Each network assigned a prefix


Foreign routers routing tables only need an entry for
the entire network

The entry points to the networks gateway(s)

31

Scalability Improved

Routing tables are smaller (but still too big)

No need to update the routers when new host added

E.g., adding a new host 5.6.7.213 on the right

Doesnt require adding a new forwarding-table entry

32

Classful IP addresses old guy

network prefix = Netid

host number = Hostid

33

CIDR

Classless Inter-Domain Routing

Abandons the notion of classes


Key Concept: The length of the network prefix
in the IP addresses is kept arbitrary
Consequence: Size of the network prefix must
be provided with an IP address

34

CIDR notations

CIDR notation of the address 220.231.93.18/24

24 is the prefix length; the 24 first bits are network prefix


of the address

leaving (32 24) bits for specific host addresses. Total


host may available is 256 (Where does this number come
from?)

CIDR notation can replace the use of netmasks

220.231.93.18/24 means IP address 220.231.93.18 with


netmask 255.255.255.0
35

Scalability Improved

Routing tables are smaller (but still too big)

No need to update the routers when new host added

E.g., adding a new host 5.6.7.213 on the right

Doesnt require adding a new forwarding-table entry

36

Example #1

Assume that an ISP owns the address block


206.0.64.0/18, which represents 16,384 (214) IP
addresses
Suppose a client requires 800 host addresses
With classful addresses: need to assign as class B
address (and waste ~64,700 addresses) or four
individual Class Cs (and introducing 4 new routes into
the global Internet routing tables)
With CIDR: Assign a /22 block, e.g., 206.0.68.0/22, and
allocated a block of 1,024 (210) IP addresses.
37

Example #2

An organization is granted the block


130.34.12.64/26. The organization needs to
have four subnets. What are the subnet
addresses and the range of addresses for
each subnet?

38

Example #2

The suffix length is 6. This means the total number of


addresses in the block is 64 (26). If we create four
subnets, each subnet will have 16 addresses.

Subnet 1: 130.34.12.64/28 to 130.34.12.79/28.

Subnet 2 : 130.34.12.80/28 to 130.34.12.95/28.

Subnet 3: 130.34.12.96/28 to 130.34.12.111/28.

Subnet 4: 130.34.12.112/28 to 130.34.12.127/28.

39

Example #2

40

CIDR: Reduce Routing Table Sizes

About 350K entries to date

41

Next lecture: Router design

42