Escolar Documentos
Profissional Documentos
Cultura Documentos
Interconnecting
Networks with
TCP/IP
© 2000, Cisco Systems, Inc. 81
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—82
Objectives
Upon completion of this chapter you will
be able to perform the following tasks:
• Identify the IP protocol stack, its protocol layer
functions, and commonly used IP protocols
• Identify IP address classes, IP addresses, IP subnet
masks, IP network numbers, subnet numbers, and
possible host numbers.
• Configure IP addresses and subnet masks on a
router interface and optionally configure a host table.
• Interconnect the VLANs with a layer three device
such as a router on a stick.
Internet
TCP/IP
Early protocol suite
Universal
7 Application
6 Presentation 5
Application
5 Session
4
4 Transport Transport
3
3 Network Internet
2
2 Data Link Data Link
1
1 Physical Physical
File Transfer
TFTP *
FTP *
NFS
EMail
Application SMTP
Remote Login
Telnet *
rlogin *
Transport Network Management
SNMP *
Internet Name Management
DNS*
Data Link
*Used by the router
Physical
Transmission Control Connection
Application Protocol (TCP) Oriented
Data Link
Physical
Source port (16) Destination port (16)
Sequence number (32)
Acknowledgement number (32) 20
Bytes
Header
length (4) Reserved (6) Code bits (6) Window (16)
Checksum (16) Urgent (16)
Options (0 or 32 if any)
Data (varies)
F T S D T S R
Application T E M N F N I
Layer
P L T S T M P
N P P P
E
T
21 23 25 53 69 161 520 Port
Transport Numbers
Layer TCP UDP
Source Dest.
…
Port Port
Telnet Z
Host A Host Z
SP DP Dest. port = 23.
1028 23 … Send packet to my
Telnet
application.
Send SYN
1 (seq=100 ctl=SYN)
SYN received
Send SYN
1 (seq=100 ctl=SYN)
SYN received
Send SYN, ACK 2
SYN received (seq=300 ack=101 ctl=syn,ack)
Send SYN
1 (seq=100 ctl=SYN)
SYN received
Send SYN, ACK 2
SYN received (seq=300 ack=101 ctl=syn,ack)
Established
3 (seq=101 ack=301 ctl=ack)
Window size = 1
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—814
TCP Simple Acknowledgment
Sender Receiver
Send 1
Receive 1
Window size = 1
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—815
TCP Simple Acknowledgment
Sender Receiver
Send 1
Receive 1
Send ACK 2
Receive ACK 2
Window size = 1
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—816
TCP Simple Acknowledgment
Sender Receiver
Send 1
Receive 1
Send ACK 2
Receive ACK 2
Send 2
Receive 2
Window size = 1
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—817
TCP Simple Acknowledgment
Sender Receiver
Send 1
Receive 1
Send ACK 2
Receive ACK 2
Send 2
Receive 2
Send ACK 3
Receive ACK 3
Window size = 1
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—818
TCP Simple Acknowledgment
Sender Receiver
Send 1
Receive 1
Send ACK 2
Receive ACK 2
Send 2
Receive 2
Send ACK 3
Receive ACK 3
Send 3
Receive 3
Window size = 1
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—819
TCP Simple Acknowledgment
Sender Receiver
Send 1
Receive 1
Send ACK 2
Receive ACK 2
Send 2
Receive 2
Send ACK 3
Receive ACK 3
Send 3
Receive 3
Receive ACK 4 Send ACK 4
Window size = 1
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—820
TCP Sequence and
Acknowledgment Numbers
Source Dest. Sequence Acknowledgement …
Port Port # #
I just
sent #10.
I just
sent #10.
I just got #10,
now I need #11.
Source Dest. Seq. Ack.
23 1028 1 11
I just
sent #11.
I just got #10,
now I need #11.
Source
Source Dest.
Dest. Seq. Ack.
Seq. Ack.
23 1028 1 11
1028 23 11 2
I just
sent #11.
I just got #11,
now I need #12.
Source
Source Dest.
Dest. Seq. Ack.
Seq. Ack.
23 1028 100 11
23 1028 101 12
Sender Receiver
Window size = 3
Sender Send 1 Receiver
Window size = 3
Send 2
Window size = 3
Send 3
Window size = 3
Sender Send 1 Receiver
Window size = 3
Send 2
Window size = 3
Send 3
ACK 3 Packet 3 is
Window size = 2
Dropped
Window size = 3
Sender Send 1 Receiver
Window size = 3
Send 2
Window size = 3
Send 3
ACK 3 Packet 3 is
Window size = 2
Dropped
Window size = 3
Send 3
Window size = 3
Send 4
Window size = 3 Window size = 3
Sender Send 1 Receiver
Window size = 3
Send 2
Window size = 3
Send 3
ACK 3 Packet 3 is
Window size = 2 Dropped
Window size = 3
Send 3
Window size = 3
Send 4
ACK 5
Window size = 2
Source port (16) Destination port (16)
8
Bytes
Length (16) Checksum (16)
Data (if any)
No sequence or acknowledgment fields
Internet Protocol (IP)
Application
Internet Control Message
Transport Protocol (ICMP)
Internet Address Resolution
Protocol (ARP)
Data Link
Reverse Address
Physical Resolution Protocol (RARP)
OSI network layer corresponds to the
TCP/IP internet layer
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—831
IP Datagram
Bit 0
1 Bit 15 Bit 16 Bit 31
Version Header Priority & Type
(4) Length (4) Total Length (16)
of Service (8)
Flags
Identification (16) (3) Fragment offset (13)
Destination IP Address (32)
Options (0 or 32 if any)
Data (varies if any)
Transport
TCP UDP
Layer
6 17 Protocol
Numbers
Internet
Layer IP
Determines destination upperlayer protocol
Application
Transport Destination
1 Unreachable
ICMP
Echo (Ping)
Internet
Other
Data Link
Physical
I need the
Ethernet
address of
176.16.3.2.
172.16.3.1 172.16.3.2
IP: 172.16.3.2 = ???
I need the
I heard that broadcast.
Ethernet
The message is for me.
address of
Here is my Ethernet
176.16.3.2.
address.
172.16.3.1 172.16.3.2
IP: 172.16.3.2 = ???
I need the
I heard that broadcast.
Ethernet
The message is for me.
address of
Here is my Ethernet
176.16.3.2.
address.
172.16.3.1 172.16.3.2
IP: 172.16.3.2 = ???
IP: 172.16.3.2
Ethernet: 0800.0020.1111
I need the
I heard that broadcast.
Ethernet
The message is for me.
address of
Here is my Ethernet
176.16.3.2.
address.
172.16.3.1 172.16.3.2
IP: 172.16.3.2 = ???
IP: 172.16.3.2
Ethernet: 0800.0020.1111
Map IP MAC
Local ARP
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—838
Reverse ARP
What is
my IP
address?
Ethernet: 0800.0020.1111 IP = ???
I heard that
broadcast.
What is
Your IP
my IP
address is
address?
172.16.3.25.
Ethernet: 0800.0020.1111 IP = ???
I heard that
broadcast.
What is
Your IP
my IP
address is
address?
172.16.3.25.
Ethernet: 0800.0020.1111 IP = ???
Ethernet: 0800.0020.1111
IP: 172.16.3.25
I heard that
broadcast.
What is
Your IP
my IP
address is
address?
172.16.3.25.
Ethernet: 0800.0020.1111 IP = ???
Ethernet: 0800.0020.1111
IP: 172.16.3.25
Map MAC IP
172.18.0.1 172.16.0.1
172.18.0.2 172.16.0.2
HDR SADA DATA
10.13.0.0 192.168.1.0
10.13.0.1 172.17.0.1 172.17.0.2 192.168.1.1
• Unique addressing allows communication
between end stations
• Path choice is based on destination address
Location is represented by an address
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—843
IP Addressing
32 bits
otted
Network Host
ecimal
128
8
4
2
64
32
16
128
64
32
16
8
4
2
1
128
64
32
16
128
64
32
16
8
4
2
1
8
4
2
1
128
64
32
16
8
4
2
64
32
16
8
4
2
1
128
64
32
16
128
64
32
16
8
4
2
128
1
8
4
2
172 1
16 122 204
Example
Decimal
Example 10101100 00010000 01111010 11001100
Binary
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—846
IP Address Classes
Class D: Multicast
Class E: Research
Bits: 1 8 9 16 17 24 25 32
0NNNNNNN Host Host Host
Class A:
Range (1126)
Bits: 1 8 9 16 17 24 25 32
10NNNNNN Network Host Host
Class B:
Range (128191)
1 8 9 16 17 24 25 32
Bits:
110NNNNN Network Network Host
Class C:
Range (192223)
1 8 9 16 17 24 25 32
Bits:
1110MMMM Multicast Group Multicast Group Multicast Group
Class D:
Range (224239)
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—848
Host Addresses
172.16.2.2 10.1.1.1
10.6.24.2
E1
172.16.3.10 E0 10.250.8.11
172.16.2.1
172.16.12.12 10.180.30.118
Routing Table
172.16 . 12 . 12 Network Interface
Network Host 172.16.0.0 E0
10.0.0.0 E1
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—849
Determining Available Host
Addresses
Network Host
172 16 0 0
N
16
15
14
13
12
11
108
9
7
6
5
4
3
2
1
10101100 00010000 00000000 00000000 1
00000000 00000001 2
00000000 00000011 3
11111111 1111110165534
...
...
...
11111111 1111111065535
11111111 1111111165536
2
2N2 = 2162 = 65534 65534
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—850
IP Address Classes Exercise
10.2.1.1
128.63.2.100
201.222.5.64
192.6.141.2
130.113.64.16
256.241.201.10
256.241.201.10 Nonexistent
…...
172.16.0.0
Network 172.16.0.0
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—853
Addressing with Subnets
172.16.3.0
172.16.4.0
172.16.1.0 172.16.2.0
Network 172.16.0.0
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—854
Subnet Addressing
172.16.2.200 172.16.3.5
172.16.3.1
E1
172.16.2.2 E0 172.16.3.100
172.16.2.1
172.16.2.160 172.16.3.150
New Routing Table
172.16 . 2 . 160 Network Interface
Network Host 172.16.0.0 E0
172.16.0.0 E1
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—855
Subnet Addressing
172.16.2.200 172.16.3.5
172.16.3.1
E1
172.16.2.2 E0 172.16.3.100
172.16.2.1
172.16.2.160 172.16.3.150
New Routing Table
172.16 . 2 . 160 Network Interface
Network Subnet Host 172.16.2.0 E0
172.16.3.0 E1
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—856
Subnet Mask
Network Host
IP
Address
172 16 0 0
Network Host
Default
Subnet
Mask
255 255 0 0
11111111 11111111 00000000 00000000
Also written as “/16” where 16 represents the number of 1s
in the mask.
Network Subnet Host
8bit
Subnet 255 255 255 0
Mask
Also written as “/24” where 24 represents the number of 1s
in the mask.
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—857
Decimal Equivalents of Bit
Patterns
128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0 = 0
1 0 0 0 0 0 0 0 = 128
1 1 0 0 0 0 0 0 = 192
1 1 1 0 0 0 0 0 = 224
1 1 1 1 0 0 0 0 = 240
1 1 1 1 1 0 0 0 = 248
1 1 1 1 1 1 0 0 = 252
1 1 1 1 1 1 1 0 = 254
1 1 1 1 1 1 1 1 = 255
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—858
Subnet Mask without Subnets
Network Host
Network 172 16 0 0
Number
Subnets not in use—the default
192
224
240
248
252
254
255
128
Network
Number 172 16 2 0
Network number extended by eight bits
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—860
Subnet Mask with Subnets
(cont.)
Network Subnet Host
192
224
240
248
252
254
128
255
192
240
248
252
254
255
128
224
Network
Number 172 16 2 128
Network number extended by ten bits
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—861
Subnet Mask Exercise
172.16.2.10 255.255.255.0
10.6.24.20 255.255.240.0
10.30.36.12 255.255.255.0
172.16.3.0
172.16.4.0
172.16.1.0
172.16.3.255 172.16.2.0
(Directed broadcast)
255.255.255.255 X
(Local network broadcast)
172.16.255.255
(All subnets broadcast)
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—864
Addressing Summary
Example
172 16 2 160
255.255.255.192 Mask
Subnet 4
Broadcast
First
Last
Subnet
Broadcast
First
Last
Subnet
Broadcast
First
Last 7
10000000 Subnet 4
Broadcast
First
Last
10000000 Subnet 4
10111111 Broadcast
5
First 6
Last
10000000 Subnet 4
10111111 Broadcast
5
10000001 First 6
Last
10000000 Subnet 4
10111111 Broadcast
5
10000001 First 6
10111110 Last 7
Subnet Address = 172.16.2.0
Host Addresses = 172.16.2.1–172.16.2.254
Broadcast Address = 172.16.2.255
Eight bits of subnetting
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—874
Subnet Planning
20 subnets
5 hosts per subnet
Class C address:
192.168.5.0
192.168.5.16
Other
subnets
192.168.5.32 192.168.5.48
Subnet Address = 192.168.5.120
Host Addresses = 192.168.5.121–192.168.5.126
Broadcast Address = 192.168.5.127
Five Bits of Subnetting
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—876
Broadcast Addresses Exercise
201.222.10.60 255.255.255.248
15.16.193.6 255.255.248.0
128.16.32.13 255.255.255.252
153.50.6.27 255.255.255.128
Switch(config)#ip address ipaddress subnetmask
• Assigns an address and subnet mask
• Starts IP processing on a switch
Switch(config)#ip defaultgateway ipaddress
• Specifies a default gateway
Router(configif)#ip address ipaddress subnetmask
• Assigns an address and subnet mask
• Starts IP processing on a router interface
• Sets display format of network mask for
current session
Router(configline)#ip netmaskformat
{bitcount | decimal | hexadecimal}
• Sets format of network mask for a
specific line
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—881
Router IP Host Names
Router(config)#ip host name [tcpportnumber]
address [address]
• Defines static host name to IP address
mapping
ip host Norine 172.16.3.1 192.168.3.1
ip host Roger 172.16.4.3
• Hosts/interfaces selectable by name or IP
address
Router(config)#ip nameserver serveraddress1
[[serveraddress2]...[serveraddress6]]
• Specifies one or more hosts that supply
host name to logical address resolution
Router(config)#ip domainlookup
Router(config)#end
Router#pat
Translating ”pat"...domain server (255.255.255.255)
% Unknown command or computer name, or unable to find computer address
Router#config t
Router(config)#no ip domainlookup
Router(config)#end
Router#pat
Translating ”pat"
% Unknown command or computer name, or unable to find computer address
Router#
• DNS enabled by default
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—884
Router Display Host Names
Router#show hosts
Default domain is not set
Name/address lookup uses domain service
Name servers are 255.255.255.255
Host Flags Age Type Address(es)
Norine (perm, OK) 0 IP 172.16.100.100
Roger (perm, OK) 0 IP 172.16.100.101
Frank (perm, OK) 0 IP 172.16.200.200
Bob (perm, OK) 0 IP 172.16.200.201
• Shows the host table
Fa0/0 Router on
a stick
ISL
VLAN 1 VLAN 2
Application
TCP
IP
10.1.1.2 10.2.2.2
ISL
Ethernet
Network layer devices combine multiple broadcast domains
FastEthernet 0/0
FastEthernet 0/0.1
FastEthernet 0/0.2
FastEthernet 0/0.3
Physical interfaces can be divided into multiple
subinterfaces
Router(configsubif)#encapsulation isl vlan identifier
• Enables ISL on a subinterface
VLAN 1 VLAN 2
interface fastethernet 0/0
no ip address
!
interface fastethernet 0/0.1
10.1.1.2 10.2.2.2 ip address 10.1.1.1 255.255.255.0
encapsulation isl 1
interface fastethernet 0/0.2
ip address 10.2.2.1 255.255.255.0
encapsulation isl 2
ISL S0
172.16.1.1
172.16.1.2
VLAN 1 VLAN 2
TCP
interface Serial0 IP
ip address 172.16.1.1 255.255.255.0 HDLC
Serial
fa0/23 ...
fa0/1 fa0/12 fa0/12 fa0/1
fa0/24 fa0/13 fa0/13
core_ server core_sw_a fa0/14 fa0/14 core_sw_b
10.1.1.2 10.1.1.4
© 2000, Cisco Systems, Inc. www.cisco.com ICND v1.0a—891
Summary
After completing this chapter, you should be
able to perform the following tasks:
• Identify the TCP/IP protocol stack and the
functions of each layer
• Separate an IP address into its subcomponents:
the network, subnet, and host portions
• Configure IP addresses on Cisco router and
switch interfaces
• Interconnect VLANs using a layer three device
such as a “router on a stick”
1. What is the difference between the TCP and
UDP transport layer protocols?
2. Given a host with IP address, 192.168.20.1
255.255.255.240, how many other hosts can
you have in that network?
3. What is required to interconnect separate
VLANs?