In this section, we will delve into the fundamentals of configuring network settings and interfaces in Linux. Understanding how to manage your system's network configuration is crucial for both beginners and intermediate developers. This tutorial will cover essential concepts such as IP addresses, subnet masks, gateways, DNS servers, and how to configure these settings using command-line tools.
Network interfaces are the points where a computer connects to a network. In Linux, these interfaces are typically represented by names like eth0, wlan0, or more commonly in modern systems, enp3s0 for Ethernet and wlp2s0 for Wi-Fi.
An IP address is a unique identifier assigned to each device on a network. There are two main types of IP addresses:
A subnet mask is used to determine which portion of an IP address refers to the network and which portion refers to the host. It helps in defining the boundaries of a network segment.
The gateway acts as the entry point to another network. When your computer needs to communicate with a device outside its local network, it sends packets through the default gateway.
DNS (Domain Name System) servers translate human-readable domain names into IP addresses. They are essential for resolving hostnames to their corresponding IP addresses.
To list all available network interfaces and their current configuration, use the ip command:
To configure an interface to obtain its IP address dynamically via DHCP, you can modify the same configuration file as above.
1auto enp3s02iface enp3s0 inet dhcp
Restart the networking service again:
PING google.com (172.217.16.196) 56(84) bytes of data. 64 bytes from 172.217.16.196: icmp_seq=1 ttl=53 time=20.3 ms 64 bytes from 172.217.16.196: icmp_seq=2 ttl=53 time=20.1 ms 64 bytes from 172.217.16.196: icmp_seq=3 ttl=53 time=20.2 ms 64 bytes from 172.217.16.196: icmp_seq=4 ttl=53 time=20.4 ms --- google.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3004ms rtt min/avg/max/mdev = 20.107/20.268/20.451/0.139 ms
In the next section, we will explore how to set up remote access to your Linux system using SSH (Secure Shell). This is a powerful tool that allows you to securely connect to and manage your server from anywhere.
Stay tuned for more tutorials on advanced networking topics and system administration!