>Ping 192.168.0.1
위의 커맨드는 ICMP 패킷을 사용한다.
ICMP Header의 데이터는 아래와 같고, 데이터는 ping command의 경우 임의의 알파벳을 data로 보낸다.
[ ex) abcdefghijklmnopqrstuvwabcdef........]
아래에 대한 data를 설명하자면 Ping을 보내는 쪽을 client라 하고, 받는 쪽을 server라고 한다면
client는 request를 요청하므로 type 8, code 0 를 header에 명시하고,
server는 reply를 하게되므로 type 0, code 0를 헤더에 실어 보낸다.
List of permitted control messages (incomplete list)
Type | Code | Description |
---|---|---|
0 - Echo Reply | 0 | Echo reply (used to ping) |
1 and 2 | Reserved | |
3 - Destination Unreachable | 0 | Destination network unreachable |
1 | Destination host unreachable | |
2 | Destination protocol unreachable | |
3 | Destination port unreachable | |
4 | Fragmentation required, and DF flag set | |
5 | Source route failed | |
6 | Destination network unknown | |
7 | Destination host unknown | |
8 | Source host isolated | |
9 | Network administratively prohibited | |
10 | Host administratively prohibited | |
11 | Network unreachable for TOS | |
12 | Host unreachable for TOS | |
13 | Communication administratively prohibited | |
4 - Source Quench | 0 | Source quench (congestion control) |
5 - Redirect Message | 0 | Redirect Datagram for the Network |
1 | Redirect Datagram for the Host | |
2 | Redirect Datagram for the TOS & network | |
3 | Redirect Datagram for the TOS & host | |
6 | Alternate Host Address | |
7 | Reserved | |
8 - Echo Request | 0 | Echo request |
9 - Router Advertisement | 0 | Router Advertisement |
10 - Router Solicitation | 0 | Router discovery/selection/solicitation |
11 - Time Exceeded | 0 | TTL expired in transit |
1 | Fragment reassembly time exceeded | |
12 - Parameter Problem: Bad IP header | 0 | Pointer indicates the error |
1 | Missing a required option | |
2 | Bad length | |
13 - Timestamp | 0 | Timestamp |
14 - Timestamp Reply | 0 | Timestamp reply |
15 - Information Request | 0 | Information Request |
16 - Information Reply | 0 | Information Reply |
17 - Address Mask Request | 0 | Address Mask Request |
18 - Address Mask Reply | 0 | Address Mask Reply |
19 | Reserved for security | |
20 through 29 | Reserved for robustness experiment | |
30 - Traceroute | 0 | Information Request |
31 | Datagram Conversion Error | |
32 | Mobile Host Redirect | |
33 | Where-Are-You (originally meant for IPv6) | |
34 | Here-I-Am (originally meant for IPv6) | |
35 | Mobile Registration Request | |
36 | Mobile Registration Reply | |
37 | Domain Name Request | |
38 | Domain Name Reply | |
39 | SKIP Algorithm Discovery Protocol, Simple Key-Management for Internet Protocol | |
40 | Photuris, Security failures | |
41 | ICMP for experimental mobility protocols such as Seamoby [RFC4065] | |
42 through 255 | Reserved |
(Sources: IANA ICMP Parameters [1] and Computer Networking - A Top-Down Approach by Kurose and Ross)
IGMP(Internet Group Management Protocol)
igmp 는 TTL 이 1으로 설정되어 있는데 이것이 의미하는 말은 IGMP는 host와 첫번째 라우터 사이에서만 이루어진다.
현재는 igmp v1의 경우 거의 사용되지 않고 있다.
IGMP v1
- Defined in RFC 1112, Host Extensions for IP Multicasting.
- Two types of messages:
- Membership Query
- Membership Report
- Multicast routers periodically send membership queries (every 60 to 120 seconds) to multicast address 224.0.0.1 (all-hosts).
- Hosts send memebership reports to the multicast address they want to join. Hosts either send reports if they want to join or to respond to membership queries.
- To minimize bandwidth and processing overhead, only one member per group, on each subnet, responds to a query. This process is called report suppression.
- For a multicast traffic to be forwarded to a segment, there has to be at least one active member present.
- IGMPv1 lacks the mechanism for hosts leaving the group.
- Hosts can leave a group silently, at any time, without notifying the router.
- Even when there is no longer any host in the group, the multicast session will continue to forward traffic until several query intervals find no response. This leads to inefficiency.
IGMPv1 Message Format
IGMP v2
- Defined in RFC 2236, Internet Group Management Protocol, Version 2.
- Due its predecessor’s limitations, IGMPv2 came to be. Most of the changes between version 1 and version 2 deal with the issues of leave and join inefficiencies.
The following are some important changes in IGMPv2:
- Group-specific queries
- Allows a router to query membership only in a single group instead of in all groups. This provides an efficient way to find out if any members are left in a group without asking all groups for a report.
- Membership query vs. group-specific query:
- Membership query sends multicast to all host address 224.0.0.1
- Group-specific query for a group “G” is multicast to the group “G” multicast address.
- Leave Group message
- Mechanism for hosts to notify the router that they are leaving the group.
- This specification includes the timing of when Leave Group messages must be sent.
- Querier election mechanism
- The router with the highest IP address on the same segment becones the designated querier.
- Query-interval response time
- Indicates to the members how much time they have to respond to a query by issuing a report.
- Controls the “burstiness” of a report
- IGMPv2: Joining a Group
- When joining a multicast group, members do not have to wait for a query to join. They simply send an report indicating that they want to join.
- This reduces the latency for a host joining if no other members are present.
- IGMPv2: Leaving a Group
- When a host leaves a group, it announces its intention to leave by sending a Leave group message to multicast 224.0.0.2 – all multicast routers.
- When the router receives the Leave Group message, it sends a group-specific query to check if there is any other members left in the group.
- If another member is still present, it sends back a report and the router continues to send multicast traffic to the group.
- If there is no longer any member present, no membership report comes back to the router. The group subsequently times out.
- It takes approximately from 1 to 3 seconds from the time that the Leave Group message is sent until the group-specific query times out and multicast traffic stops flowing for that group.