Solution

advertisement
Datornätverk A – lektion 12
Repetition: Adresseringstekniker
Kapitel 19: Internetworking, addressing and Routing.
Kapitel 20: Network Layer Protocols: ARP, IPv4, ICMP,
IPv6 and ICMPv6.
Repetition: Fysisk adress och nätverksadress
I figur 2.11 vill vi sända data från
en nod med logisk nätverksadress
(IP-adress) A och fysisk adress 10
till en nod med IP-adress P och
fysisk adress 95. De två enheterna
befinner sig i olika LAN. Därför
kan vi inte enbart använda deras
fysiska adress. Den fysiska
adressen kan enbart användas vid
kommunikation inom ett LAN.
De två routrarna förstår av IPadressen vilken väg paketen ska
vidareförmedlas, och ändrar
paketets fysiska adressering.
Adresser till min dator
•
•
•
•
•
Fysisk MAC-adress, 48 bitar: 00-00-E2-4F-54-04
IP-adress, 32 bitar: 193.10.250.187.
Intern NAT-IP-adress (Network Address Translation): 10.14.1.63.
IP-subnetmask: 255.255.0.0
DNS-namn (Domain namn Service): mageripc.itm.miun.se, där
itm.miun.se är DNS-suffix, och .se är toppdomän.
• URL till webbsida på webbserver på min dator:
http://mageripc.itm.miun.se:portnummer/filkatalog/filnamn.typ
Portnumret är default 80. Många datorer i världen har DNS-alias ”www”.
• URL till ftp-fil på min dator:
ftp://användanamn:lösenord@mageripc.itm.miun.se/filkatalog/filnamn.typ
• Filnamn till fil vid delad diskaccess till min dator:
\\mageripc.itm.miun.se\filkatalog\filnamn.typ (Av säkerhetsskäl inte
tillgänglig utanför nätet.)
• E-postadress till användare på en e-postserver på min dator:
användarnamn@mageripc.itm.miun.se
System och protokoll för
översättning mellan olika
adresseringstekniker
• ARP (Address resolution protocol) översätter IP-adress till fysisk
adress.
• DHCP (Dynamic Host Configuration Protocol) kan ge varje dator en
ledig IP-adress, och talar om för en dator med en viss fysisk adress
vilken dess IP-adress är vid varje omstart.
• DNS (Domain Name Server) är ett system av databaser som översätter
mellan IP-adress och DNS-adress.
• NAT (Network Address Translation) är en server, ofta i anslutning till
företagets brandvägg, som modifierar IP-paketen genom att byta ut
intern avsändar-IP-adress och portnummer till extern IP-adress +
portnummer vid utgående paket, och vice versa vid inkommande. På så
sätt kan många dela på samma externa IP-adress.
PART IV
Network Layer
Position of network layer
Network layer duties
Chapter 19
Host-to-Host
Delivery:
Internetworking,
Addressing,
and Routing
Figure 19.1
Internetwork
Figure 19.3
Network layer in an internetwork
Figure 19.7
Switching
Figure 19.8
Datagram approach
Note:
Switching at the network layer in the
Internet is done using the datagram
approach to packet switching.
Note:
Communication at the network layer
in the Internet is connectionless.
Figure 19.9
Dotted-decimal notation
IP-adresser
• 32-bit adress i dagens IP version 4. 64-bit i IPversion 6.
• Exempelvis har Utbildningsradions www-server IPadressen
1100 0001 0000 1100 0101 1011 0001 1111 binärt.
• På punkterad decimalform blir det 193.12.91.31.
• Hexadecimalt blir det C10C5B1F.
1100 0001 0000 1100
C
1
193
0
.
0101 1011 0001 1111
C
12
5
.
D
91
F
1
.
31
Note:
The binary, decimal, and hexadecimal
number systems are reviewed in
Appendix B.
Example 1
Change the following IP addresses from binary notation to dotteddecimal notation.
a.
10000001 00001011 00001011 11101111
b.
11111001 10011011 11111011 00001111
Solution
We replace each group of 8 bits with its equivalent decimal
number (see Appendix B) and add dots for separation:
a.
129.11.11.239
b.
249.155.251.15
Example 2
Change the following IP addresses from dotted-decimal notation to
binary notation.
a.
111.56.45.78
b.
75.45.34.78
Solution
We replace each decimal number with its binary equivalent
(see Appendix B):
a.
b.
01101111 00111000 00101101 01001110
01001011 00101101 00100010 01001110
Hierarchical Addressing
• Network address – A part used by the router
• Host address – Specific part or device on the network
network node
3.1
2.1
A
1.1 1.2
1.3
1
1
2
3
2
1
3
1
An example of hierarchical addressing
Each node is actually an interface to
the network
Note:
In classful addressing, the address
space is divided into five classes: A, B,
C, D, and E.
Figure 9.5 IP address formats and
classes
Figure 19.10
Finding the class in binary notation
Figure 19.11 Finding the address class
Example 3
Find the class of each address:
a.
00000001 00001011 00001011 11101111
b.
11110011 10011011 11111011 00001111
Solution
See the procedure in Figure 19.11.
a.
b.
The first bit is 0; this is a class A address.
The first 4 bits are 1s; this is a class E address.
Figure 19.12
Finding the class in decimal notation
Example 4
Find the class of each address:
a.
227.12.14.87
b.
252.5.15.111
c.
134.11.78.56
Solution
a.
b.
c.
The first byte is 227 (between 224 and 239); the class is D.
The first byte is 252 (between 240 and 255); the class is E.
The first byte is 134 (between 128 and 191); the class is B.
Figure 19.13
Netid and hostid
Figure 19.14
Blocks in class A
Figure 19.15
Blocks in class B
Figure 19.16
Blocks in class C
Note:
A network address is different from a
netid. A network address has both
netid and hostid,
with 0s for the hostid.
Figure 19.17
Network address
Example 5
Given the address 23.56.7.91, find the network address.
Solution
The class is A. Only the first byte defines the netid. We can find the network
address by replacing the hostid bytes (56.7.91) with 0s. Therefore, the
network address is 23.0.0.0.
Example 6
Given the address 132.6.17.85, find the network address.
Solution
The class is B. The first 2 bytes defines the netid. We can find the network
address by replacing the hostid bytes (17.85) with 0s. Therefore, the
network address is 132.6.0.0.
Example 7
Given the network address 17.0.0.0, find the class.
Solution
The class is A because the netid is only 1 byte.
Klasslösa adresser
• Idag används subnetting och klasslösa adresser med hjälp
av IP-masker. En 1:a i IP-masken betyder att motsvarande
bit i adressen tillhör Net-ID.
• Exempel: IP-masken 255.255.0.0 = FFFF0000 (sexton 1:or
och sexton 0:or) betyder att de första 16 bitarna i IPadressen är Net-ID, övriga är Host-ID.
Figure 19.21 Addresses in a network with and without subnetting
Table 19.1 Default masks
Class
In Binary
In Dotted-Decimal
Using Slash
notation
A
11111111 00000000 00000000 00000000
255.0.0.0
/8
B
11111111 11111111 00000000 00000000
255.255.0.0
/16
C
11111111 111111111 11111111 00000000
255.255.255.0
/24
Note:
The network address can be found
by applying the default mask to any
address in the block (including itself).
It retains the netid of the block and
sets the hostid to 0s.
Example 8
A router outside the organization receives a packet with destination
address 190.240.7.91. Show how it finds the network address to
route the packet.
Solution
The router follows three steps:
1. The router looks at the first byte of the address to find the
class. It is class B.
2. The default mask for class B is 255.255.0.0. The router ANDs
this mask with the address to get 190.240.0.0.
3. The router looks in its routing table to find out how to route the
packet to this destination. Later, we will see what happens if
this destination does not exist.
Figure 19.23
Subnet mask
Example 9
A router inside the organization receives the same packet with
destination address 190.240.33.91. Show how it finds the
subnetwork address to route the packet.
Solution
The router follows three steps:
1. The router must know the mask. We assume it is /19, as shown in
Figure 19.23.
2. The router applies the mask to the address, 190.240.33.91. The subnet
address is 190.240.32.0.
3. The router looks in its routing table to find how to route the packet to
this destination. Later, we will see what happens if this destination does
not exist.
Broadcast IP address
• Broadcast IP address is used when information needs to be
sent to all the hosts on the same network
○ Convenient in broadcast networks (such as Ethernet)
• Broadcast IP address is obtained when host bits are
replaced by 1s.
Example:
Network addresses
192.16.4.0
192.16.4.3
172.16.4.255192.16.4.1 192.16.4.2
192.16.4.255
192.16.5.0
172.16.5.255
192.16.5.255
192.16.5.3
192.16.5.1
192.16.5.2
192.16.3.0
172.16.3.255
192.16.3.255 192.16.3.1 192.16.3.2 192.16.3.3 192.16.3.4 192.16.3.5
Host addresses
Broadcast addresses
The mask is 255.255.255.0 for all hosts
Unicast, Multicast and Reserved
Addresses
• Unicast address is used for one-to-one communication
• Multicast address is used for one-to-many communication (group
communication) – D class
• Reserved addresses – Besides the addresses in class E reserved
addresses are:
○
○
○
○
Network addresses – all host bits are 0
Broadcast addresses – all host bits are 1
All network part 0 – host on this network
127.0.0.0 mask 255.0.0.0 and all host addresses on this network are
reserved for testing purposes. 127.0.0.1 = localhost.
○ 0.0.0.0 – default route
Address Resolution Protocol
(ARP)
• ARP is necessary whenever a device need to send an IP
packet to another device on the same LAN
○ The two devices can be two hosts, or host and router, or
two routers that are on the same network
• ARP resolves the IP address into a physical address (MAC
addresses).
Figure 20.2 ARP operation
Figure 20.5
Four cases using ARP
Note:
An ARP request is broadcast; an ARP
reply is unicast.
How Does ARP Operate?
• The sending machine issues a low level broadcast onto the network,
requesting that the system that is using the specified IP address responds
with its hardware address ( ARP request message)
• All the systems on the network receive the request messge
• Only the system that has the specified IP address responds.
• The response is not broadcast over the network, but is instead sent
directly to the requesting system (response message).
ARP Cache
• The Ethernet and IP address pair, obtained from the
response are stored (cashed) for further by both systems,
the one sending the request and receiveing the response
and the one recieving the rquest and sending the response
• The next time, the system checks the local cache and if an
entry is found, the need for a broadcast will be eliminated.
Example 1
A host with IP address 130.23.3.20 and physical address
B23455102210 has a packet to send to another host with IP address
130.23.43.25 and physical address A46EF45983AB. The two hosts
are on the same Ethernet network. Show the ARP request and reply
packets encapsulated in Ethernet frames.
Solution
Figure 20.6 shows the ARP request and reply packets. Note that the ARP
data field in this case is 28 bytes, and that the individual addresses do not fit
in the 4-byte boundary. That is why we do not show the regular 4-byte
boundaries for these addresses. Note that we use hexadecimal for every
field except the IP addresses.
Figure 20.6
Example 1
DHCP and NAT
• DHCP – Dynamic Host Configuration Protocol
○ A protocol that makes possible the IP configuration parameters to the
hosts to be assigned from a server. IP addresses are leased for a period of
time.
• Private addresses
○ Particular blocks of IP addresses are reserved as private address and can
be used for private networks not connected to the Internet
○ When these networks connect to the Internet, they need NAT (network
address translation)
• NAT
○ NAT software translates private IP addresses into public and vice-versa
Table 19.2 Default masks
Range
Total
10.0.0.0
to
10.255.255.255
224
172.16.0.0
to
172.31.255.255
220
192.168.0.0
to
192.168.255.255
216
Figure 19.25
NAT
Figure 19.26 Address translation
Figure 19.27 Translation
Table 19.3 Five-column translation table
Private
Address
Private
Port
External
Address
External
Port
Transport
Protocol
172.18.3.1
1400
25.8.3.2
80
TCP
172.18.3.2
1401
25.8.3.2
80
TCP
...
...
...
...
...
Internet Control Message Protocol
(ICMP)
• ICMP is IP helper protocol
○ Serves for error reports and for testing purposes
• ICMP messages are encapsulated in IP packets.
• ICMP provides a means for transferring control messages from routers
and other hosts to a host.
• ICMP provides feedback about problems such as:
○ an unreachable destination
○ buffer overflow
○ time-to-live expires
Useful Programs
• These programs use ICMP to probe the Internet
○ ping
• Sends packets that is echoed by remote computer
• Remote computer replies with echo packet
• Local computer reports receipt of reply
○ traceroute
•
•
•
•
Reports path to remote computer
Sends packets to the destination starting with TTL=1
Each successive packet identifies next router along path
Reports list of packets
○ ipconfig – shows network configuration info
• Displays all configuration information
Ping - Example
Four packets are sent. Each has different round-trip time
(RTT). Minimum, Maximum and average are also given.
Round-trip Time (RTT)
• Time for the packet to be sent and acknowledgement to
come back to the sender
• Why the packets have different RTT?
○ They might travel different paths
○ The load in some of the routers might be high. Therefore packet’s
waiting time at the routers can be different.
○ Ping also shows the percentage of lost packets.
Traceroute - Example
The source is sending three packets with TTL=1, then another three with TTL=2
and so on until TTL is by one bigger then the number of hops. A response is thus
obtained from each hop where the packets are dropped. RTT for each packet is
presented.
VisualRoute
• A program that displays visually (on a map) traceroute
• Trial version can be obtained free from
www.visualroute.com
Ipconfig
• Displays all the information about the IP configuration.
○
○
○
○
○
○
○
○
○
IP address
Subnet mask
Default gateway (router)
DNS servers
DHCP servers
MAC (physical) address
Host name
Domain suffix
…
Ipconfig /all - Example
Figure 20.15
IPv6 address
Figure 20.23 Tunneling
Figure 20.24
Header translation
Download