How to configure the Ubuntu network

Today weโ€™ll talk about how to configure the Ubuntu network . This operating system has several graphical tools for similar work. Particular attention should also be paid to network management using the command line.

Ethernet interfaces

ubuntu network setup
First of all, setting up a Ubuntu network concerns working with this technology. Ethernet interfaces in the system are referred to as ethX. Moreover, X is a certain number. Typically, the first Ethernet type interface is designated eth0. The number of all subsequent increases by one. To quickly identify all available network interfaces, you can use the ifconfig command.

There is an alternative. Another application that can help identify available network interfaces is the lshw command. In Ubuntu, network configuration from the console using this solution allows you to find out the connection number, bus information, driver information, and a list of supported features. The logical names of the required interfaces can be specified in the net.rules file.

Go to the next step. If it is necessary to find out which of the interfaces will receive one or another logical name, we find the line that corresponds to the physical MAC address of this element. Change the value of NAME = ethX. Specify the necessary logical name. We reboot the system to apply the changes. There is a special Ethtool program that changes and shows the network card settings, including the Wake-on-LAN function, duplex mode, port speed and auto-negotiation. This tool is not installed initially, but is available in the repositories. Changes made with the Ethtool team are temporary. They will be canceled after a system reboot. If it is necessary to save the settings, we add the appropriate Ethtool command, entering it in the pre-up line of the interfaces file. The described solution works not only with statically configured interfaces, but also with other options, for example, DHCP.

IP Addressing

ubuntu server network setup
In the next step, setting up a Ubuntu network is directly related to the settings of the IP computer and the gateway. This step is necessary to organize a local connection, as well as access to the Internet. To temporarily configure the network, we use the standard commands: route, ifconfig and ip. These solutions will allow you to change the parameters with instant application. However, the settings in this case will be canceled after a reboot. If DNS values โ€‹โ€‹are required for temporary configuration, add the server IP addresses to the resolv.conf file. It is usually not recommended to edit this material, but this is acceptable in the case of temporary configuration. If the installed parameters are no longer required, cancel all interface settings using the ip command with the addition of flush. Resetting the configuration using the described method does not clear the contents of resolv.conf. To achieve this, delete or manually modify the corresponding entries. You can also reboot so that resolv.conf will be rewritten.

DHCP Client

ubuntu 14 04 network setup
Next, we have to configure the Ubuntu Server network. In order to configure the server to work with DHCP and provide dynamic address assignment, we add the corresponding method to the inet address section for the required interface in the interfaces element. Next, use the ifup command. It allows you to enable the interface manually and activates DHCP through dhclient. Go to the next step. If at some point the Ubuntu Server network setup requires you to disable the interface manually, use the ifdown command. It will start the process of stopping the item and releasing DHCP.

Permanent appointment

ubuntu network setup from console
Now let's discuss how to configure the Ubuntu network in case of a static IP address. Add the static method to the inet section for a specific interface in the interfaces element. You can also use the ifup command. It allows you to enable the interface manually. To deactivate it, use the ifdown command. A particular loopback interface is defined by the system as lo. By default, it sets the following address value to 127.0.0.1. It can be displayed with the ifconfig command. Initially, there are two lines in the interfaces element that are responsible for setting up loopback in automatic mode. We leave these parameters in their original form until there are specific reasons for their adjustment. At the next stage, we determine the IP address based on the host name. Thus, the identification of the resource can be simplified.

So we figured out how to configure the network in Ubuntu 14. 04. This instruction is suitable for other versions of the specified operating system.

Source: https://habr.com/ru/post/K3598/


All Articles