Linux Networking
Key Components of Networking
Networking in Linux involves several essential components. Here are the 9 key aspects to understand:
Hardware: The physical devices like network interface cards (NICs), switches, routers, and cables that enable network connectivity.
Operating System (OS): The Linux OS provides the software interface and tools for configuring and managing network connections.
NIC/Ethernet/LAN: The Network Interface Card (NIC) facilitates communication over a network using Ethernet or LAN protocols.
IP Address: A unique identifier assigned to devices on a network to enable communication.
Network: A system of interconnected devices that share resources and data.
Private and Public IPs:
Private IPs: Used within private networks and cannot communicate directly with public IPs.
Public IPs: Used for communication over the internet and are accessible globally.
NAT (Network Address Translation): Required when a private IP needs to connect to a public IP. NAT translates private IP addresses into a public IP for internet communication.
Routing Table: Maintains paths for directing data packets between networks. It helps determine the next hop for delivering data.
Switches and Routers:
Switch: Connects devices within the same network.
Router: Connects devices across different networks.
Essential Linux Networking Commands
Here are some commonly used commands to configure and troubleshoot networking in Linux:
ifconfig
: Displays the IP address and network configurations of the system.Example:
ifconfig
ifconfig [device]
: Used to change the IP address and netmask for a specific device.Example:
ifconfig enp0s3 192.168.1.10 netmask 255.255.255.0
nslookup
: Retrieves the IP address of a domain or website.Example:
nslookup www.google.com
route -n
: Displays the routing table.Example:
route -n
route del -net [destination IP]
: Deletes a route to a destination IP.Example:
route del -net 192.168.1.0
route add -net [destination IP] netmask [netmask] dev [device]
: Adds a route to a destination IP.Example:
route add -net 10.0.0.0 netmask 255.255.255.0 dev enp0s3
ping
: Checks the connectivity between your system and another host.Example:
ping 8.8.8.8
Summary
Understanding Linux networking requires knowledge of both the hardware and software components that make up a network. Key concepts like IP addressing, NAT, and routing are essential for effective communication between devices. Additionally, mastering basic commands such as ifconfig
, route
, and ping
is crucial for configuring and troubleshooting networks. This documentation serves as a starting point for working with networking in Linux.