Greetings, Dear cyber-readers,
This is the second publication of the series of 10 dedicated to Package Study, which are of utmost importance for any user of GNU / Linux Operating Systems in general, but focused on DISTRO DEBIAN.
This time we will talk about packages and concepts related to Network Interface Management.
We will first talk about the package net tools, file settings interfaces, demon management networking and using the command ifconfig.
For all these studies we will rely on the official references from the page of DEBIAN on Packages and their respective Manualplus the Wiki Official. And some other times on external pages about GNU / Linux, such as: Linux man pages online and other official wikis from other Distros.
DEBIAN Official Website:
Official Section on Packages:
Official Section on Manuals:
The net-tools package
En the section referring to «Package: net-tools (1.60-26 and others)« for DEBIAN Jessie en Spanish, «This package includes the important tools for control the Linux kernel network subsystem. This includes arp, ifconfig, netstat, rarp, nameif and route. In addition, this package contains utilities for particular types of network "hardware" (plipconfig, slattach, mii-tool) and advanced aspects of IP configuration (iptunnel, ipmaddr). » And it is always installed by default as a basic and elementary package for managing network connections.
- Study on ARP
- Study on IFCONFIG
- Study on NETSTAT
- Study on RARP
- Study on NAMEIF
- Study about SLATTACH
- Study on MII-TOOL
- Study on IP-TUNNEL
- Study on IPMADDRES
Interfaces File Settings
El archivo interfaces se encuentra en la ruta: /etc/network/interfaces
El contenido original del archivo suele ser:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
Insertar configuración de Interface Dinámica (eth0):
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
Insertar configuración de Interface Estática (eth0):
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.106
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1
dns-search mi-dominio.com
Where:
- car: Command that will activate (raise) an interface when the command is executed ifup -a, which runs automatically when the system starts, so it specifies the cards that will automatically be activated from the start.
- allow-hotplug: Command that will activate (lift) an interface when events occur hot plug on the network interfaces (Network card detection by the Kernel, the (Dis) connection of the network cable, among others). When these events occur, the Operating System executes the command Ifup associated with the network card involved. They are also associated with a logical configuration of the same name.
- ifa: Command that specifies an X interface (EthX, WlanX, EnpXsX, WlpXsX) and the type of configuration (Inet) that will be applied to you.
- dhcp: refers to a dynamic IP address that will be assigned to a specific interface.
- static: refers to a fixed IP address that will be assigned to a specific interface.
- loopback: refers to the interface lo (local loop).
- address: refers to the IP address of the Host.
- netmask: refers to the subnet mask corresponding to that IP address.
- network: refers to the network segment to which that IP address belongs.
- broadcast: refers to the broadcast IP address of that network segment.
- gateway: refers to the IP address of the gateway on that network segment.
- dns-nameservers: refers to the IP address of the internal or external Domain Name Server (DNS) that will be used for the name resolution of the URLs consulted.
- dns-search: refers to the Name of the Network Domain to which the Host belongs.
To learn more about the configuration of this file and other related files read more here: Network Configuration.
Demon Networking Management
El demonio de la red se gestiona desde el script /etc/init.d/networking
Mediante las sintaxis:
/etc/init.d/networking {start | stop | reload | restart | force-reload}
Ejemplo:
# /etc/init.d/networking stop
# /etc/init.d/networking start
También con el comando "service" podemos hacer lo mismo:
Ejemplo:
# service networking stop
# service networking start
En algunas Distros dicho demonio se puede gestionar con el comando "systemctl":
Ejemplo:
# systemctl stop networking.service
# systemctl start networking.service
Using the Ifconfig Command
This command is used to display information about the network interfaces connected (active or inactive) to the system and also to manage (configure) them. So it is widely used to initialize the parameters of a network interface and to activate or deactivate them. The syntax used in this command is: ifconfig [options]
The most common ways to use it are as follows:
# Visualizar todas las interfaces activas ifconfig # Visualizar todas las interfaces activas e inactivas ifconfig -a # Desactivar una interfaz (eth0) ifconfig eth0 down # Activar una interfaz (eth0) ifconfig eth0 up # Asignar una dirección IP
(192.168.2.2)
a una interfaz (eth0) ifconfig eth0 192.168.1.100 # Cambiar la máscara de subred (netmask) de una interfaz (eth0) ifconfig eth0 netmask 255.255.255.0 # Cambiar la dirección de difusión (broadcast) de una interfaz (eth0) ifconfig eth0 broadcast 192.168.1.255 # Asignar integralmente una dirección IP (address), máscara de red (netmask) # y dirección de difusión (broadcast), a una interfaz (eht0) ifconfig eth0 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 # Modificar el valor referente del MTU de una interfaz (eth0) # Nota: MTU es el número máximo de octetos que la interfaz es capaz de manejar # en una transacción. Para una interfaz ethernet es por defecto: 1500 ifconfig eth0 mtu 1024
For more information about the ifconfig command, see here.
In the next post, we will talk about the NetworkManager, the configuration of its files, the management of its daemon and its associated commands, plus the use of the Command "Ip".
Very good article, Eng. It hurts that you don't have an academy to teach your classes personally. Go ahead with the other publications
Excellent, thank you very much!
Thanks for your comments!
Magnificent contributions, back in the day I created a .deb package following a series of steps that I have pointed out but it is still quite a bummer and it would be very appreciated if there was an application with a friendly interface that automates the whole process: I would give my application, the packages of the dependencies should be able to choose them easily, path for documentation, help to create the text file with the documentation, some options on whether or not to put launcher in the menu with the application type (office, development, internet , ...) and whatever it takes.
I don't know it 100% to program it and I don't have time to get into this (family, work, learning Esperanto, ...)