Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

IP Addressing in Linux: A Comprehensive Guide

In this article, we will explore the concept of IP addressing and its importance in the Linux environment. We will discuss how IP addresses are used to identify devices on a network, allocate IP addresses in Linux, and configure network interfaces. Additionally, we will provide practical examples and commands specific to the Linux environment.


Examples:
1. Allocating IP Addresses in Linux:



  • To allocate a static IP address to a network interface, open the terminal and navigate to the network configuration directory: cd /etc/sysconfig/network-scripts/

  • Identify the network interface you want to configure, such as eth0 or ens33, and open the corresponding configuration file using a text editor: vim ifcfg-eth0

  • Within the file, modify the BOOTPROTO value to static and add the desired IP address, subnet mask, default gateway, and DNS servers:
     BOOTPROTO=static
    IPADDR=192.168.1.100
    NETMASK=255.255.255.0
    GATEWAY=192.168.1.1
    DNS1=8.8.8.8
    DNS2=8.8.4.4

  • Save the changes and restart the network service: systemctl restart network


2. Configuring DHCP in Linux:



  • To configure a network interface to obtain an IP address automatically from a DHCP server, open the terminal and navigate to the network configuration directory: cd /etc/sysconfig/network-scripts/

  • Open the configuration file for the desired interface: vim ifcfg-eth0

  • Change the BOOTPROTO value to dhcp:
     BOOTPROTO=dhcp

  • Save the changes and restart the network service: systemctl restart network


To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.