Link Layer
We start with the bottom layer of TCP/IP model that sends and receives link layer data frames. In this section, we cover the following topics:
- Management of network interfaces.
- Basic operations with Ethernet.
Network Interfaces
As we see more and more network operating systems based on Linux, it makes sense to understand how Go can help us interact with network interfaces in this context.
Linux exposes its networking internals through a kernel interface called Netlink. This interface allows user space applications like Go to communicate with the kernel over a standard socket API. Most commonly, TCP/UDP libraries use Netlink sockets to send and receive data, but they can also work with most Linux networking constructs, from interfaces to routes and nftables.
Thankfully, you don’t need to learn or understand the low-level Netlink API, as there are many Go packages that deliver high-level abstractions, making it much easier to work with. Some notable Netlink packages...