Does anyone know the Ethertype number of UDP and TCP? I know IPv4 is 0x0800 and IPv6 are 0x86dd. I'm writing a program that gives me information about a packet based on the type of packet it is.
Ethernet frame has three parts source,destination MAC address and Ethertypes. Ethertypes show us how Layer-2 interacts with Layer-3 in the OSI model. As you look up the model, At Layer-3, within IPv4 there is a protocol field to determine if it is TCP, UDP, ICMP or something else. At Layer-4, within TCP and UDP, we have the port to determine which application should handle the packet.
So TCP and UDP doesn't have Ethertypes, instead they have protocol numbers. The following are the protocol numbers for UDP and TCP :
0x11 for User Datagram Protocol (UDP)
0x06 for Transfer Control Protocol (TCP)