Ethernet packet Format (IP & UDP & ICMP & ARP)Ethernet Packet FormatThe value of the protocol type type of the ETHERNET packet is the 0X0800:IP protocol, that is: ETHERTYPE_IP,
This value is defined in/usr/include/net/ethernet.h. ETHERNET Packet format and subdivision
In the following cases:
(1) The protocol number in the IP header is ipproto_tcp and its value is 6. The format of the ETHERNET packet is as follows:
|<------------Ethernet Header---------->|
-------------------------------------------------------------------------
| DST MAC ADDR | SRC MAC ADDR | TYPE | IP PACKET | TCP PACKET |
-------------------------------------------------------------------------
|<-6 bytes->|<-6 bytes->|<-2 bytes->|<-All bytes->|<-bytes->|
As shown in the following example:
XX A8 0a 98 1f 0a 8a 08 00 45 00
-- -- -- -- -- -- -- -- -- -- -- -- -- --
7e, 6f e5 a6 6f (A6)
-- -- -- -- -- -- --
E5 0d 3a, BC 5d 5a 8b 25 69 20 82 50 11
-- -- -- -- -- --
CC 34 00 00 00 00 00 00 00 00 00 00 00 00
-- --
The following instructions are given below:
XX---00:ethernet PACKET, total 14 bytes
A8 CD 48: Receiver's MAC address, 6 bytes
0a 98 1f 0a 8a: Sender's MAC address, 6 bytes
08 00: protocol type, 2 bytes,
0X0800:IP protocol, this value is in the/usr/include/net/ethernet.h
is defined in the value: ETHERTYPE_IP
---e5 0d:ip PACKET, total 20 bytes
06: protocol type, 1 is icmp,6 is tcp,17 is UDP
A6 6f e5 87: Sender IP Address, 4 bytes, decimal: 166.111.229.135
A6 6f e5 0d: Receiver IP Address, 4 bytes, decimal: 166.111.229.13
3a---00:tcp PACKET, total 20 bytes
3a: The sender's port number, 2 bytes, with a decimal representation of: 1082
01 95: The port number of the receiver, 2 bytes, with a decimal representation of: 405
The window size of the 87:TCP PACKET
(2) The protocol number in the IP header is IPPROTO_UDP and its value is 17. The format of the ETHERNET packet is as follows:
|<------------Ethernet Header---------->|
------------------------------------------------------------------------
| DST MAC ADDR | SRC MAC ADDR | TYPE | IP PACKET | UDP PACKET |
------------------------------------------------------------------------
6 bytes->|<-6 bytes->|<-2 bytes->|<-|<-bytes->|<-8 bytes->|
As shown in the following example:
FF FF FF FF FF C8 F7 0b 99 08 00 45 00
-- -- -- -- -- -- -- -- -- -- -- -- -- --
XX 4e 0b c0 A8 0a C0 A8
--
3a FA 63 80 37 01 10 00 01
-- -- -- -- -- -- -- --
XX 4e 46 44 45 49 45 50 45
4e 45 46 43 41 43 41 43 41 43 41 43 41 43 41 43
4c 00 00 20 00 01
The following instructions are given below:
The header format of the ETHERNET PACKET, IP PACKET is the same as (1),
Where: 11 of the second line represents the IPPROTO_UDP protocol.
---fa 63:udp PACKET, a total of 8 bytes
00 89: The port number of the sender, 2 bytes, with a decimal representation of: 137
00 89: The port number of the receiver, 2 bytes, with a decimal representation of: 137
The 3A:UDP packet length, its decimal representation is: 58
FA 63:udp Check and
(3) The protocol number in the IP header is ipproto_icmp and its value is 1. The format of the Ethernet packet is as follows:
|<------------Ethernet Header---------->|
-------------------------------------------------------------------------
| DST MAC ADDR | SRC MAC ADDR | TYPE | IP PACKET | ICMP PACKET |
-------------------------------------------------------------------------
6 bytes->|<-6 bytes->|<-2 bytes->|<-|<-bytes->|<-8 bytes->|
As shown in the following example:
0a 98 1f 0a 8a A8 48 08 00 45 00
The D0 a6 6f F9 0d CA 70
--
BC 1b C3 E6 2b 3b Ae.
-- -- -- -- -- -- -- --
0b 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15
1a 1b 1c 1d 1e 1f 20 21 22 23 24 25
2a 2b 2c 2d 2e 2f 30 31 32 33 34 35
36 37
The following instructions are given below:
The header format of the ETHERNET PACKET, IP PACKET is the same as (1),
Where: 01 of the second line represents the IPPROTO_ICMP protocol.
---01:icmp PACKET, total 8 bytes
A 08:icmp_type,1 byte.
A 00:icmp_code,1 byte.
BC 04:ICMP Check and
1b 21:ICMP logo
XX 01:ICMP Packet serial number
The value of the protocol type type of the ETHERNET packet is the 0X0806:ARP protocol, that is: Ethertype_arp,
This value is defined in/usr/include/net/ethernet.h. The format of the ETHERNET packet is as follows:
|<------------Ethernet Header---------->|
------------------------------------------------------------
| DST MAC ADDR | SRC MAC ADDR | TYPE | ARP Protocol Packet |
------------------------------------------------------------
|<-6 bytes->|<-6 bytes->|<-2 bytes->|<--bytes-->|
As shown in the following example:
FF FF FF FF FF 0a 98 1f 0a 8a 08 06 00 01
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Geneva, 0a 98 1f 0a 8a A6 6f e5 01
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
xx a6 6f E5 58 00 00 00 00 00 00
-- -- -- -- -- -- -- -- -- --
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
The following instructions are given below:
FF FF---06:ethernet PACKET, total 14 bytes
FF FF FF FF FF: Receiver's MAC address, 6 bytes
0a 98 1f 0a 8a: Sender's MAC address, 6 bytes
08 06: Protocol type, 2 bytes,
0x0806:arp protocol, in/usr/include/net/ethernet.h
is defined in the value: Ethertype_arp
---F9 58:arp PACKET, a total of 28 bytes
00 01: Hardware address format, 2 bytes
08 00: Protocol address format, 2 bytes
06: Hardware address Length, 1 bytes
04: Protocol address length, 1 bytes
00 01: Optional, 2 bytes, 0x0001:arpop_request,
0x0002:arpop_reply
This value is defined in/usr/include/net/if_arp.h
0a 98 1f 0a 8a: Sender's MAC address, 6 bytes
A6 6f e5 01: Sender's IP address, 4 bytes, decimal: 166.111.229.1
00 00 00 00 00 00: Receiver's MAC address, 6 bytes
A6 6f e5 58: IP Address of receiver, 4 bytes, decimalSystem: 166.111.229.88
Ethernet packet Format (IP & UDP & ICMP & ARP)