TCP/IP Illustracted Vol1. 제목 : IP Routing ( 수 ) 한 민 규
Content Introduction Routing Principle Initializing a Routing Table ICMP APPENDIX. A IP Routing
Introduction Routing is one of the most important functions of IP The topics of which routing protocol to use on a given host, how to exchange routing information with adjacent routers
Processing done at the IP layer
Routing Principles The place to start our discussion of IP routing is to understand what is maintained by the kernel in its routing table. IP performs when it searches its routing table Search for a matching host address Search for a matching network address Search for a default entry The routing done by IP, when it searches the routing table and decides which interface to send a packet out, is a routing mechanism
Simple Routing Table netstat command U : The route is up. G : The route is to a gateway(router) H : The route is to a host, that is, the destination is a complete host address. D : The route was created by a redirect M : The route was modified by a redirect
Initializing a Routing Table Whenever an interface is initialized (normally when the interface’s address is set by the ‘ifconfig’ command) a direct route is automatically created for that interface Ex) route del default gw IP route add default gw IP
ICMP Host and Network Unreachable Errors The ICMP “host unreachable” error message is sent by a router when it receives an IP datagram that it cannot deliver or forward. 0Network Unreachable 1Host Unreachable 2Protocol Unreachable 3Port Unreachable 4Fragmentation Needed and Don’t Fragment (DF) was set 5Source Route Failed 6Destination network Unknown 7Destination Host Unknown 8Source Host Isolated
ICMP Redirect Errors The ICMP redirect error is sent by a router to the sender of an IP datagram when the datagram should have been sent to a different router host R2 R1 (1) IP datagram (3) ICMP redirect (2) IP datagram
ICMP redirect message type (5) code (0-3)checksum router IP address that should be used 8 bytes IP header (including options) + first 8 bytes of original IP datagram data code Description redirect for network redirect for host redirect for type of service and network redirect for type of service and host unused
ICMP Router Discovery Message Router Solicitation(=Selection) Message The general concept is that after bootstrapping, a host broadcasts or multicasts a router solicitation message Router Advertisement Message One or more router respond with a router advertisement message. Additionally, the routers periodically broadcast or multicast their router advertisements, allowing any hosts that are listening to update their routing table accordingly
Format of ICMP router Adv Message type (10)code (0) checksum Unused(sent as 0) 8 bytes type(9)code (0) checksum router address [1] preference level [1] router address [2] preference level [2]... number of address life time address entry size
APPEND A. IP ROUTING OPERATION Host A Host B Ethernet Ethernet : req0 :Code Check Sum : 0xA152 ID = 1024Seq num = 3328 Optional Data ICMP 가 echo request payload 를 만든다. IP PayloadIP Hdr ICMP 는 IP 에 Payload 를 넘기가 IP 는 패킷을 생성한다. ICMP Request ARP Cache Discovery Or ARP Request Default gateway 로 보내진다. Routing Table 에서 IP Dest Address 를 검색한다. Routing Table