Initializing a Routing Table
Download
Report
Transcript Initializing a Routing Table
TCP/IP Illustracted Vol1.
제목 : IP Routing
2005. 3. 16(수)
한민규
[email protected]
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.
0
Network Unreachable
1
Host Unreachable
2
3
4
Protocol Unreachable
Port Unreachable
Fragmentation Needed and
Don’t Fragment (DF) was set
Source Route Failed
Destination network Unknown
Destination Host Unknown
Source Host Isolated
5
6
7
8
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
(1) IP datagram
(3) ICMP redirect
(2) IP datagram
R1
R2
ICMP redirect message
78
0
type (5)
15 16
code (0-3)
31
checksum
router IP address that should be used
IP header (including options) + first 8 bytes of original IP
datagram data
< ICMP redirect Message >
unused
unused
code
Description
0
1
2
3
redirect for network
redirect for host
redirect for type of service and network
redirect for type of service and host
< Different code values for ICMP redirect >
8 bytes
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
78
0
type (10)
15 16
31
code (0)
checksum
8 bytes
Unused(sent as 0)
< format of ICMP router solicitation message >
0
78
15 16
type(9)
code (0)
number of
address
31
checksum
address
entry size
life time
router address [1]
preference level [1]
router address [2]
preference level [2]
...
<format of ICMP router advertisement message>
8 bytes
APPEND A. IP ROUTING OPERATION
ICMP가 echo request payload를 만든다.
0 : req
0 :Code
ID = 1024
Check Sum : 0xA152
Seq num = 3328
Optional Data
Host A
172.16.10.2
IP Hdr
ICMP
IP Payload
Request
Host B
172.16.20.2
ICMP는 IP에 Payload를 넘기가 IP는 패킷을 생성한다.
Default gateway로 보내진다.
ARP Cache Discovery
Or ARP Request
Ethernet0
172.16.10.1
Ethernet1
172.16.20.1
Routing Table
Routing Table에서 IP Dest Address를 검색한다.