If we are interested in the contents or the structure of the headers of different network layers, we can access these with the help of a packet sniffer. We can go into the promiscuous mode with the help of ioctls. But if we want to receive all the packets, we have to switch into the promiscuous mode. For example, when we type our browser, we receive packets sent from Google, and our machine extracts all the headers of the network layer and gives the data to our browser.īy default, a machine receives those packets that have the same destination address as that of the machine, and this mode is called the non-promiscuous mode. When we connect to the Internet, we receive network packets, and our machine extracts all network layer headers and sends data to a particular application.
In Linux, we can see all protocols in the if_ether.h header file (see Figure 4). According to Ethernet protocols, there are various types of network packets like Internet Protocol packets, Xerox PUP packets, Ethernet Loopback packets, etc. The wrapped form of data, which contains all the information like the source and destination address, is called a network packet (see Figure 3). Before sending data, it is wrapped in various headers of the network layer. When an application sends data into the network, it is processed by various network layers.