Chương 6
Chương 6
Network Layer
Tran Thanh Dien, PhD
College of Information and communication Technology
Can Tho University
Routing within a
diagram subnet
Network Layer Design Issues
Implementation of Connection-Oriented Service
• A path from the source router all the way to the destination router established
before any data packets can be sent
• This connection called a virtual circuit, and the network called a virtual-circuit
network
• When a connection established, a route from the source to the destination chosen
as part of the connection setup and stored in tables inside the routers.
• Established route is used for all traffic flowing over the connection
• When the connection is released, the virtual circuit is terminated.
• Each packet carries an identifier telling which virtual circuit it belongs to
Network Layer Design Issues
Implementation of Connection-Oriented Service
Network Layer Design Issues
Implementation of Connection-Oriented Service
Routing within a
virtual-circuit subnet
Network Layer Design Issues
Comparison of Virtual-Circuit and Datagram Subnets
Routing Algorithms
Routing Algorithms
• A part of the network layer software responsible for deciding which output
line an incoming packet should be forwarded
• In datagram network: routing made for every data packet since the best route
may have changed since last time
• In virtual circuits network: routing decisions are made only when a new
virtual circuit established
• Two process in inside a router
Handling each incoming packet: look up the outgoing line in the routing
tables – forwarding process
Filling in and updating the routing tables
Routing Algorithms
Routing
• Objective: Finding shortest paths from one source node to all other destination
nodes in a network
• Being an optimized algorithm – centralized routing algorithm
• Call
S: Source node (predefined)
N: Set of nodes which shortest path (from S) found
Di: Cost of a shortest path from node S to node i
lij: Cost of edge connecting node i and node j; ∞ if no edge between i and j
Pi: Parent node of node i
Routing Algorithms
Finding shortest path with Dijkstra algorithm
• Each router maintains a routing table containing one entry for each router in the
network.
Entry [destination, Next hop, Cost]
• Cost is distance – hops
• Each router is supposed to know costs of links connecting to its neighborhood
• Cost of a broken/down link is infinite
• A router exchange its routing table with neighborhood periodically
• A router will update its routing table with new shorter routes learned from routing
tables of its neighborhood
Routing Algorithms
Distance Vector
Initially, each node will assigns 1 for cost of the link to a neighborhood, and
for links to other router
Distance to nodes
B A B C D E F G
C A 0 1 1 1 1
A
D B 1 0 1
C 1 1 0 1
E
D 1 0 1
F G E 1 0
F 1 0 1
G 1 1 0
Routing Algorithms
Distance Vector
Distance to nodes
A B C D E F G
B
A 0 1 1 2 1 1 2
C
A B 1 0 1 2 2 2 3
D
C 1 1 0 1 2 2 2
E
D 2 2 1 0 3 2 1
F G
E 1 2 2 3 0 2 3
F 1 2 2 2 2 0 1
G 2 3 2 1 3 1 0
Routing Algorithms
Distance Vector
Inter-AS routing
between A and B
C.b
(BGP)
B.a
A.a
Host
b A.c c h2
a a
C b
a B
d
Host c
h1 A b Intra-AS routing
within AS B (OSPF/RIP)
Intra-AS routing
within AS A (OSPF/RIP)
Routing Algorithms
Hierarchical routing
Internetworking & Internet Protocol Suite
Internetworking
• An internetwork: a collection of
individual networks, connected by
intermediate networking devices,
that functions as a single large
network
• Component networks are
inhomogeneous: different in
hardware, software and protocols
• Objective: to allow a user in a
network to communicate with other
users in the other networks
Internetworking
• At physical layer:
Individual networks interconnected by using Repeaters or HUBs.
Repeaters or HUBs simply transmit raw bits from one network segment to others
network segments
• At data link layer:
Switches or Bridges used.
They analyze the frame’s MAC address and forward it to the other network segment.
Reformat the frame
• At network layer: Routers used.
• At transport layer and application layer: Gateways used
Internetworking
• Developed in the years of the '70s of the 20th century in a project of Defense
Advanced Research Projects Agency (DARPA)
• DARPA project led to the development of protocols for internetworking
• In september1969: the first packet-switched network was placed in UCLA and was
supervised by Kleinrock.
• In Dec of 1969: ARPAs network expanded to include three different nodes
throughout the United States: The Stanford analysis Institute (SRI), The University
of California city, and thus the University of Utah
• 1971 : Fifteen sites connected to the young ARPANET
• In December 1974, RFC 675 – Specification of Internet Transmission Control
Program, term internet used as a shorthand for internetworking
Internet Protocol Suite
History
• In 1982, the Internet Protocol Suite (TCP/IP) was standardized, which permitted
worldwide proliferation of interconnected networks.
• In 1986, TCP/IP network access expanded again when the National Science
Foundation Network (NSFNET) provided access to supercomputer sites in the
United States from research and education organizations, first at 56 kbit/s and later
at 1.5 Mbit/s and 45 Mbit/s.
• In 1990, The ARPANET was decommissioned
• By 1995, The Internet was fully commercialized in the U.S.
• In 1997, Vietnam was connected to Internet
Internet Protocol Suite
History
Internet Protocol Suite
TCP/IP
• Network Address: an IP address where all bits in host identifier part are 0, used to
identify a network
Example: 10.0.0.0; 172.18.0.0 ; 192.1.1.0
• Broadcast address: an IP address where all bits in host identifier part are 1, used
to refer to all host in a network; not assigned to a host
Example: 10.255.255.255, 172.18.255.255, 192.1.1.255
Internet Protocol Suite
Special IPV4 address
• Netmask: An IP address where all bits in network identifier part are 1 and, all bits in
host identifier part are 0.
Used to determine Network ID from an IP address
Network ID = IP & Netmask
Three standard netmasks
o For networks of class A: 255.0.0.0
o For networks of class B: 255.255.0.0
o For networks of class C: 255.255.255.0
Example:
Netmaks = 255.255.0.0 and IP address 191.2.2.41
=> Network ID = 191.2.2.41 & 255.255.0.0 = 191.2.0.0
Internet Protocol Suite
Subnetting
• Benefits
Strengthening the security of the system: Subnetting allow an organization to design
his network as an internetwork of subnets while outside networks still see it is a
single network
Isolating the traffic flow on the network: With the help of the routers, network traffic
can be kept to the lowest level
Internet Protocol Suite
Subnetting
Internet
172.18.0.0/255.255.0.0
SWITCH SWITCH
SWITCH
PC1 PC2 PC3 PC4 PC1 PC2 PC3 PC4 PC1 PC2 PC3 PC4
LAN 54
Internet Protocol Suite
Subnetting
Internet
172.18.0.0/255.255.0.0
SWITCH SWITCH
SWITCH
PC 1 PC 2 PC 3 PC 4 PC 1 PC 2 PC 3 PC 4 PC 1 PC 2 PC 3 PC 4
Network Id Host Id
Subnet Id
Internet Protocol Suite
Subnetting: Subnetmask
• Subnetmask is an IP address where all bits in network identifier part and all bits in
subnet identifier part are 1, and all bits in host identifier are 0
Subnetwork Address = IP & Subnet mask
Network Id Host Id
11111111 11111111 11111
Subnet Id
Bài 1: Cho địa chỉ mạng 192.168.1.0. Hãy phân mạng này thành 10 mạng con để gán cho 10
phòng máy tính. Định địa chỉ cho 10 máy tính của phòng 1 và phò ng 2
Bài 2: Cho địa chỉ mạng 172.16.0.0 được chia mạng con với subnetmask=255.255.255.0.
Gán mỗi phòng 1 mạng con. Hãy định địa chỉ cho 10 máy tính ở phòng 1 và 2
Lưu ý: Trình bày kết quả theo dạng
– Phân bố mạng con
+ Phòng 1: Địa chỉ mạng con/subnetmask
.…
+ Phòng 10: Địa chỉ mạng con/subnetmask
– Phòng 1:
+ Máy 1: IP
+ Máy 2: IP
+ Máy 3: IP …
+ Máy 10: IP
Internet Protocol Suite
Subnetting: Homeworks
Bài 3: Mạng máy tính của một tổ chức có sơ đồ như hình bên dưới. Hãy xác định số lượng
mạng con tối thiểu của mạng này. Giả sử tổ chức này sử dụng một địa chỉ mạng IP
180.10.0.0. Hãy giúp xác định:
a) Mặt nạ mạng con
b) Gán địa chỉ mạng cho các mạng con
c) Gán địa chỉ IP cho các Interface của
router
d) Gán 10 địa chỉ IP cho phòng máy
tính Art và Physics
Internet Protocol Suite
Classless Inter-Domain Routing method (CIDR)
• You are allowed to start with subnet 0, and the last subnet will be whatever /26 is.
To work that out, tick two down the Subnets column
Internet Protocol Suite
Subnetting Cheat Chart
200.100.100.0
200.100.100.8 <=Jump to 80.
200.100.100.80 <=Jump to 160.
200.100.100.160 <=Add another 80.
200.100.100.240 <=Back to adding 8 increments.
200.100.100.248 <=Host 200.100.100.250 is here.
Internet Protocol Suite
Subnetting Cheat Chart
Exercises:
1. 220.20.10.199/27 in? What is the broadcast address?
2. Which subnet is host 199.99.10.87/28 in? What is the broadcast address?
3. Which subnet is host 200.99.30.171/29 in? What is the first host, last host, and broadcast
address?
4. Which subnet is host 172.16.100.100/17 in?
5. Which subnet is host 172.16.200.100/17 in?
6. Which subnet is host 128.160.22.111/18 in?
7. Which subnet is host 130.160.222.1/18 in?
8. Which subnet is host 140.60.212.12/19 in?
9. Which subnet is host 160.160.160.160/20 in?
Internet Protocol Suite
Subnetting Cheat Chart
Exercises:
10. Which subnet is host 190.1.150.110/21 in? What is the first host, last host, and broadcast
address?
11. Which subnet is host 191.100.15.1/22 in?
12. Which subnet is host 128.100.19.11/23 in?
13. Which subnet is host 136.10.40.111/24 in?
14. Which subnet is host 186.30.30.41/25 in?
15. Which subnet is host 150.130.20.121/26 in?
16. Which subnet is host 131.60.50.1/27 in?
17. Which subnet is host 142.160.40.35/28 in?
18. Which subnet is host 128.10.10.54/29 in?
Internet Protocol Suite
Subnetting Cheat Chart
Exercises:
19. Which subnet is host 10.10.10.54/9 in? What is the first host, last host, and broadcast
address?
20. Which subnet is host 20.100.11.11/10 in?
21. Which subnet is host 40.50.101.121/12 in?
22. Which subnet is host 120.150.1.2/14 in?
23. Which subnet is host 10.10.14.25/16 in?
24. Which subnet is host 10.23.4.2/18 in?
25. Which subnet is host 14.40.140.85/22 in?
26. Which subnet is host 90.10.22.17/29 in?
27. Which subnet is host 100.100.210.46/28 in?
Internet Protocol Suite
Subnetting Cheat Chart
Exercises:
27. Which subnet mask applied to 192.168.1.0 will generate two subnets and 126 hosts-per-subnet?
28. Which subnet mask applied to 192.168.1.0 will generate four subnets and 62 hosts-per-subnet?
29. Which subnet mask applied to 200.18.2.0 will generate eight subnets and 30 hosts-per-subnet?
30. Which subnet mask applied to 221.1.22.0 will generate 16 subnets and 14 hosts-per-subnet?
31. Which subnet mask applied to 198.10.122.0 will generate 30 subnets and 6 hosts-per-subnet?
32. Which subnet mask applied to 210.100.12.0 will generate two hosts-per-subnet?
33. Which subnet mask applied to 172.16.0.0 will generate four subnets? How many hosts-per-
subnet will this leave you?
34. Which subnet mask applied to 172.20.0.0 will generate 32 subnets? How many hosts-per-
sub-net will this leave you?
Internet Protocol Suite
Subnetting Cheat Chart
Exercises:
35. Which subnet mask applied to 132.30.0.0 will
generate as close as possible to 60 subnets each
supporting up to 1000 hosts?
36. Which subnet mask applied to 190.100.0.0 will
generate 128 subnets each supporting at least 500
hosts?
37. Which subnet mask applied to 191.40.0.0 will
generate 512 subnets each supporting up to 100
hosts?
38. Your boss hands you subnet 10.0.0.0/21 and asks you
to work out how many subnets and hostsper- subnet
this will generate. What do you tell her?
Internet Protocol Suite
Subnetting Cheat Chart
Exercises:
39. You have taken over a network from another network designer. You can see that 10.0.0.0/23
has been allocated. How many subnets and hosts-per-subnet has this generated?
40. You have taken over a network from another network designer. You can see that 10.0.0.0/17
has been allocated. How many subnets and hosts-per-subnet has this generated?
Internet Protocol Suite
IPv6
Better Security
Larger address space: 128-bit vs 32-bit length address
More efficient IP header (fewer fields and no checksum)
Built-in IP Mobility
Internet Protocol Suite
IPv6 address
IPv6 address:
o a 128-bit address broken up into eight different sections separated by a colon
o Each section made up of 16 bits.
o 1111:AABB:CCDD:0001:0123:4567:8901:ABCD
This address can be divided into 3 section: as an organizational prefix, the subnet,
and the device IDs
Internet Protocol Suite
IPv6 address
Example address
1111:AABB:CCDD:0001:0123:4567:8901:ABCD
We can break it out into the following parts:
Organizational Prefix (48 bits): 1111:AABB:CCDD
Subnet ID (16 bits): 0001
Device IDs (64 bits): 0123:4567:8901:ABCD
Example address
1111:AABB:CCDD:0001:0123:4567:8901:ABCD
We can break it out into the following parts:
Organizational Prefix (48 bits): 1111:AABB:CCDD
Subnet ID (16 bits): 0001
Device IDs (64 bits): 0123:4567:8901:ABCD
How many devices are there in the network with an IP schema like this?
In the above example:
o 16-bit section for subnetting: provide us with the capability to have more than
65,000 subnets and,
o And 64 bits for actual IP addresses: quintillions of unique device IDs in the IP
range
Internet Protocol Suite
IPv6 address
• How to assign the individual device ID numbers for all of the computers, servers,
and devices on our network?
1. Start with number 1 and go up from there.
2. Calculate out the old IPv4 addresses into hex and use this as the last 32 bits of
the address
Then utilize ID numbers in combination with the organizational prefix and the
subnet ID to create a static IPv6 address
E.g., An IPv4 192.168.1.5 factors out to C0A8:0105
IPv6: 1111:AABB:CCDD:0001:0:0:C0A8:0105
Internet Protocol Suite
IPv6 address Simplified
• 1111:AABB:CCDD:0001:0000:0000:C0A8:0105
• One-to-many communication
Internet Protocol Suite
Type of IPv6 address
DHCP
client
Internet Protocol Suite
Type of IPv6 address
Internet Protocol Suite
Type of IPv6 address
Internet Protocol Suite
Type of IPv6 address: Global unicast addresses
Similar to IPv4 public IP: used when a host want to used Internet
Routable on the IPv6 Internet
Currently always starts with 2001::/3
48 bits 16 64
45 bits bits bits
001 Global routing prefix Subnet ID Interface ID
8 40 16 64
bits bits bits bits
FC00::/7 or FD00::/7
Internet Protocol Suite
Autoconfiguration options for IPv6
Internet Protocol Suite
Autoconfiguration options for IPv6
65132IfAdd
Managed
Check
Check
Derive
for or Otheron
for aaddress
router
Link-Local
prefixes
flag
theis
conflicts
Address
4 set, check
network
using
Check theDHCPv6
neighbor
routersolicitation
for prefixes
IPv6 Client
Autoconfigured IP Timeline
Valid • fe80::d593:e1e:e612:53e4%10
• Router configuration information
Tentative Preferred Deprecated Invalid
• Additional routerTime
prefixes
Preferred Lifetime • DHCPv6 information received
Valid Lifetime