Last modified by Valdis Vītoliņš on 2018/01/15 21:44

Show last authors
1 = 09.05. ICMP virzienmaiņas kļūdas =
2
3 {{velocity filter="none"}}
4 {{html clean="false" wiki="true"}}
5 ICMP //virzienmaiņas kļūdu// sūta maršrutētājs IP datagrammas nosūtītājam, ja datagrammu bija vajadzējis sūtīt uz citu maršrutētāju. Šī pieeja ir vienkārša, kā mēs parādīsim #picref("f_9_3.gif", "9.3.attēla") trīs soļos. Vienīgā reize, kad mēs redzēsim ICMP virzienmaiņu, ir tad, ja mītnei ir iespēja izvēlēties maršrutētāju, kuram nosūtīt paketi. (Atcerēsimies, ka agrāku piemēru redzējām #picref("f_7_6.gif", "7.6.attēlā").)
6 <p/>
7 #pic("f_9_3.gif", "500")
8 //9.3.attēls: ICMP virzienmaiņas piemērs//
9
10 1. Pieņemam, ka mītne sūta IP datagrammu uz R1. Šis maršrutēšanas lēmums bieži tiek izdarīts, jo R1 ir noklusētais maršrutētājs mītnei.
11 1. R1 saņem datagrammu un veic meklējumu tās maršrutēšanas tabulā un nosaka, ka R2 ir pareizais //nākamā lēciena// maršrutētājs, kuram nosūtīt datagrammu. Nosūtot datagrammu uz R2, R1 konstatē, ka tas nosūta datagrammu pa to pašu interfeisu, pa kuru datagramma atnāca (t.i. uz LAN'u, kuram ir pievienota mītne un šie divi maršrutētāji.) Tā ir norāde maršrutētājam, ka paketi nosūtījušo mītni var informēt par virzienmaiņu.
12 1. R1 nosūta ICMP virzienmaiņu mītnei, sakot tai sūtīt turpmākās datagrammas ar to pašu adresātu uz maršrutētāju R2, nevis R1.
13 <p/>
14 Izplatīts virzienmaiņas lietojums ir ļaut mītnei ar minimālām zināšanām par maršrutēšanu, pamazām veidot labāku maršrutēšanas tabulu. Mītne var sākt ar noklusēto maršrutu (vai nu R1 vai R2 mūsu piemērā #picref("f_9_3.gif","9.3.attēlā")), un ikreiz, kad noklusētā vērtība izrādās aplama, noklusētais maršrutētājs to informēs ar virzienmaiņas ziņojumu, ļaujot mītnei attiecīgi labot savu maršrutēšanas tabulu. ICMP virzienmaiņas ļauj TCP/IP mītnēm būt maršrutēšanā neinformētām, kamēr visa izpratne par to atrodas maršrutētājos. Acīmredzot, R1 un R2 mūsu piemērā ir jāzina vairāk par pievienoto tīklu topoloģiju, bet visas mītnes šajā LANā var sākt visu darīt ar noklusēto maršrutu un iemācīties jaunus maršrutus, saņemot virzienmaiņas.
15
16 == Piemērs ==
17
18 We can see ICMP redirects in action on our network (inside front cover). Although we show only three hosts (aix, solaris, and gemini) and two routers (gateway and netb) on the top network, there are more than 150 hosts and 10 other routers on this network. Most of the hosts specify gateway as the default router, since it provides access to the Internet.
19 <p/>
20 How is the author's subnet (the bottom four hosts in the figure) accessed from the hosts on the 140.252.1 subnet? First recall that if only a single host is at the end of the SLIP link, proxy ARP is used (Section 4.6). This means nothing special is required for hosts on the top network (140.252.1) to access the host sun (140.252.1.29). The proxy ARP software in netb handles this.
21 <p/>
22 When a network is at the other end of the SLIP link, however, routing becomes involved. One solution is for every host and router to know that the router netb is the gateway for the network 140.252.13. This could be done by either a static route in each host's routing table, or by running a routing daemon in each host. A simpler way (and the method actually used) is to utilize ICMP redirects.
23 <p/>
24 Let's run the ping program from the host solaris on the top network to the host bsdi (140.252.13.35) on the bottom network. Since the subnet IDs are different, proxy ARP can't be used. Assuming a static route has not been installed, the first packet sent will use the default route to the router gateway. Here is the routing table before we run ping:
25 <p/>
26 <pre>
27 solaris % <b>netstat -rn</b>
28 Routing Table:
29 Destination Gateway Flags Ref Use
30 Interface
31 127.0.0.1
32 140.252.1.0
33 224.0.0.0
34 default 127.0.0.1
35 140.252.1.32
36 140.252.1.32
37 140.252.1.4 UH
38 U
39 U
40 UG 0
41 3
42 3
43 0 848
44 15042
45 0
46 5747 lo0
47 le0
48 le0
49 </pre>
50 <p/>
51 (The entry for 224.0.0.0 is for IP multicasting. We describe it in Chapter 12.) If we specify the -v option to ping, we'll see any ICMP messages received by the host. We need to specify this to see the redirect message that's sent.
52 <p/>
53 <pre>
54 solaris % <b>ping -sv bsdi</b>
55 PING bsdi: 56 data bytes
56 ICMP Host redirect from gateway gateway (140.252.1.4)
57 to netb (140.252.1.183) for bsdi (140.252.13.35)
58 64 bytes from bsdi (140.252.13.35): icmp_seq=0. time=383. Ms
59 64 bytes from bsdi (140.252.13.35): icmp_seq=l. time=364. Ms
60 64 bytes from bsdi (140.252.13.35): icmp_seq=2. time=353. Ms
61 ^? type interrupt key to stop
62 --bsdi PING Statistics--
63 4 packets transmitted, 3 packets received, 25% packet loss
64 round-trip (ms) min/avg/max = 353/366/383
65 </pre>
66 <p/>
67 Before we receive the first ping response, the host receives an ICMP redirect from the default router gateway. If we then look at the routing table, we'll see that the new route to the host bsdi has been inserted. (This new entry is shown in a bolder font.)
68 <p/>
69 <pre>
70 Solaris % <b>netstat -rn</b>
71 Routing Table:
72 Destination Gateway Flags Ref Use Interface
73 127.0.0.1
74 140.252.13.35
75 140.252.1.0
76 224.0.0.0
77 default 127.0.0.1
78 140.252.1.183
79 140.252.1.32
80 140.252.1.32
81 140.252.1.4 UH
82 HGHD
83 U
84 U
85 UG 0
86 0
87 3
88 3
89 0 848
90 2
91 15045
92 0
93 5747 lo0
94 <p/>
95 le0
96 le0
97 </pre>
98 <p/>
99 This is the first time we've seen the D flag, which means the route was installed by an ICMP redirect. The G flag means it's an indirect route to a gateway (netb), and the H flag means it's a host route (as we expect), not a network route.
100 <p/>
101 Since this is a host route, added by a host redirect, it handles only the host bsdi. If we then access the host svr4, another redirect is generated, creating another host route. Similarly, accessing the host slip creates another host route. The point here is that each redirect is for a single host, causing a host route to be added. All three hosts on the author's subnet (bsdi, svr4, and slip) could also be handled by a single network route pointing to the router sun. But ICMP redirects create host routes, not network routes, because the router generating the redirect in this example (gateway) has no knowledge of the subnet structure on the 140.252.13 network.
102
103 == Citas nianses ==
104
105 #picref("f_9_4.gif", "9.4.attēls") parāda ICMP virzienmaiņas ziņojuma formātu.
106 <p/>
107 #pic("f_9_4.gif", "500")
108 //9.4.attēls: ICMP virzienmaiņas ziņojums//
109 <p/>
110 Ir pavisam četri dažādi virzienmaiņas ziņojumu veidi ar dažādām koda vērtībām, kā parādīts #picref("f_9_5.gif", "9.5.attēlā").
111 <p/>
112 #pic("f_9_5.gif", "350")
113 //9.5.attēls: Dažādas koda vērtības ICMP virzienmaiņai//
114 <p/>
115 There are three IP addresses that the receiver of an ICMP redirect must look at: (1) the IP address that caused the redirect (which is in the IP header returned as the data portion of the ICMP redirect), (2) the IP address of the router that sent the redirect (which is the source IP address of the IP datagram containing the redirect), and (3) the IP address of the router that should be used (which is in bytes 4-7 of the ICMP message).
116 <p/>
117 There are numerous rules about ICMP redirects. First, redirects are generated only by routers, not by hosts. Also, redirects are intended to be used by hosts, not routers. It is assumed that routers participate in a routing protocol with other routers, and the routing protocol should obviate the need for redirects. (This means that in Figure 9.1 the routing table should be updated by either a routing daemon or redirects, but not by both.)
118 <p/>
119 4.4BSD, when acting as a router, performs the following checks, all of which must be true before an ICMP redirect is generated.
120
121 1. The outgoing interface must equal the incoming interface.
122 1. The route being used for the outgoing datagram must not have been created or modified by an ICMP redirect, and must not be the router's default route.
123 1. The datagram must not be source routed.
124 1. The kernel must be configured to send redirects.
125 <p/>
126 The kernel variable is named ip_sendredirects, or something similar. (See [[Appendix E>>App_E]].) Most current systems (4.4BSD, SunOS 4.1.x, Solaris 2.x, and AIX 3.2.2, for example) enable this variable by default. Other systems such as SVR4 disable it by default.
127 <p/>
128 Additionally, a 4.4BSD host that receives an ICMP redirect performs some checks before modifying its routing table. These are to prevent a misbehaving router or host, or a malicious user, from incorrectly modifying a system's routing table.
129
130 1. The new router must be on a directly connected network.
131 1. The redirect must be from the current router for that destination.
132 1. The redirect cannot tell the host to use itself as the router.
133 1. The route that's being modified must be an indirect route.
134 <p/>
135 Mūsu pēdējais novērojums par virzienmaiņām ir tāds, ka maršrutētājiem ir jāsūta vienīgi mītņu virzienmaiņas (kodi 1 vai 3 no #picref("f_9_5.gif", "9.5.attēla")), nevis tīklu virzienmaiņas. Apakštīklošanās dēļ ir grūti precīzi norādīt, kad var sūtīt tīkla virzienmaiņu, nevis mītnes virzienmaiņu. Dažas mītnes uztver tīkla virzienmaiņu kā mītnes virzienmaiņu, gadījumam, ja maršrutētājs ir atsūtījis aplamu tipu.
136 {{/html}}
137 {{/velocity}}