
Basic Networking Concepts
Network Interfaces and Switching
Consider two systems—labeled A and B—that could be laptops, desktops, or virtual machines. To enable communication between them, each system must be connected to a switch with its respective network interface (either physical or virtual). To list available interfaces on a Linux host, execute:Routing Between Subnets
Now, consider a second network, such as 192.168.2.0, with hosts assigned IPs like 192.168.2.10 and 192.168.2.11. For communication between these two networks, a router is necessary. A router interconnects two or more networks and holds an IP address in each network—e.g., 192.168.1.1 for the first network and 192.168.2.1 for the second. When a system on network 192.168.1.0 (say, with IP 192.168.1.11) needs to communicate with a system on network 192.168.2.0, it forwards packets to the router.
Configuring Default Routes for Internet Access
To enable internet access (such as reaching external hosts like 172.217.194.0), configure the router as the default gateway. This is done by adding a default route:The “default” or “0.0.0.0” entry indicates that any destination not explicitly listed in the routing table will be directed through the specified gateway.
Configuring a Linux Host as a Router
Consider a scenario with three hosts (A, B, and C) where host B connects to two subnets (192.168.1.x and 192.168.2.x) using two interfaces. For example:- Host A: 192.168.1.5
- Host B: 192.168.1.6 and 192.168.2.6
- Host C: 192.168.2.5
Enabling IP Forwarding on Linux
Even with the correct routing table, Linux does not forward packets between interfaces by default, as a security measure. This setting is controlled by the IP forwarding parameter in/proc/sys/net/ipv4/ip_forward.
To check the IP forwarding status, run:
0 indicates that packet forwarding is disabled. To enable forwarding temporarily, run:
/etc/sysctl.conf and add or update the following line:
Modifying
/etc/sysctl.conf ensures that IP forwarding remains enabled even after a system restart.Summary of Key Commands
Below is a summary table of essential commands covered in this article:
Remember, changes made with these commands are temporary and will be reset upon reboot unless they are saved in the appropriate configuration files.
That concludes this article. In the next installment, we will dive into DNS configurations and further enhance your understanding of Kubernetes networking. For additional details and further reading, refer to resources like Kubernetes Documentation and Docker Hub.