The Internet Protocol (IP) IP Packets and Routing
The whole idea of the Internet and digital packet switched networks in general is that we can chop up our information into chunks we call packets which we can then route through so called packet switched networks by different routes. In the Internet protocol (IP) IP packets and routing each packet can take a potentially different route. By doing this we can increase the reliability and efficient use of our networks to pass information between nodes in the network. A network node could be a router, a server, host computer or other uniquely addressable device. A network router node has the special job of directing these IP packets to their intended destination. A router will decide if the intended destination of a packet is on a local network it has access to, in which case it routes the packet locally. If not it finds the best route to send the packet onto where it will be collected by yet another router which will do the same job and so on. Each IP packet contains the unique address of its sender and the unique address of the intended receiver. These unique address are called IP addresses and are present in every IP packet.
IP packets themselves form part of a complete message called a datagram. Datagrams can vary in size and sometimes because the network routes taken to deliver the datagrams may be limited in the maximum size a network IP packet can hold, datagrams themselves are broken up into fragments. The router that is last in the chain to deliver the datagram to a local host reassembles all the IP packets it receives for a given datagram from any route and sends it on to another local protocol layer to handle. This layer is generally called layer 4 or the Transport layer where for example the most commonly used protocol TCP/IP, ensures that messages from applications are not lost or corrupted where possible.
The place where routers live on the Internet is called the Network layer, often called layer 3 and the place where the ethernet protocol lives is called the Data Link layer or layer 2. Layer 3 exchanges datagrams with layer 2 which in most cases employs the Ethernet protocol. Information is passed from applications in the applications layer (layer 7) down to the transport layer 4, then 3, then 2 and finally layer 1. Each layer has a distinct job to do. Applications receiving data get the data being passed up the layers from layer 1, 2, 3, 4 and finally layer 7. For historical reasons layers 5 and 6 functions have been largely superseded in the abstract OSI model by the present systems and are not really worth talking about and can be safely ignored.
This layer 7 data is encapsulated in each layer going down the layers. The messages encapsulating layer 7 data is sent using the layer 4 TCP protocol and these application data units called segments are imbedded in IP datagrams and the resulting IP packets are then themselves normally encapsulated in ethernet frames where they are delivered by the Data Link layer 2 to the physical layer 1 which sends the data by some physical means. This is where the concept of layers and a layered protocol comes from.
Device drivers controlling the hardware based link devices deal in ethernet frames and from these frames recover the encapsulated IP packets from a physical channel or layer 1. They also create data streams on the physical channel by sending ethernet packets encapsulating the IP packets in them on that channel. The physical layer 1 channel could involve sending bit streams down wires or modulating radio waves with the bit stream data and transmitting these signals as Wifi Signals using the 802.11 protocol. The physical layer could also be a modulated light beam sent down a fiber optic cable.