CDS Wt
Chapter 2.3
Layer 3
e rLayer 3
Network Layer
3.3 N e tw ork Lay e 1 CDS WtWarm up !
• What methods / approaches do you know, to realize
a CSMA / CA access ?
e
r
• Explain the difference between an adressed based
and an Information based Layer 2 addressing.
• consider a data sequence (1 1 0 0 1 1 0 0 1 1) and the Generatorpolynom, given as (1 0 0 1 1).
C l l t th CRC F h k 3.3 N e tw ork Lay e 2
CDS Wt • Introduction Layer 3
Content
e r • IP Protocol– IP-Header: www.ietf.org and RFC-760 – Addressing schemes
– Subnetting – Routing
Layer 3 Solution in Trains
3.3 N e tw ork Lay e 3
• Layer 3 Solution in Trains
• Communication Matrix
(Information Based Communication)
CDS
Wt
Protocol aspect of the OSI-Model
7 7 Endsystem 2 Endsystem 1 Layer 7 protocol Layer 6 protocol e r 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 Transit-system Layer 6 protocol 3.3 N e tw ork Lay e transmission-system
Protocols are defined between the same layers of two systems. They define rules and formats of message/information exchange.
CDS
Wt
Why network layer (1) ?
e r 3.3 N e tw ork Lay e 5 CDS Wt
Why network layer (2) ?
Vehicle bus
Locomotive Wagon: Trainset: Control-Wagon
e
r
Redundant nodes Single node Multiple Wagons reduntand Nodes
Gateway WTB/MVB
C
C WTB trainbus (UIC 556) Standard!
MVB vehicle bus 3.3 N e tw ork Lay e 6 Türen Türen dez. I/O dez. I/O Brake control Main Control Climate control Multi-media Doors Hilfs- betriebe-Umrichter Dezentrale I/O Dezentrale I/O Dezentrale I/O Dezentrale I/O MMI Subsystemes Motorr Subsysteme, Motor Sub-systeme Antriebs-steuerung
Vehicle Bus (CAN, FIP,...)
Brake Control Main Control Climate Control Multi-media Doors Hilfs- betriebe-Umrichter Dezentrale I/O Dezentrale I/O Dezentrale I/O Dezentrale I/O MMI Subsysteme, motor Subsysteme, Motor Sub-systeme Antriebs-steuerung ONIX Umrichter ONIX Umrichter Display Display
CDS
Wt
Why network layer (3) ?
e r 3.3 N e tw ork Lay e 7 CDS Wt
Network-Layer
The Network Layer...
• segment network and control flow of traffic.
• provides the functional and procedural means of transferring variable length data sequences from a source to a destination
e
r
variable length data sequences from a source to a destination via one or more networks
• transfers packetsfrom one network to another
• maintains the quality of service requested by the Transport layer.
• performs network routing functions and might also perform fragmentation and reassembly, and report delivery errors. • Is based on a logical addressing scheme
3.3 N e tw ork Lay e
Internet Protocol (IP) is the best known layer 3 protocol • connectionless transfer of data
• fragmenting data into sufficiently small packets that the Layer 2 can accept it
CDS
Wt
Network segmentation
• Control network traffics and reduce broadcast traffics.
• Separate computer networks are managed by
e
r
Separate computer networks are managed by a single administration - Autonomous
systems. 3.3 N e tw ork Lay e 9 CDS Wt
Communication among networks
• Networks operate in much the same manner.
e r 3.3 N e tw ork Lay e 10
CDS
Wt
Router
• Routers connect separate networks.
• Routers make best path decisions based on
Layer 3 information.
e
r
Layer 3 information.
• Routers actually switch packets from
incoming ports to appropriate outgoing ports.
• Routers can change the media and Layer 2
b h i 3.3 N e tw ork Lay e 11 behaviour CDS Wt
Data relaying
e r 3.3 N e tw ork Lay eCDS
Wt
Path determination
• Path determination is the process that the router uses to choose the next hop in the path for the packet to travel to its destination
e
r
based on the link bandwidth, hop, delay ...
3.3 N e tw ork Lay e 13 CDS Wt
Network layer addressing
• Network address + Host address: Hierarchical
Addressing Schemes. e r 3.3 N e tw ork Lay e 14
CDS
Wt
Flat Addressing Scheme
e r 1 2 4 5 A B 1 – A1 1 – A 3.3 N e tw ork Lay e 15 2 3 5 6 2 – A2 3 – A3 2 – A 3 – A 4 – B 5 – B 6 – B CDS Wt
MAC Addressing (Layer 2)
e r 3.3 N e tw ork Lay e
CDS
Wt
Hierarchical Addressing Scheme
e r A1 A2 B1 B2 A B 1 – A1 3.3 N e tw ork Lay e 17 A2 A3 B2 B3 2 – A2 3 – A3 A – Local B – Switch to B CDS Wt
Hierarchical Addressing Scheme
International Gateway e r Domestic Switch Local 3.3 N e tw ork Lay e 18 Local Switch 84 8 9321044
CDS
Wt
Network address
• The network address helps the router to identify a path within the network cloud.
• The router uses the network address to
e
r
The router uses the network address to identify the destination network of a packet within an internetwork.
• Network address is assigned by higher-level
administrator. Host address is assigned manually or automatically by manager of that network. 3.3 N e tw ork Lay e 19 CDS Wt • Introduction Layer 3
Content
e r • IP Protocol– IP-Header: www.ietf.org and RFC-760 – Addressing schemes
– Subnetting – Routing
Layer 3 Solution in Trains
3.3 N e tw ork Lay e
• Layer 3 Solution in Trains
• Communication Matrix (Information Based
CDS
Wt
Network layer datagram
• At the network layer, the data is encapsulated within packets(also known as datagrams).
• Packet includes header - addressing and
e
r
Packet includes header addressing and other control information and actual data -whatever is passed down from the higher layers. 3.3 N e tw ork Lay e 21 CDS Wt
IP header format
e r 3.3 N e tw ork Lay e 22CDS
Wt
IP header format:
Version
e
r
•
4 bits.
•
Indicates the version of
IP currently used.
3.3 N e tw ork Lay e 23IP currently used.
– IPv4 : 0100 – IPv6 : 0110 CDS WtIP header format: Header length
e
r
•
4 bits.
•
IP header length : Indicates the
datagram header length in 32 bit
3.3 N e tw ork Lay e
datagram header length in 32 bit
words (4 bits), and thus points to
the beginning of the data.
CDS
Wt
IP header format: Service type
e
r
•
8 bits.
•
Specifies the level of importance
that has been assigned by a
particular upper-layer protocol
3.3 N e tw ork Lay e 25
particular upper-layer protocol.
• Precedence.
• Reliability.
• Speed.
CDS
Wt
IP header format: Total length
e r
•
16 bits.
3.3 N e tw ork Lay e 26•
Specifies the length of the
entire IP packet, including
data and header, in bytes.
CDS
Wt
IP header format: Identification
e
r
•
16 bits.
•
Identification contains an integer
that identifies the current datagram.
3.3 N e tw ork Lay e 27
g
•
Assigned by the sender to aid in
assembling the fragments of a
datagram.
CDS
Wt
IP header format: Flags
e
r
•
3 bits.
•
The second bit specifying whether the
packet can be fragmented .
3.3 N e tw ork Lay e
p
g
•
The last bit specifying whether the packet
is the last fragment in a series of
CDS
Wt
IP header format: Fragment
offset
e
r
•
13 bits.
•
The field that is used to help piece together
datagram fragments
3.3 N e tw ork Lay e 29datagram fragments.
•
The fragment offset is measured in units of
8 octets (64 bits).
•
The first fragment has offset zero.
CDS
Wt
IP header format: Time to Live
e r
•
8 bits.
3.3 N e tw ork Lay e 308 bits.
•
Time-to-Live maintains a counter that
gradually decreases to zero, at which point
the datagram is discarded, keeping the
packets from looping endlessly.
CDS
Wt
IP header format: Protocol
e
r
• 8 bits.
• Indicates which upper layer protocol receives
3.3 N e tw ork Lay e 31
• Indicates which upper-layer protocol receives incoming packets after IP processing has been completed
• 06 : TCP
• 17 : UDP
CDS
Wt
IP header format: Header
checksum
e r16 bit
3.3 N e tw ork Lay e•
16 bits.
•
A checksum on the header only,
helps ensure IP header integrity.
CDS
Wt
IP header format: Addresses
•
32 bits each.
e r•
Source IP Address
•
Destination IP Address
3.3 N e tw ork Lay e 33 CDS WtIP header format: Options
e
r
•
Variable length.
•
Allows IP to support various options,
such as security, route, error report ...
3.3 N e tw ork Lay e 34
CDS
Wt
IP header format: Padding
e
r
•
The header padding is used to ensure
that the internet header ends on a 32 bit
boundary.
3.3 N e tw ork Lay e 35 CDS Wt • Introduction Layer 3Content
e r • IP Protocol– IP-Header: www.ietf.org and RFC-760 – Addressing Schemes
– Subnetting – Routing
Layer 3 Solution in Trains
3.3 N e tw ork Lay e
• Layer 3 Solution in Trains
• Communication Matrix (Information Based
CDS
Wt
IP network address
• Network layer addresses are 32 bits long.
• The are presented as four octets in dotted decimal format.
e
r
decimal format.
• The IP address has two components:
Network ID and Host ID.
3.3 N e tw ork Lay e 37 CDS Wt
Network ID and host ID
• Network ID :
– Assigned by Internet Network Information Center. – Assigned by upper organization.
e
r
– Identifies the network to which a devices is attached.
• Host ID :
– Assigned by a network administrator.
– Identifies the specific device on that network.
3.3 N e tw ork Lay e 38
CDS
Wt
Bits on the IP address
• Network Bits : – Identifies network ID
– Identifies class of the IP address
e
r
– All of bits are 0: not allowed
• Host Bits : – Identifies host ID
– All of bits are 0: reserved for network address – All of bits are 1: reserved for broadcast address
3.3 N e tw ork Lay e 39 CDS Wt
IP address classes
• Different class addresses reserve different amounts of bits for the Network and Host portions of the address
e
r
• Provide the flexibility required to support different size networks
3.3 N e tw ork Lay e
CDS
Wt
IP address classes: Class A
e r 3.3 N e tw ork Lay e 41 CDS Wt
IP address classes: Class A
• The first bit of a Class A address is always 0.
• The first 8 bits to identify the network part of the address.
e
r
the address.
• Possible network address from 1.0.0.0 to 127.0.0.0.
• The remaining three octets can be used for the host portion of the address.
• Each class A network have up to 16,777,214
possible IP addresses 3.3 N e tw ork Lay e 42 possible IP addresses.
CDS
Wt
IP address classes: Class B
e r 3.3 N e tw ork Lay e 43 CDS Wt
IP address classes: Class B
• The first 2 bits of a Class B address is always 10.
• The first two octets to identify the network
e
r
The first two octets to identify the network part of the address.
• Possible network address from 128.0.0.0 to 191.255.0.0.
• The remaining two octets can be used for the host portion of the address.
• Class B network have up to 65 534 possible
3.3 N e tw ork Lay e
• Class B network have up to 65.534 possible IP addresses.
CDS
Wt
IP address classes: Class C
e r 3.3 N e tw ork Lay e 45 CDS Wt
IP address classes: Class C
• The first 3 bits of a Class C address is always 110.
• The first three octets to identify the network
e
r
The first three octets to identify the network part of the address.
• Possible network address from 192.0.0.0 to 223.255.255.0.
• The remaining last octet can be used for the host portion of the address.
• Class C network have up to 254 possible IP
3.3 N e tw ork Lay e 46
• Class C network have up to 254 possible IP addresses.
CDS
Wt
IP address classes: Summary
• 1.0.0.0 - 126.0.0.0 : Class A. • 127.0.0.0 : Loopback network. • 128 0 0 0 - 191 255 0 0 : Class B e r • 128.0.0.0 - 191.255.0.0 : Class B. • 192.0.0.0 - 223.255.255.0 : Class C. • 224.0.0.0 < 240.0.0.0 : Class D, multicast. • >= 240.0.0.0 : Class E, reserved. 3.3 N e tw ork Lay e 47 CDS Wt
Network address
• Network address provide a convenient way to
refer to all of the addresses on a particular network or subnetwork.
e
r
• Two hosts with differing network address require a device, typically a router, in order to communicate.
• An IP address that ends with binary 0s in all host bits is reserved for the network address.
3.3 N e tw ork Lay e
CDS
Wt
Broadcast address
• Broadcast goes to every host with a particular network ID number.
• An IP address that ends with binary 1s in all
e
r
An IP address that ends with binary 1s in all host bits is reserved for the directed
broadcast address.
• An IP address with binary 1s in all network bits and host bits is reserved for the local broadcast address. 3.3 N e tw ork Lay e 49 CDS Wt
Local broadcast address
e r
STOP
3.3 N e tw ork Lay e 50STOP
255.255.255.255
CDS
Wt
Directed broadcast address
e r
192.168.20.0
3.3 N e tw ork Lay e 51Broadcast address
Broadcast address
192.168.20.255
CDS WtExample: 172.16.20.200
• 172.16.20.200 is Class B address • Network portion: 172.16 • Host portion: 20 200 e r • Host portion: 20.200 • Network address: 172.16.0.0 • Broadcast address: 172.16.255.255 3.3 N e tw ork Lay eCDS
Wt
Private addresses
• According to RFC-1918.
• Organizations make use of the private
Internet address space for hosts that require
e
r
Internet address space for hosts that require IP connectivity within their enterprise
network, but do not require external connections to the global Internet.
• Class A: 10.0.0.0. • Class B: 172.16.0.0 - 172.31.0.0. • Class C: 192 168 0 0 192 168 255 0 3.3 N e tw ork Lay e 53 • Class C: 192.168.0.0 - 192.168.255.0. CDS Wt • Introduction Layer 3
Content
e r • IP Protocol– IP-Header: www.ietf.org and RFC-760 – Addressing Schemes
– Subnetting – Routing
Layer 3 Solution in Trains
3.3 N e tw ork Lay e 54
• Layer 3 Solution in Trains
• Communication Matrix (Information Based
CDS
Wt
Why we need to divide network?
• Network administrators sometimes need to
divide networks, especially large ones, into smaller networks:
e
r
– Reduce the size of a broadcast domain. – Improve network security.
– Implement the hierarchical managements.
• So we need more network addresses for your
network. But I want the outside networks see our network as a single network.
3.3 N e tw ork Lay e 55 CDS Wt
Divide network by three
e r 3.3 N e tw ork Lay e
CDS
Wt
Subnetting
• Subnetworks are smaller divisions of network.
• Subnet addresses include the Class A, Class
e
r
Subnet addresses include the Class A, Class B, or Class C network portion, plus a subnet field and a host field.
• To create a subnet address, a network administrator borrows bits from the original host portion and designates them as the subnet field. 3.3 N e tw ork Lay e 57
• Subnet addresses are assigned locally, usually by a network administrator.
CDS Wt
Subnetting
e r 3.3 N e tw ork Lay e 58CDS
Wt
Subnet mask
• “Extended Network Prefix”.
• Determines which part of an IP address is the network field and which part is the host field.
e
r
network field and which part is the host field.
• 32 bits long.
• Divided into four octets.
• Network and Subnet portions all 1’s.
• Host portions all 0’s.
3.3 N e tw ork Lay e 59 CDS Wt
Default subnet mask: Example
• 192.168.2.100 / 255.255.255.0. • 11000000.10101000.00000010.01100100. • 11111111 11111111 11111111 00000000 e r • 11111111.11111111.11111111.00000000. • 11000000.10101000.00000010.01100100. • Class C network:
– 24 bits for network portion. – 0 bits for subnet portion. – 8 bits for host portion.
S b t dd 192 168 2 0 3.3 N e tw ork Lay e • Subnet address: 192.168.2.0.
CDS
Wt
Subnet mask: Example
• 172.16.65.100 / 255.255.240.0. • 10101100.00010000.01000001.01100100. • 11111111 11111111 11110000 00000000 e r • 11111111.11111111.11110000.00000000. • 10101100.00010000.01000000.00000000. • Class B network:
– 16 bits for network portion. – 4 bits for subnet portion. – 12 bits for host portion.
S b t dd 172 16 64 0 3.3 N e tw ork Lay e 61 • Subnet address: 172.16.64.0. CDS Wt
How many bits can I borrow?
• All of subnet bits are:
– 0 : reserved for network address. – 1 : reserved for broadcast address.
e
r
• The minimum bits you can borrow is: 2 bits.
• The maximum bits you can borrow is:
• A: 22 bits ~ 222 - 2 = 4.194.302 subnets. • B: 14 bits ~ 214 - 2 = 16.382 subnets. • C: 06 bits ~ 206 - 2 = 62 subnets. 3.3 N e tw ork Lay e 62
CDS
Wt
Why we need to know Boolean
ops?
IP
AND
Subnet
=
Network and
e
r
• Network layer performs the Boolean
operations in order to find the network ID of a subnet
Example:
Address
AND
Mask
Subnet address
3.3 N e tw ork Lay e 63 • Example: – 172.16.65.100 AND 255.255.240.0 – Network address: 172.16.64.0 CDS Wt
ARP to find a MAC Address
e r 3.3 N e tw ork Lay e
CDS
Wt Broadcasting messages are
intended to be seen by every host on a network.
Address all nodes (braodcast)
e
r
The broadcast address is formed by using all 1s within a portion of the IP address
Two kinds of broadcasts -directed broadcasts and flooded broadcasts. 3.3 N e tw ork Lay e 65
Broadcasts directed into a specific network/subnet are allowed and are forwarded by the router. These directed broadcasts contain all 1s in the host portion of the address.
Flooded broadcasts (255.255.255.255) are not propagated, but are considered local broadcasts. CDS Wt • Introduction Layer 3
Content
e r • IP Protocol– IP-Header: www.ietf.org and RFC-760 – Addressing schemes
– Subnetting – Routing
Layer 3 Solution in Trains
3.3 N e tw ork Lay e 66
• Layer 3 Solution in Trains
• Communication Matrix (Information Based
CDS
Wt
Initially, a router must refer
Routing: Forward IP-Packets
e
r
to entries about networks or subnets that are directly connected to it.
Each interface must be configured with an IP address and a mask.
3.3 N e tw ork Lay e 67
The initial source of addressing is a user who types it into a configuration file.
CDS
Wt
•static routes- manually defined by the system administrator as the next hop to a destination; useful
Routing: types of routes
e
r
hop to a destination; useful for security and traffic reduction
•default routes- manually defined by the system administrator as the path to take when there is no known route to the
3.3 N e tw ork Lay e destination
•dynamic routing- the router learns of paths to destinations by receiving periodic updates from other
CDS
Wt
Default route
• A default network must exist in a routing table. Default routes keep routing tables shorter. When an entry for a destination network does not exist in a routing table the
e
r
network does not exist in a routing table, the packet is sent to the default network.
• Because a router does not have complete
knowledge about all destination networks, it can use a default network number to indicate
th di ti t t k f k t k 3.3 N e tw ork Lay e 69
the direction to take for unknown network numbers. Use the default network number when you need to locate a route, but have only partial information about the destination network.
CDS
Wt
a router can use an IP routing protocol to accomplish routing through the implementation of a
Different routing protocols
e
r
specific routing algorithm. Examples of IP routing protocols include:
• RIP - a distance-vector
routing protocol
• IGRP - Cisco’s
distance-3.3 N e tw ork Lay e 70
• IGRP - Cisco s
distance-vector routing protocol
• OSPF - a link-state routing
protocol
• EIGRP - a balanced hybrid
CDS
Wt
RIP was originally specified in RFC 1058.
Its key characteristics include
Routing: RIP
e
r
Its key characteristics include the following:
•It is a distance-vector routing protocol.
•Hop count is used as the metric for path selection.
•The maximum allowable
3.3 N e tw ork Lay e 71 hop count is 15. •By default, routing updates are broadcast every 30 seconds CDS Wt
Routing Table
e r 3.3 N e tw ork Lay eThe show ip routecommand displays the contents of the IP routing table, which contains entries for all known networks and subnetworks, along with a
CDS Wt • Introduction Layer 3
Content
e r • IP Protocol– IP-Header: www.ietf.org and RFC-760 – Addressing schemes
– Subnetting – Routing
Layer 3 Solution in Trains
3.3 N e tw ork Lay e 73
• Layer 3 Solution in Trains
• Communication Matrix (Information Based
Communication)
CDS
Wt
Train Network Structure
e r 3.3 N e tw ork Lay e 74 Sources: IEC 61375
CDS Wt
WTB Data-Frame
e r 3.3 N e tw ork Lay e 75 CDS WtRouting in a train
• The network layer routes packets from an Origin station to a Final station.
e
r
• To this effect, the network layer uses the mapping provided by several directories:
• a) the station directory,
• b) the function directory,
• c) the group directory, and d) the node directory
3.3 N e tw ork Lay e
• d) the node directory.
CDS Wt
Network-Layer / Routing
e r 3.3 N e tw ork Lay e 77 CDS WtRouting Situations
e r 3.3 N e tw ork Lay e 78CDS Wt
Frame Structure
e r 3.3 N e tw ork Lay e 79 CDS WtFrame Structure
e r 3.3 N e tw ork Lay eCDS Wt • Introduction Layer 3
Content
e r • IP Protocol– IP-Header: www.ietf.org and RFC-760 – Addressing schemes
– Subnetting – Routing
Layer 3 Solution in Trains
3.3 N e tw ork Lay e 81
• Layer 3 Solution in Trains
• Communication Matrix