Lecture
/etc/NetworkManager/system-connections/.NOTE NetworkManager
.ini-like file in /etc/NetworkManager/system-connections/ or through a graphical tool (nm-connection-editor). If you were using ifupdown, just remember to deactivate the entries in /etc/network/interfaces that you want Network Manager to handle.
Example 1. DHCP configuration
auto enp0s31f6 iface enp0s33f6 inet dhcp hostname arrakis
IN PRACTICE Names of network interfaces

Network interface names
eth0 (for wired Ethernet) or wlan0 (for WiFi). The number in these names is just a simple incremental counter representing the order in which the interfaces were detected. On modern hardware this order can change with every reboot, so the default names are unreliable./lib/systemd/network/99-default.link (see systemd.link(5) for an explanation of the NamePolicy entry in this file). In practice, names are often based on the device's physical location (as you might guess from where they're connected), and you'll see names starting with en for wired Ethernet and wlWiFi. In the example above, the rest of the name abbreviates the PCI bus number ( p) ( 0), slot number ( s31), function number ( f6).ip addr(or as file names under /sys/class/net/).net.ifnames=0and biosdevname=0.Example 2. Configuring a static IP address
auto enp0s31f6 iface enp0s31f6 inet static address 192.168.1.3/24 broadcast 192.168.1.255 network 192.168.1.0 gateway 192.168.1.1
NOTE Configuring multiple addresses
sources.list File» for more information about this file. Many firmwares are proprietary, which is why they live in this repository. You can try skipping this step if you like, but if the required firmware isn't found at the next step, try again after enabling the non-free section.firmware-* packages. If you don't know which package you need, you can install the isenkram package and run its isenkram-autoinstall-firmware command. Packages are often named after the hardware vendor or the corresponding kernel module: firmware-iwlwifi for Intel wireless cards, firmware-atheros for Qualcomm Atheros, firmware-ralink for Ralink, and so on. A reboot is then recommended, because the kernel driver usually looks for firmware files only on the first boot and not afterward./etc/network/interfaceswpa_supplicantthe command used to configure wireless interfaces (when using WPA/WPA2 encryption). The usual/etc/network/interfacesentry must be extended with two additional parameters to specify the name of the wireless network (also known as its SSID) and the pre-shared key (PSK).Example 3. DHCP Configuration for a Wireless Interface
auto wlp4s0 iface wlp4s0 inet dhcp wpa-ssid Falcot wpa-psk ccb290fd4fe6b11935cbae12345e050edd98ad12345b98ce0151668f8f53c01b
wpa_passphrase SSID passphrasewpa-key-mgmt NONEwpa-psk/usr/share/doc/wpasupplicant/README.Debian.gz/etc/network/interfacesto the root user only, since the file contains a private key that not all users should have access to.WEP encryption
/usr/share/doc/wireless-tools/README.Debian .


TIP Add the ppp command to autostart (boot)
/etc/systemd/system/adsl-connection.service, with contents such as the following:[Unit] Description=ADSL connection [Service] Type=forking ExecStart=/usr/sbin/pppd call dsl-provider Restart=always [Install] WantedBy=multi-user.target
systemctl enable adsl-connection. This service can be started manually with the command systemctl start adsl-connection; it will also be started automatically at system boot.systemd (including Wheezy and earlier versions of Debian), the standard SystemV init system works differently. On such systems, all you need to do is add a line similar to the following to the end of the /etc/inittab file; if the connection drops, init will reconnect it.adsl:2345:respawn:/usr/sbin/pppd call dsl-provider
Crossover cable for a direct Ethernet connection
Many Ubuntu features depend quite heavily on the internet. Of course, you can use the system just fine without a connection to the World Wide Web, but then you'll have to spend a bit more time on certain operations. For example, on request Ubuntu automatically downloads, installs, and configures new applications through the Software Center's simple and clear interface. You simply choose the program you want from the list, and Ubuntu does all the further work of installing it for you. All the same things can be done manually too, but that requires far more steps.
In addition, Ubuntu automatically retrieves information from the internet about new program versions, available security updates, drivers, localization packages, and much more. So it's highly desirable for a computer running Ubuntu to get internet access at least occasionally. Although this isn't strictly necessary, since without updates it's unlikely anything will break, and new programs can be installed manually.
You're probably wondering why I've already started talking about the internet connection before installation even begins? The reason is that the Ubuntu LiveCD is too small to fit localization for every language in the world. So during installation the system will automatically try to download the necessary language packs, but only if you set up the internet connection right there in the LiveCD.
And finally, because of the extremely inadequate legislation in some countries, after installing Ubuntu you'll find various necessary programs missing — for example, codecs for some popular media formats1). So an internet connection will come in handy right after installation too.
I want to point out right away that having a working network connection during Ubuntu installation is absolutely not required! If you don't give the installer access to the World Wide Web, you'll simply end up with a system in English, and that's it. Later on you can easily install localization at any time — I'll even explain how to do that in a couple of articles. So feel free to go ahead and proceed straight to installing Ubuntu right now, and come back to reading this article later. However, since you'll most likely need to learn how to set up an internet connection sooner or later anyway, it's better to do it now if possible, and let Ubuntu handle all the work of downloading and installing the translations for you.
In Ubuntu, the NetworkManager program is used to manage internet connections. It supports practically every existing connection type. But in this article I'll only describe the most common ones, since it's simply unrealistic to cover everything.
NetworkManager is a small icon in the notification area2) (top right of the screen); when not connected, it looks like this:

After connecting to a wired network:

If you left-click the icon, a menu will appear with a list of available and active connections:

By default, this menu only displays discovered wireless networks, plus any currently active connections (if at least one is established). You can activate any connection simply by selecting it from the list, or conversely interrupt any active connection by clicking «Disconnect» below its name.
To configure connections, right-click the NetworkManager icon and select «Edit Connections…»:

The connection editor window will open:

The main window of the network connection editor contains 5 tabs for configuring different connection types and lets you add new connections and manage existing ones.
In principle, the settings for each specific type don't differ much, so I'll go over only the most common connections in detail - regular wired ones. I'll also say a bit about PPPoE and VPN connections, which are popular in Russia.
So, open the connection editor on the Wired tab:

By default the list contains automatically created connections, one for each network adapter. It should be noted right away that network adapters, just like hard drive partitions, have well-defined names in Linux: eth0, eth1, and so on. As you can see, my computer has two network cards installed.
By default these connections are configured for the most common case, i.e. to obtain the IP address and DNS addresses automatically when the cable is plugged in. So if this is exactly the connection method you're using, you don't need to change anything at all - you should already have internet access.
If any connection configuration is required, such as manually specifying an IP address, all you need to do is select the desired connection from the list and click the «Edit» button. The connection editing window will open:

The first tab contains technical parameters that you usually don't need to change. To configure IP addresses, go to the «IPv4 Settings» tab.

Here you can choose your connection method from the list; the most commonly used are «Automatic (DHCP)» and «Manual»:

The first means automatically obtaining an IP and DNS, and it's selected by default. The second is manual configuration of these parameters. Selecting the second option unlocks the settings fields.
You can find out the required settings values from your provider or your system administrator. To enter an IP, click the «Add» button, a new empty row will appear in the list, and you enter your parameters into each field of that row. DNS addresses can be specified in one of the lower rows, separated by commas.

Don't forget to click the «Apply…» button after entering all the necessary settings, to save them. Note that this button will remain disabled until you enter valid settings. By the way, when configuring the internet on an already-installed Ubuntu, you may be asked for your password in order to apply the settings, and only after entering it will you be able to use the modified connection. Keep this in mind and don't be alarmed.
I'd like to immediately draw your attention to the «Connect automatically» toggle in the settings of any connection:

If it's checked, Ubuntu will automatically activate this connection whenever possible. Let me explain using WiFi connections as an example. When you connect to any WiFi network, Ubuntu adds a new connection, saves it in the system, and makes it connect automatically. So every time your computer comes within range of that network, Ubuntu will try to establish a connection with it, without asking you anything. If you're not happy with this behavior, simply turn off auto-connect for the relevant connections in the list.
That's really all there is to it, and there's probably nothing more to say about network configuration in general. However, there are two specific types of connections worth mentioning. If you use one of them, read the relevant section below; otherwise, you can go straight on to the next article and confidently begin the installation.
Actually, there'd be nothing to say here at all if it weren't for one annoying quirk. Generally speaking, you can set up a PPPoE connection on the DSL tab of the NetworkManager program:

Simply click the «Add» button, enter your login and password in the window that appears, leave the other fields blank, and change the IPv4 parameters if needed:

Don't forget to save the settings.
However, sometimes, for not entirely clear reasons, a connection created this way refuses to work. In that case you have to use the console utility pppoeconf.
To launch it, open a terminal (menu Applications→Accessories→Terminal, or Приложения→Стандартные→Терминал in the Russian version of Ubuntu):

In the window that appears, enter the command
sudo pppoeconf
The system will ask for your password (your Ubuntu password, not the PPPoE connection password!), enter it and press Enter. Note that the password isn't displayed at all as you type it - not as asterisks, not as dashes, nothing. This is normal and is how it's supposed to work.
You'll have to answer a few questions; usually there's nothing to change, and it's enough to just enter the login and password provided by your provider, after which the internet connection will be established. By the way, you won't need to enter this command again - all the settings will be saved automatically and restored after disconnecting or rebooting. That said, it's still better to configure the connection through NetworkManager, since in that case you'll have a simple, clear graphical management interface, which the pppoeconf utility lacks.
First off, let me say right away that in the CIS, VPN3) usually means PPTP4), even though in reality the latter is a subset of the former5). What's more, even PPPoE is also a type of VPN. But going forward I'll stick to the established terminology and use VPN to mean PPTP, so as not to confuse you, even though such a generalization is fundamentally incorrect.
That's not where the oddities with VPN end. For some unclear reason, VPN connections6) to the Internet are very popular among providers in the CIS, even though they're not used at all in the rest of the world7). Fortunately, for the sake of users in Russia and its neighbors, PPTP support has been included by default in Ubuntu starting with version 10.04.
You can add a new VPN connection on the tab of the same name in the network configuration manager:

Just click the «Add» button, and a VPN type selection window will appear; only one option is available in it - «Point-to-Point Tunneling Protocol (PPTP)». That's the one you need, so go ahead and click the «Create…» button, after which you'll land in the connection settings editor:

Enter your login and password, and also set the necessary connection parameters by clicking the «Advanced…» button. You can find out about the settings from your provider. Often you can find instructions for connecting a Linux computer to the Internet on their website, in which case just follow them. If needed, contact your provider's technical support for the required connection settings8).
To activate the connection, look under the «VPN Connections» item in the connections list:

I hope you've figured everything out and managed to get access to the Internet; if not, no worries, you can come back to this article at any time.
Comments