Você está na página 1de 139

IP Networking

IP NETWORK CONVERGENCE
Objectives

1.Describe
1.Describethe
theOSI
OSIModel
Modeland
andOSI
OSIlayers
layers

2.
2. Understand
Understandthe
theTCP/IP
TCP/IPprotocols
protocols

3.
3. How
Howto
tomake
makeIP
IPaddress
address

4.
4. How
Howto
toroute
routedata
datain
inIP
IPnetwork
network

IP OVER
Chapter 1: OSI model

Separate functions of networking


A Communications Model
Purpose of Communications
Exchange of data (information) between
entities
Key elements:
Source - Generates data to be transmitted
Transmitter - Converts data into
transmittable signals
Transmission System - Carries data
Receiver - Converts received signal into
data
Destination - Takes incoming data

IP OVER
A Communications Model

IP OVER
Protocol Architecture
A protocol architecture is the layered
structure of hardware and software that
supports the exchange of data between
systems and supports distributed
applications, such as electronic mail and file
transfer.
At each layer of a protocol architecture, one
or more common protocols are implemented
in communicating systems. Each protocol
provides a set of rules for the exchange of
data between systems.

IP OVER
The OSI Model
In the early 1980s, ISO began work on a universal
set of specifications that would enable computer
platforms across the world to communicate openly
This model, called the Open Systems
Interconnection (OSI) Model, divides network
communications into layers
The OSI model divides the functions of a protocol
into seven layers. Each layer has the property that
it only uses the functions of the layer below, and
only exports functionality to the layer above

IP OVER
Layered Protocols
Each layer has a predefined set of functions
Layers provide services to their immediate
upper layers, hiding the details of the service
Peer layers communicate using a Peer
Protocol
Layers are separated from each others with
interfaces

Layer N
Peer Protocol
Layer N Layer N

IP OVER
Layered Protocols
Host 1 Host 2
Layer 5
Layer 5 Protocol Layer 5 Host 1 Host 2
Interface
M M
Layer 4
Layer 4 Protocol Layer 4
Interface H4 M H4 M
Layer 3
Layer 3 Protocol Layer 3
Interface H3 H4 M1 H3 M2 H3 H4 M 1 H3 M 2
Layer 2
Layer 2 Protocol Layer 2
Interface H2 H3 H4 M1 T2 H2 H3 M2 T2 H2 H3 H4 M1 T2 H2 H3 M2 T2

Layer 1
Layer 1 Protocol Layer 1

Physical Medium

IP OVER
OSI Layers
Host 1 Host 2
Application Protocol
Application Application
Interface
Presentation Protocol
Presentation Presentation
Interface
Session Protocol
Session Session
Interface
Transport Protocol
Transport Transport
Interface Communication Network
Internal Subnet Protocols
Network Layer Network Layer
Network Host-Router Network Network Host-Router Network
Protocol Protocol
Interface
Data Link Layer Data Link Layer
Data Link Host-Router Data Link Data Link Host-Router Data Link
Protocol Protocol
Interface
Physical Layer Physical Layer
Physical Host-Router Physical Physical Host-Router Physical
Protocol Protocol

IP OVER
OSI Layers
1. Physical:
Transmission of unstructured data
stream over physical medium
Data Unit: Bit (on the wire)
Lowest, or first, layer of the OSI Model
Generate voltage so as to transmit signals
Receiving data detect voltage and accept
signals
Pass on to the Data Link layer

IP OVER
OSI Layers
2. Data Link:
Transforms the physical layer to a reliable link to
achieve, node-to-node delivery
Data Unit: Frame (PPP, ATM, Ethernet,…)
Framing: Creation, detection, acknowledgment
Physical addressing
Flow control
Error control
Access control  MAC
IEEE has divided the Data Link layer into two
sublayers
Logical Link Control (LLC) - Provides common
interface, reliability and flow control.
Media Access Control (MAC) – Append physical
address to frame

IP OVER
OSI Layers
3. Network:
End-to-end delivery of packets across the
netwo rk
Data Unit: Packet (IP, IPX, RIP, OSPF)
Logical addressing
Route packets from source to destination by
using Routing protocols
4. Transport:
End-to-end delivery of the entire message
Data Unit: segment (TCP, UDP, RTP)
Service point addressing (port)
Connection and flow control
Error control

IP OVER
OSI Layers
5. Session:
Establishing and keeping alive the communications
link for the duration of the session
Synchronization connections between apps
6. Presentation:
Accept Application layer data and format it
Data format translation, encryption, and compression
7. Application:
Tools to access the network (FTP, SMTP, HTTP, …)
Separates data into Protocol Data Units (PDUs)
PDUs progress down through OSI Model layers 6, 5,
4, 3, 2, and 1

IP OVER
OSI Model
Biggest contribution: Distinction of services,
interfaces, and protocols
OSI model is very useful to classify other protocol
stacks. If you can follow this progression and
understand what's happening to every packet at each
stage, you're just conquered a huge part of
understanding networking.
In the network design OSI model, the seven layers
(Physical, Data link, Network, Transport, Session,
Presentation, and Application) can be remembered
with the mnemonic:
Please Do Not Throw Sausage Pizza Away
All People Seem To Need Data Processing
(Application -> Physical)
Any Person Studying This Needs Desperate
Psychotherapy

IP OVER
Chapter 2: TCP/IP Overview
The Internet and TCP/IP
A global information system consisting of
millions of computer networks around the
world.
History
Late 1960s, ARPA sponsors the development of a
packet-switching network, called the ARPANET.
1974, The TCP/IP protocols and model are
proposed by Cerf and Kahn.
1983, ARPANET adopts TCP/IP. At this time, the
ARPANET has 200 routers.
1984, NSF funds a TCP/IP based backbone
network. This backbone grows into the NSFNET,
which becomes the successor of the ARPANET.
1995, NSF stops funding the NSFNET. The
Internet is completely commercial.

IP OVER
Internet Organizations
ISOC CCIRN
Internet Coordination Committee for
Society Intercontinental Research Networks

IANA ICANN IETF IEPG


Internet Assigned Internet Corp Standards
Numbers Authority for Assigned Internet Engineering
Names and Numbers and Planning Group
MINC

RIPE NCC APTLD APNG


(APCCIRN/APEPG)
Europe ARIN Asia Pacific
American Registry Networking Group
for Internet Numbers APNIC
Asia-Pacific
(JCRN)
Japan

JEPG/IP
Japan
Other NIC’s VNNIC CNNIC TWNIC KRNIC JPNIC JPRS Source: Atsushi ENDO
and ISP’s Vietnam China Taiwan Korea Japan

IP OVER
TCP/IP Protocols
Internet Protocol
Suite
A combination of
different protocols
Organized into four
layers

IP OVER
OSI compared to TCP/IP

7 Application

6 Presentation Application

5 Session
Transport
4 Transport

3 Network Internet

2 Data Link Network Interface


– Network Access
1 Physical

IP OVER
Functions of the Layers
Data Link Layer
Service: Reliable transfer of frames over a link.
Functions: Synchronization, error control, flow control.
Network Layer
Service: Moves packets inside the network.
Functions: Routing, addressing, switching, congestion
control.
Transport Layer
Service: Controls delivery of data between hosts.
Functions: Connection establishment/termination,
error control, flow control.
Application Layer
Service: Handles details of application programs.
Functions: Everything is application specific.

IP OVER
Protocols in Different Layers

IP OVER
Names for Data at Each Layer

IP OVER
Encapsulation

The lower layers use


encapsulation to put
the protocol data unit
(PDU) from the upper
layer into its data field
and to add headers
and trailers that the
layer can use to
perform its function.

IP OVER
De-Encapsulation
When the data link layer receives the frame, it
does the following:
It reads the physical address and other control
information provided by the directly connected
peer data link layer.
It strips the control information from the frame,
thereby creating a datagram.
It passes the datagram up to the next layer,
following the instructions that appeared in the
control portion of the frame.

IP OVER
Transport Layer

Two main protocols:


TCP - Transmission Control Protocol
UDP - User Datagram Protocol

IP OVER
TCP
Transmission Control Protocol
Reliable connection
Connection
Temporary logical association between entities in different
systems
TCP PDU
Called “TCP segment”
Includes source and destination port
Identify respective users (applications)
Pair of ports identify a connection (together with the IP
addresses); such an identification is necessary in order
TCP to track segments between entities.

IP OVER
TCP Format
• TCP segments have a 20 byte header with >= 0 bytes of
data.
IP header TCP header TCP data
20 bytes 20 bytes

0 15 16 31

Source Port Number Destination Port Number

Sequence number (32 bits)

20 bytes
Acknowledgement number (32 bits)
header
length
0 Flags window size
TCP checksum urgent pointer

Options (if any)

DATA

IP OVER
TCP header fields
Port Number:
A port number identifies the endpoint of a
connection.
A pair <IP address, port number> identifies
one endpoint of a connection.
Two pairs <client IP address, server port
number> and <server IP address, server port
number> identify a TCP connection.
Applications Applications

Ports: 23 80 104 7 80 16 Ports:


TCP TCP

IP IP

IP OVER
The Port Numbers
The port numbers are divided into three ranges:
• The Well Known Ports, (those from 0 through 1023)
• The Registered Ports, (those from 1024 through 49151)
• The Dynamic and/or Private Ports, (those from49152
through 65535)
The Well Known Ports are controlled and assigned by
the IANA (Internet Assigned Numbers Authority)
The Registered Ports: Ports are used in TCP/UDP to
identify the ends of logical connections which provide
system services and channel communications.
A complete list of the port numbers can be obtained
from many sites on the Internet

IP OVER
Examples of Well Known Port Numbers
•ftp-data 20/tcp File Transfer [Default Data]
•ftp-data 20/udp File Transfer [Default Data]
•ftp 21/tcp File Transfer [Control]
•ftp 21/udp File Transfer [Control]
•telnet 23/tcp Telnet
•telnet 23/udp Telnet
•smtp 25/tcp Simple Mail Transfer
•smtp 25/udp Simple Mail Transfer
•tftp 69/tcp Trivial File Transfer
•tftp 69/udp Trivial File Transfer
•www-http 80/tcp World Wide Web HTTP
•www-http 80/udp World Wide Web HTTP
IP OVER
TCP header fields
Sequence Number (SeqNo):
Sequence number is 32 bits long.
So the range of SeqNo is
0 <= SeqNo <= 232 -1  4.3 Gbyte
The sequence number has a dual role. If the SYN
flag is present then this is the initial sequence
number and the first data byte is the sequence
number plus 1. Otherwise if the SYN flag is not
present then the first data byte is the sequence
number.
Initial Sequence Number (ISN) of a connection is set
during connection establishment and is random
number

IP OVER
TCP header fields
Acknowledgement Number (AckNo):
Acknowledgements are piggybacked, I.e
a segment from A -> B can contain an
acknowledgement for a data sent in the B -> A
direction
A hosts uses the AckNo field to send
acknowledgements. (If a host sends an AckNo in
a segment it sets the “ACK flag”)
The AckNo contains the next SeqNo that a
hosts wants to receive
Example:The acknowledgement for a segment
with sequence numbers 0-1500 is AckNo=1501

IP OVER
TCP header fields
Acknowledge Number (cont’d)
TCP uses the sliding window flow protocol
to regulate the flow of traffic from sender to
receiver
In transmit flow control, sliding window is
a variable-duration window that allows a
sender to transmit a specified number of
data units before an acknowledgement is
received or before a specified event
occurs.
The purpose of the sliding window is to
increase throughput.

IP OVER
TCP header fields
Header Length ( 4bits) (Data offset ):
Length of header in 32-bit words
Note that TCP header has variable length
(with minimum 20 bytes)
The minimum size header 20 bytes and
maximum of 60 bytes

IP OVER
TCP header fields
Flag bits:
URG: Urgent pointer is valid
If the bit is set, the following bytes contain
an urgent message in the range:
SeqNo <= urgent message <= SeqNo+urgent pointer
ACK: Acknowledgement Number is
valid
PSH: PUSH Flag
Notification from sender to the receiver that
the receiver should pass all data that it has
to the application
Normally set by sender when the sender’s
buffer is empty

IP OVER
TCP header fields
Flag bits:
RST: Reset the connection
The flag causes the receiver to reset the
connection
Receiver of a RST terminates the connection and
indicates higher layer application about the reset
SYN: Synchronize sequence numbers
Sent in the first packet when initiating a
connection
FIN: Sender is finished with sending
Used for closing a connection
Both sides of a connection must send a FIN

IP OVER
TCP header fields
Window Size:
Each side of the connection advertises the
window size
Window size is the maximum number of
bytes that a receiver can accept.
Maximum window size is 216-1= 65535
bytes
TCP Checksum: TCP checksum covers
over both TCP header and TCP data
Urgent Pointer: Only valid if URG flag is
set

IP OVER
Layered Headers
Each layer adds its own header to the
message that it receives from the layer
above
As far as the lower layer is concerned, the
higher layers’ headers are just a part of the
message to be delivered
The higher layers never see the lower layer
headers because the lower layers remove
them before passing the message up

IP OVER
TCP Protocol: Message
Fragmentation And Reassembly
TCP client at source divides message into
segments
Each segments gets a sequence number
Stored in the header
TCP segments becomes payload of IP packet
TCP software at destination reassembles
If arrive out of order, use sequence number

IP OVER
Example of data splits
Header Payload

Original data
TCP divides original into segments fragments…

Adds headers to new packets and passes to IP to deliver

At destination, TCP uses headers to


correctly reassemble original packet
IP OVER
Why Fragment Messages?
If part of message is lost or garbled, you
only have to resend the affected
packet(s)
Speed
Store-and-forward delay is minimized
A can send packet 1 to B while receiving
packet 2 from S
Not possible if whole message sent at once

S A B R

IP OVER
TCP Protocol: Guaranteed Delivery
Error Detection on TCP Packets
Checksum detects if IP packet is corrupt
E.g., parity check: even or odd number of 1s in
payload
If error detected, discard packet
Sender remembers packets it sent
Receiver ACKs each packet received
Clever optimization: piggyback ACK to data packet
already flowing other direction
If ACK not received within a specified timeout
interval, the sender resends packet
Receiver may get two copies!
Just ignore the second one

IP OVER
TCP Guaranteed Delivery Demo
Same as before, except
The sender will retransmit if ACK not
received within the timeout interval
When packet reaches destination, receiver
must acknowledge by telling the class the
sequence number of the packet received
The TCP header includes error checking
information.

IP OVER
TCP Service: Conversational Context
Two machines must establish a
connection before they can exchange
data
Must agree on a session ID before sending
first message
Each message includes the session ID
At end of conversation the machines agree
that the conversation is over
Called session tear-down

IP OVER
TCP Service:
Specify Process at Destination
TCP packets specify a source and destination
port number
The source and destination port numbers do not
have to be the same
The port number is used to determine which
process (application) will receive the
message
For example, port 80 specifies that the
message should be sent to a web server,
while port 23 indicates that the message is
destined for a Telnet server

IP OVER
TCP Service: Specify Process at Destination

Port Port
Process IP: Process
host-to-host

Host Host

SourcePort DestinationPort
(rest of UDP or TCP header)

Encapsulated
in IP packet

Payload

IP OVER
Identifying A Connection:
Another Use Of TCP Ports
Each side of a TCP connection is referred to
as a socket, and can be identified by the IP
(We will learn IP later) address and port
A logical connection between a source and
destination host is uniquely identified by the
two sockets involved

IP OVER
TCP States in “Normal” Connection
Lifetime
SYN (SeqNo = x) LISTEN
SYN_SENT (passive open)
(active open)
+1)
SYN (SeqNo = y, AckNo = x SYN_RCVD
(AckNo = y + 1 )
ESTABLISHED
ESTABLISHED
FIN (SeqNo = m)
FIN_WAIT_1
(active close) (AckNo = m+ 1 )
CLOSE_WAIT
(passive close)
FIN_WAIT_2
FIN (SeqNo = n )
(AckNo = n+1) LAST_ACK
TIME_WAIT

CLOSED

IP OVER
What is a SYN Flood?
SYN attack is one kind of DOS attack (Denial of
Services)
Send spoofed SYN packets to system
System responds with SYN/ACK
Never receives final connection
Backlog in connection queue
Happened with the help of BOT
Web servers are particularly vulnerable

IP OVER
UDP
Alternative to TCP is User Datagram
Protocol:
Not guaranteed delivery
No preservation of sequence
No protection against duplication
Minimum overhead

IP OVER
UDP Datagram format
 32 bits 
0 16 31
Source port Destination port

Length UDP Checksum

Data (variable)

SNMP, DNS
Lightweight file transfer: tftp, bootp
Real time application (Voice over IP, Video
conference…)

IP OVER
Network Layer
Protocols:
IP – Internet Protocol
ICMP - Internet Control Message Protocol
ARP – Address Resolution Protocol

IP OVER
Internet Protocol
Application services
Transport Services
Connectionless packet delivery service

IP layer (basic unit of transfer in TCP/IP)


provides:
Best-effort (does not discard capriciously),
unreliable (no guarantees). Packet may be lost,
duplicated, out-of-order with no notification
Connectionless (each packet treated
independently)
IP software provides routing

IP OVER
Internet datagram
Basic transfer unit
Datagram header Datagram data area
Format of Internet datagram
0 4 8 16 19 24 31
Vers Hlen Type of serv. Total length
Identification Flags Fragment offset
TTL Protocol Header Checksum
Source IP address
Destination IP address
IP Options (if any) Padding
Data

IP OVER
IP datagram format (cont.)
Vers (4 bits): version of IP protocol (IPv4=4)
Hlen (4 bits): Header length in 32 bit words,
the minimum value for this field is 5 without
options, so the header length is 5*4 = 20
Type of Service – TOS (8 bits): little used in
past, now being used for QoS
Total length (16 bits - 65,535 ): length of
datagram in bytes, includes header and data.
The minimum size datagram which any host
is required to be able to handle is 576 bytes.

IP OVER
IP datagram format (cont.)
Time to live – TTL (8bits): specifies
how long datagram is allowed to remain
in internet
Routers decrement by 1
When TTL = 0 router discards datagram
Prevents infinite loops
Protocol (8 bits): specifies the format of
the data area
Protocol numbers administered by central
authority to guarantee agreement, e.g.
TCP=6, UDP=17 …

IP OVER
IP Datagram format (cont.)
Source & destination IP address (32
bits each): contain IP address of sender
and intended recipient
Options (variable length): Mainly used
to record a route, or timestamps, or
specify routing

IP OVER
IP Fragmentation
How do we send a datagram of say 1400 bytes
through a link that has a Maximum Transfer
Unit (MTU) of say 620 bytes?
Answer the datagram is broken into fragments

Net 1 Net 3
Net 2
MTU=1500 MTU=1500
MTU=620
Router fragments 1400 byte datagrams
Into 600 bytes, 600 bytes, 200bytes (note 20 bytes
for IP header)
Routers do NOT reassemble, up to end host

IP OVER
Fragmentation Control
Identification: copied into fragment, allows
destination to know which fragments belong
to which datagram
Fragment Offset (13 bits): specifies the
offset in the original datagram of the data
being carried in the fragment
Measured in units of 8 bytes starting at 0
This method allows for a maximum packet
length of 65,528 ((2^13 - 1)*8 which
exceeds the maximum IP packet length of
65,535.

IP OVER
Fragmentation Control …
Flags (3 bits): control fragmentation
Reserved (0-th bit)
Don’t Fragment – DF (1st bit):
useful for simple (computer bootstrap)
application that can’t handle
also used for MTU discovery
if need to fragment and can’t router discards &
sends error to source
More Fragments (least sig bit): tells
receiver it has got last fragment
TCP traffic is hardly ever fragmented (due to
use of MTU discovery). About 0.5% - 0.1% of
TCP packets are fragmented .

IP OVER
So…. what does TCP/IP work?
Sender Receiver

Application Application
Layer HTTP Request Layer HTTP Request

Transport Transport
TCP HTTP Request TCP HTTP Request
Layer Layer

Network Network
IP TCP HTTP Request IP TCP HTTP Request
Layer Layer

Data Link Data Link


Layer IP TCP HTTP Request Layer IP TCP HTTP Request
Ethernet Ethernet

Physical Physical
Layer Layer

IP OVER
Chapter 3: IP Address

The Identify of devices on Internet


What is IP address
An IP address (Internet Protocol address) is
a unique number that devices use in order to
identify and communicate with each other on
a network utilizing the Internet Protocol
standard.
Any participating device — including routers,
computers, time-servers, printers, internet
FAX machines, and some telephones — must
have its own unique address.
This allows information passed onwards on
behalf of the sender to indicate where to send
it next
The receiver of the information to know that it
is the intended destination.

IP OVER
IP address versions
IPv4: The current standard protocol for the Internet,
IP addresses consist of 32 bits, which makes for over
4 billion (4,294,967,296) unique host interface
addresses in theory.
IPv5: Existed only as an experimental non-IP real
time streaming protocol. In keeping with standard
UNIX release conventions, This version was never
intended to be implemented; the protocol was not
abandoned.
IPv6: The new (but not yet widely deployed) standard
protocol for the Internet, addresses are 128 bits wide,
which, even with generous assignment of netblocks,
should suffice for the foreseeable future. In theory,
there would be exactly 2^128, or about
3.4028236692093846346337460743177 × 1038
unique host interface addresses.

IP OVER
IPv4 Addressing
IP address is a 32 bit integer
Refers to interface rather than host is a unique
number that devices use in order to identify and
communicate with each other on a network utilizing
the Internet Protocol standard.
Consists of network and host portions
Enables routers to keep 1 entry/network instead of
1/host
Class A, B, C for unicast
Class D for multicast (IGMP)
Class E reserved
Written as 4 octets/bytes in decimal format
E.g. 134.79.16.1, 127.0.0.1

IP OVER
Finding the class in decimal notation

IP OVER
Finding the class in binary notation

IP OVER
Network ID vs. Host ID
Network ID is the part which says what
network the computer is on.
Host is the part which says which
computer it is.

IP OVER
Example
10000011 01101011 00000011 00011000
131 . 107 . 3 . 24

Network ID Host ID

IP OVER
Netid and hostid

IP OVER
Number of networks etc.

Number of Number of hosts First octet


networks per Network starts with

Class A 126 16 777 214 1- 126

Class B 16 384 65 534 128 - 191

Class C 2 097 152 254 192 - 223

IP OVER
Special IP addresses
Private addresses
3 ranges of addresses were defined as
being “private”
These addresses are specifically dropped
by routers on the internet
Millions of computers in the world can have
the same private address, but they are not
DIRECTLY connected to the internet,
something (Firewall, Router) is translating
their address to a real one.
Loop-Back address: 127.0.0.1

IP OVER
The “Private” Addresses

10.0.0.0 - 10.255.255.255

172.16.0.0 - 172.31.255.255

192.168.0.0 - 192.168.255.255

IP OVER
Subnet Addressing
Subnet mask
Indicates how much of the IP address
represents the network or subnetwork
Standard (default) subnet masks are as
follows:
Class A subnet mask is 255.0.0.0
Class B subnet mask is 255.255.0.0
Class C subnet mask is 255.255.255.0

IP OVER
Subnet Addressing

Figure 3-
17:
ANDing
operations

IP OVER
Subnet Address
One of the IP networking rules
stipulates that a TCP/IP host must have
a nonzero host identifier
From this information, you can determine
that on a subnet using mask
255.255.255.0, the IP address
122.12.150.4 is a valid host IP address
However, the address 222.12.150.0 is not
a host address, but a network identifier

IP OVER
Subnet Masking

Figure 3-21:
Subnet mask
values

IP OVER
Learning to Subnet

Figure 3-22: Subnet masking example

IP OVER
CIDR
Classless Inter-
Domain Routing
(CIDR)
Notation method that
specifies the number
of masked bits in an
IP address/subnet
mask combination

IP OVER
Broadcast Types
Broadcast types
There are two different types of
broadcasts:
Flooded broadcasts
Directed broadcasts

IP OVER
Broadcast types …

IP OVER
Class D: Multicast
Multicast is the delivery of information to a
group of destinations simultaneously using
the most efficient strategy to deliver the
messages over each link of the network
only once and only create copies when the
links to the destinations split
Example of protocols supported Multicast :
Internet Group Management Protocol (IGMP)
Multicast OSPF (MOSPF)
Multicast BGP (MBGP)

IP OVER
Chapter 3: Routing

Help data goes in right way


Type of routing protocols
Static routing protocol
Dynamic routing protocols:
Distance-vector routing protocol : They use
the Bellman-Ford algorithm to calculate
paths, poor convergence
Link state algorithm: They generally use
some variant of Dijkstra's algorithm to
calculate the shortest path

IP OVER
Understanding Packet Transmission:
Routers on the Network

Figure 3-26:
Configuration
of a router
with four
segments

IP OVER
The Internet Network layer

Host, router network layer functions:

Transport layer: TCP, UDP

Routing protocols IP protocol


•path selection •addressing conventions
•RIP, OSPF, BGP •datagram format
Network •packet handling conventions
layer routing
table ICMP protocol
•error reporting
•router “signaling”

Link layer

physical layer

IP OVER
Network with Router
IP address: 32-bit identifier
for host, router interface 223.1.1.1
interface: connection 223.1.2.1
between host, router and 223.1.1.2
223.1.1.4 223.1.2.9
physical link
router’s typically have 223.1.1.3 223.1.3.27
223.1.2.2
multiple interfaces
host may have multiple
interfaces
223.1.3.1 223.1.3.2
IP addresses associated
with interface, not host,
router
223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 1 1

IP OVER
IP Addressing
IP address:
network part (high order 223.1.1.1
bits)
223.1.2.1
host part (low order bits) 223.1.1.2
223.1.1.4 223.1.2.9
What’s a network ?
(from IP address 223.1.2.2
223.1.1.3 223.1.3.27
perspective)
device interfaces with LAN
same network part of IP
address 223.1.3.1 223.1.3.2
can physically reach
each other without
intervening router network consisting of 3 IP networks
(for IP addresses starting with 223,
first 24 bits are network address)

IP OVER
IP Addressing
223.1.1.2
How to find the 223.1.1.1 223.1.1.4

networks? 223.1.1.3

Detach each
223.1.9.2 223.1.7.0
interface from
router, host
Create “islands of 223.1.9.1 223.1.7.1
isolated networks 223.1.8.1 223.1.8.0

223.1.2.6 223.1.3.27

Interconnected 223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2


system consisting
of six networks

IP OVER
Delivery of an IP datagram
View at the data link layer layer:
Internetwork is a collection of LANs or point-to-
point links or switched networks that are
connected by routers
R1 R2

Point-to-point link Point-to-point link


H2

Network of
Ethernet
switches
Ethernet

IP
H1 R3 R4
Token
Ring
Ethernet LAN
IP OVER
Delivery of an IP datagram
View at the IP layer:
An IP network is a logical entity with a network number
We represent an IP network as a “cloud”
The IP delivery service takes the view of clouds, and
ignores the data link layer view
R1 R2
10.2.1.0/24 20.2.1.0/28
H2
10.1.2.0/24 20.1.0.0/16
IP

10.1.0.0/24 10.3.0.0/16
H1 R3 R4

IP OVER
Routing tables
Each router and each host keeps a routing table which tells the
router how to process an outgoing packet
Main columns:
1. Destination address: where is the IP datagram going to?
2. Next hop: how to send the IP datagram?
3. Interface: what is the output port?
Next hop and interface column can often be summarized
as one column
Destination Next interfac
Hop e
Routing table of a host or router 10.1.0.0/24 direct eth0
IP datagrams can be directly delivered 10.1.2.0/24 direct eth0
(“direct”) or is sent to a router (“R4”) 10.2.1.0/24 R4 serial0
10.3.1.0/24 direct eth1
20.1.0.0/16 R4 eth0
20.2.1.0/28 R4 eth0
IP OVER
Delivery with routing tables
D e s tin a tio n N ext H op D e s tin a tio n N ext H op D e s tin a tio n N ext H op
1 0 .1 .0 .0 /2 4 R3 1 0 .1 .0 .0 /2 4 R1 1 0 .1 .0 .0 /2 4 R2
1 0 .1 .2 .0 /2 4 d ire c t 1 0 .1 .2 .0 /2 4 R1 1 0 .1 .2 .0 /2 4 R2
1 0 .2 .1 .0 /2 4 d ire c t 1 0 .2 .1 .0 /2 4 d ire c t 1 0 .2 .1 .0 /2 4 R2
1 0 .3 .1 .0 /2 4 R3 1 0 .3 .1 .0 /2 4 R4 1 0 .3 .1 .0 /2 4 R2
2 0 .2 .0 .0 /1 6 R2 2 0 .1 .0 .0 /1 6 d ire c t 2 0 .1 .0 .0 /1 6 R2
3 0 .1 .1 .0 /2 8 R2 2 0 .2 .1 .0 /2 8 d ire c t 2 0 .2 .1 .0 /2 8 d ire c t

R1 R2
1 0 .2 .1 .0 /2 4 2 0 .2 .1 .0 /2 8
H2
2 0 .2 .1 .2 /2 8
1 0 .1 .2 .0 /2 4 2 0 .1 .0 .0 /1 6

to: 1 0 .1 .0 .0 /2 4 1 0 .3 .0 .0 /1 6
20.2.1.2
H1 R3 R4

D e s tin a tio n N ext H op D e s tin a tio n N ext H op D e s tin a tio n N ext H op


1 0 .1 .0 .0 /2 4 d ire c t 1 0 .1 .0 .0 /2 4 d ire c t 1 0 .1 .0 .0 /2 4 R3
1 0 .1 .2 .0 /2 4 R3 1 0 .1 .2 .0 /2 4 d ire c t 1 0 .1 .2 .0 /2 4 R3
1 0 .2 .1 .0 /2 4 R3 1 0 .2 .1 .0 /2 4 R4 1 0 .2 .1 .0 /2 4 R2
1 0 .3 .1 .0 /2 4 R3 1 0 .3 .1 .0 /2 4 d ire c t 1 0 .3 .1 .0 /2 4 d ire c t
2 0 .1 .0 .0 /1 6 R3 2 0 .1 .0 .0 /1 6 R4 2 0 .1 .0 .0 /1 6 d ire c t
2 0 .2 .1 .0 /2 8 R3 2 0 .2 .1 .0 /2 8 R4 2 0 .2 .1 .0 /2 8 R2

IP OVER
Delivery of IP datagrams
There are two distinct processes to delivering
IP datagrams:
1. Forwarding: How to pass a packet from
an input interface to the output interface?
2. Routing: How to find and setup the
routing tables?
Forwarding must be done as fast as possible:
on routers, is often done with support of hardware
on PCs, is done in kernel of the operating system
Routing is less time-critical
On a PC, routing is done as a background process

IP OVER
Processing of an IP datagram in IP
Routing Static
UDP TCP
Protocol routing

Demultiplex

Yes

Lookup next Yes IP forwarding No Destination


routing
hop enabled? address local?
table

No
Send Input
IP module datagram Discard queue

Data Link Layer


IP router: IP forwarding enabled
Host: IP forwarding in default is disabled
IP OVER
Processing of an IP datagram in IP
Processing of IP datagrams is very similar on an IP
router and a host
Main difference:
“IP forwarding” is enabled on router and disabled
on host
IP forwarding enabled
 if a datagram is received, but it is not for the local
system, the datagram will be sent to a different
system
IP forwarding disabled
 if a datagram is received, but it is not for the local
system, the datagram will be dropped

IP OVER
Processing of an IP datagram at a router

Receive an
IP datagram 1. IP header validation
2. Process options in IP header
3. Parsing the destination IP address
4. Routing table lookup
5. Decrement TTL
6. Perform fragmentation (if necessary)
7. Calculate checksum
8. Transmit to next hop
9. Send ICMP packet (if necessary)

IP OVER
How do routing tables get updated?
Adding an interface:
Configuring an interface eth2 Destination Next Hop/
with 10.0.2.3/24 adds a routing interface
table entry 10.0.2.0/24 eth2
Adding a default gateway:
Configuring 10.0.2.1 as the
default gateway adds the
entry: Destination Next Hop/
Static configuration of interface
network routes or host 0.0.0.0/0 10.0.2.1
routes
Update of routing tables
through routing protocols
ICMP messages

IP OVER
Routing table manipulations with ICMP
When a router detects that an IP datagram
should have gone to a different router, the
router (here R2)
forwards the IP datagram to the correct router
sends an ICMP redirect message to the host (If need)
Host uses ICMP message to update its
routing table Destination Next Hop
R1 R2 10.1.0.0/24 R1
(2) IP datagram …

(3) ICMP redirect


(1) IP datagram

Ethernet

Destination Next Hop


10.1.0.0/24 R2

R1
H1
IP OVER
Routing in the Internet
The Global Internet consists of
Autonomous Systems (AS) interconnected
with each other:
Stub AS: small corporation
Multihomed AS: large corporation (no transit)
Transit AS: provider
Two-level routing:
IGP: Use inside an AS
EGP : Use between AS to exchange Routing
information

IP OVER
Internet AS Hierarchy

EGP for exterior gateway routers

IGP for interior gateway routers

IP OVER
IGP Routing
Stand for Internal Gateway Protocols
Most common IGPs:

RIP: Routing Information Protocol

OSPF: Open Shortest Path First

IGRP: Interior Gateway Routing Protocol


(Cisco propr.)
EIGRP: Enhanced Interior Gateway
Routing Protocol

IP OVER
RIP ( Routing Information Protocol)
Distance vector algorithm (Bellman-Ford )
Distance metric: # of hops (max = 15
hops)

Distance vectors: exchanged every 30 sec


via Response Message (also called
advertisement)
Each advertisement: route to up to 25
destination nets

IP OVER
RIP (Routing Information Protocol)

z
w x y
A D B

C
Destination Network Next Router Num. of hops to dest.
w A 2
y B 2
z B 7
x -- 1
…. …. ....
Routing table in D

IP OVER
RIP: Link Failure and Recovery
If no advertisement heard after 180 sec -->
neighbor/link declared dead
routes via neighbor invalidated
new advertisements sent to neighbors
neighbors in turn send out new
advertisements (if tables changed)
link failure info quickly propagates to entire
net
poison reverse used to prevent ping-pong
loops (infinite distance = 16 hops)

IP OVER
RIP Table processing
RIP routing tables managed by application-
level process called route-d (daemon)
Advertisements sent in UDP packets,
periodically repeated

IP OVER
RIP Table example (continued)

Router: giroflee.eurocom.fr
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ------ ---------
127.0.0.1 127.0.0.1 UH 0 26492 lo0
192.168.2. 192.168.2.5 U 2 13 fa0
193.55.114. 193.55.114.6 U 3 58503 le0
192.168.3. 192.168.3.5 U 2 25 qaa0
224.0.0.0 193.55.114.6 U 3 0 le0
default 193.55.114.129 UG 0 143454

Three attached class C networks (LANs)


Router only knows routes to attached LANs
Default router used to “go up”
Route multicast address: 224.0.0.0
Loopback interface (for debugging)

IP OVER
OSPF (Open Shortest Path First)
“open”: publicly available
Uses Link State algorithm
LS packet dissemination
Topology map at each node
Route computation using Dijkstra’s algorithm

OSPF advertisement carries one entry per


neighbor router
Advertisements disseminated to entire AS (via
flooding)

IP OVER
OSPF “advanced” features (not in RIP)
Security: all OSPF messages authenticated (to
prevent malicious intrusion); TCP connections used
Multiple same-cost paths allowed (only one path in
RIP)
For each link, multiple cost metrics for different TOS
(eg, satellite link cost set “low” for best effort; high
for real time)
Integrated uni- and multicast support:
Multicast OSPF (MOSPF) uses same topology data base
as OSPF
Hierarchical OSPF in large domains.

IP OVER
Hierarchical OSPF

IP OVER
Hierarchical OSPF
Two-level hierarchy: local area, backbone.
Link-state advertisements only in area
each nodes has detailed area topology; only
know direction (shortest path) to nets in other
areas.
Area border routers: “summarize” distances to
nets in own area, advertise to other Area Border
routers.
Backbone routers: run OSPF routing limited to
backbone.
Boundary routers: connect to other ASs.

IP OVER
IGRP (Interior Gateway Routing Protocol)

CISCO proprietary; successor of RIP (mid


80s)
Distance Vector, like RIP
Several cost metrics (delay, bandwidth,
reliability, load etc)
Uses TCP to exchange routing updates
Loop-free routing via Distributed Updating
Algorithm. (DUAL) based on diffused
computation

IP OVER
EGP; the Inter-AS routing

IP OVER
Internet inter-AS routing: BGP
BGP (Border Gateway Protocol):
Path Vector protocol:
Similar to Distance Vector protocol
Each Border Gateway broadcast to
neighbors (peers) entire path (I.e,
sequence of ASs) to destination
E.g., Gateway X may send its path to dest. Z:

Path (X,Z) = X,Y1,Y2,Y3,…,Z

IP OVER
Internet inter-AS routing: BGP
Suppose: gateway X send its path to peer
gateway W
W may or may not select path offered by X
Cost, policy (don’t route via competitors AS),
loop prevention reasons.
If W selects path advertised by X, then:
Path (W,Z) = W, Path (X,Z)
Note: X can control incoming traffic by
controlling its route advertisements to peers:
e.g., don’t want to route traffic from Z -> don’t
advertise any routes to Z

IP OVER
Internet inter-AS routing: BGP
BGP messages exchanged using TCP.
BGP messages:
OPEN: opens TCP connection to peer and
authenticates sender
UPDATE: advertises new path (or withdraws
old)
KEEPALIVE keeps connection alive in
absence of UPDATES; also ACKs OPEN
request
NOTIFICATION: reports errors in previous
msg; also used to close connection

IP OVER
Introduction to Routers
The Cisco IOS
The Cisco IOS (Internetwork Operating System)
is the operating system of all Cisco routers and
Catalyst switches
The IOS provides the following network services:
Basic routing and switching functions
Reliable and secure access to networked resources
Network scalability
The Cisco IOS software uses a command-line
interface (CLI) as the traditional console
environment.

IP OVER
Methods of Accessing the CLI
Through a console session
uses a low speed serial connection directly from a computer
or terminal to the console connection on the router

Through a dialup connection


uses a modem connected to the router AUX port

Note: Neither of the above methods require that the router


have any network services configured

Telnet to the router


at least one interface must be configured with an IP
address, and virtual terminal sessions must be configured
for login and passwords.

IP OVER
Router User Modes

The Cisco command-line interface (CLI) uses


a hierarchical structure

Mainly, there are two access levels


user EXEC mode
privileged EXEC mode (also called enable mode)

IP OVER
User EXEC vs. Privileged EXEC
User EXEC mode
allows only a limited number of basic monitoring commands
referred to as a “view only” mode
cannot change router configuration
identified by the “>" prompt
Privileged EXEC mode
accesses all router commands (including configuration)
can be configured to require a password and user ID so that
only authorized users access the router.
Global configuration mode and all other more specific
configuration modes can only be reached from the
privileged EXEC mode
identified by the "#" prompt

IP OVER
Moving Between User EXEC and Privilege
EXEC

or “en” for short

or “dis” for short

or “ex” for short

IP OVER
Cisco IOS Software Features
There are numerous IOS images for different
Cisco device models and feature sets
But basic configuration command structure is the
same

Configuration and troubleshooting skills acquired on


any one device apply across a wide range of products

The Cisco Software Advisor is an interactive


tool that provides the most current information
and
Allows for the selection of options that meet network
requirements.

IP OVER
Cisco IOS Software Features

The naming convention for the different


Cisco IOS releases contains three parts:
The platform on which the image runs
The special features supported in the image
Where the image runs and whether it has
been zipped or compressed

IP OVER
The Show Version Command
When selecting a new IOS image…
Make sure it is compatibility with the router flash
and RAM memory
Newer releases have more more features and
require more memory
Before installing, check to see if the router
meets the memory requirements for that
image which include:
Flash Memory
RAM

IP OVER
The Show Version Command
Use the show version command to…

Check the current IOS image


The Cisco support site has tools available to help determine the amount of flash and RAM required for each
image

Check the amount of RAM

Show the configuration-register

IOS Image file

RAM

Configuration register

IP OVER
The Show Version Command
The following information can be obtained from the show
version command:

IOS version and descriptive information


Bootstrap ROM version
Boot ROM version
Router up time
Last restart method
System image file and location
Router platform
Configuration register setting
Number and type of interfaces on the router
• NOTE: Use the show version command to identify
router IOS image and boot source

IP OVER
Show Flash Command
To find out the amount of flash
memory…

issue the show flash command

IP OVER
Operating Environments

The Cisco IOS devices have three distinct operating environments or modes:

ROM monitor (cannot be accessed through any of the network interfaces)


Boot ROM (limited subset of the Cisco IOS feature set)
Cisco IOS (normal operations)

To change the default start up mode of the router, the system administrator can change the
configuration register setting

IP OVER
Router Initialization

A router initializes by loading the…


bootstrap
operating system
configuration file

If the router cannot find a configuration file, it enters setup mode

Performs POST first (tests hardware)

IP OVER
Examining Initial Router Bootup
“NVRAM invalid, possibly due to write
erase”

router has not been configured yet or that


the NVRAM has been erased

The router must be configured and the


configuration file saved to NVRAM

IP OVER
Establishing a HyperTerminal Session
To connect a terminal to the console port
on the router:

Connect the terminal using the rollover


cable and an RJ-45 to DB-9 or RJ-45 to DB-
25 adapter

Configure the terminal or PC terminal


emulation software for: 9600 baud, 8 data
bits, no parity, 1 stop bit, and no flow
control

IP OVER
RECAP of Router Access Levels
For security purposes, the router has two
levels of access to commands:

User EXEC mode – Typical tasks include


those that check the router status. In this
mode, router configuration changes are not
allowed

Privileged EXEC mode – Typical tasks


include those that change the router
configuration

to make configuration changes, you must enter


global configuration mode – type config t)

IP OVER
Router Configuration Modes
The following are specific sub-modes that can be
accessed from the global configuration mode:

Interface
Subinterface
Line
Router
Route-map

disable command or exit returns user to the privileged


EXEC mode from the global configuration mode

Ctrl-Z returns user directly to the privileged EXEC mode


from any sub-mode of global configuration.

IP OVER
Help with the Router CLI
To access help type a question mark (?)

Whenever a "--More--" prompt appears, the


next available screen can be viewed by
pressing the space bar

To display just the next line, press the Return


or Enter key. Press any other key to return to
the prompt

The caret symbol (^) indicates a syntax error in


a command (The placement of the caret symbol
shows where the possible problem is located)

IP OVER
IOS Editing Functions

IP OVER
IOS Command History

The command history is enabled by default


and the system records ten command lines
in its history buffer

The maximum number of commands is 256

IP OVER
Thank you very much!

Você também pode gostar