Linux ubuntu connecting to wifi via terminal. How to set up a Wifi connection on any Linux desktop

This guide explains how to connect a computer to the network using configuration files and console utilities. The main goal is to talk about different ways to connect to the Internet without using a GUI ( GUI). The manual does not cover topics such as setting up network filters or, for example, your own points Wi-Fi access. It is assumed that there is a certain method of connecting to the Internet provided by the provider, to use which you must follow the steps below.

The guide provides examples of editing configuration files using text editors"nano" and "gedit". Please note that the first editor is launched in the terminal and can be used either when running Ubuntu with or without a GUI, while "gedit" can only be used when the GUI is enabled.

System requirements

Any system installation option is suitable to reproduce the actions described in the manual. A graphical user interface is not required. All actions must be performed in the console. It is understood that commands starting with the $ symbol must be executed as a user, and those starting with # must be executed as a superuser (root).

Before you begin, make sure that:

    Various network filters (for example, iptables), and their configuration utilities (for example, Firestarter) are disabled/correctly configured and do not interfere with the operation of the network.

    You have all the necessary parameters for connecting on your network (for example, IP address, subnet mask and default gateway for a connection using a static IP).

    Network devices that filter by MAC address are correctly configured and “know” your network interface.

    The driver of your network device is installed correctly, the cable (for a wired connection) is working properly and connected.

For settings you will definitely need your name network adapter. You can find it out from the command output:

$ sudo lshw -C network

It allows you to view connected network devices.

Example command output:

Ubuntu@ubuntu:~$ sudo lshw -C network *-network description: Ethernet interface # Device type product: L2 100 Mbit Ethernet Adapter # Adapter name vendor: Attansic Technology Corp. # Device manufacturer physical id: 0 bus info: pci@0000:03:00.0 logical name: eth0 # Network interface name version: a0 serial: 00:00:00:00:00:00 # Physical address of the device (mac address) size: 100MB/s capacity: 100MB/s width: 64 bits clock: 33MHz capabilities: pm msi pciexpress vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=atl2 # Used driver driverversion=2.2.3 # Driver version duplex=full firmware=L2 ip=192.168.0.5 latency=0 link=yes # Availability of link module=atl2 multicast=yes port=twisted pair speed=100MB/s # Current connection speed.

Pay attention to the line:

Logical name: eth0

eth0 is the desired name of the network interface.

The name eth0 will be further used to configure this particular network card. Where eth indicates that the Ethernet interface is used, and 0 is the device number. If you have several installed network devices, then, accordingly, they will be given names: eth0, eth1, eth2, etc.

After the implementation of SystemD (since Ubuntu 15.04), network interfaces may have other names (not ethX). This was done so that the names of network devices do not change when new adapters are connected to the machine (lately, some USB modems act as a network adapter). As a result, eth0 can be called for example enp0s4 or eno1, or even enx78e7d1ea46da. This is the name of the network adapter that should be used in setting up the network.

More details about the name network interfaces You can read it in SystemD (English).

This renaming can be disabled by adding /etc/default/grub, to a string with a variable GRUB_CMDLINE_LINUX_DEFAULT line net.ifnames=0. After this you need to do sudo update-grub

Setting up a wired network

Setting IP address, default gateway, subnet mask

/etc/network/interfaces, for example like this:

And add to it:
For static IP:

Iface eth0 inet static address 192.168.0.1 netmask 255.255.255.0 gateway 192.168.0.254 dns-nameservers 192.168.0.254 8.8.8.8 auto eth0

    Iface eth0 inet static - indicates that the interface (iface eth0) is in the IPv4 (inet) address range with a static ip (static);

    Address 192.168.0.1 - indicates that the IP address (address) of our network card is 192.168.0.1;

    Netmask 255.255.255.0 - indicates that our subnet mask (netmask) is 255.255.255.0;

    Gateway 192.168.0.254 - default gateway address 192.168.0.254;

    Dns-nameservers 192.168.0.254 8.8.8.8 - addresses DNS servers(we'll talk about the bottom later)

    Auto eth0 - indicates to the system that the eth0 interface should be enabled automatically when the system boots with the above parameters.

eth0- the name of your interface being connected. The list of interfaces can be viewed by typing:

$ip addr

As a result, the file /etc/network/interfaces should look something like this:
(for one wired connection with static IP)

# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # My wired network. iface eth0 inet static address 192.168.0.1 netmask 255.255.255.0 gateway 192.168.0.254 dns-nameservers 192.168.0.254 8.8.8.8 auto eth0

Save the file and close the editor. IN in this example (nano editor) - press Ctrl + X , then Y , make sure the "Write File Name" is /etc/network/interfaces and press Enter .

More details about file syntax /etc/network/interfaces can be read in the documentation.

Example configuration for dynamic IP:

Iface eth0 inet dhcp auto eth0

Temporarily setting the IP address and subnet mask

If you need to set test settings, do:

$ sudo ip addr add 192.168.0.1/24 dev eth0

Where 192.168.0.1 is our IP address, /24 is the number of bits in the prefix part of the address (corresponding to the subnet mask 255.255.255.0).
eth0- plug-in network interface.

These settings will disappear after a system reboot and will not affect the file /etc/network/interfaces

DNS Settings

The resolvconf utility, which works in tandem with a small DNS caching server dnsmasq, is responsible for the DNS configuration. resolvconf allows you to configure DNS based on data from different subsystems.
One of the consequences of this useful innovation (the transition to this scheme occurred in Ubuntu starting with version 12.04) is that now the /etc/resolv.conf file is generated automatically, and not individually by each program that wants to change it (sometimes overwriting changes made earlier ). Automatic generation of /etc/resolv.conf means that manual changes made to it will be lost.
The automatically generated /etc/resolv.conf contains a link to the DNS server on the local interface (127.0.1.1), and there (on port 53) sits the dnsmasq service, which is responsible for resolving symbolic names into IP addresses. It should be noted that this port (53) is open in LISTEN mode, but since Since this is a local interface, this port is not accessible from the external network.
DNS information for static interfaces must now be entered in /etc/network/interfaces in the dns-nameservers, dns-search and dns-domain parameters (which correspond to the nameserver, search and domain parameters in /etc/resolv.conf)

Please note that in /etc/resolv.conf, when recording several servers, several nameserver keys are used, and in /etc/network/interfaces all DNS server addresses were written in one line after the dns-nameservers key, separated by spaces.

As a result, the description of the static interface in /etc/network/interfaces should look something like this:

Iface eth0 inet static address 192.168.0.1 netmask 255.255.255.0 gateway 192.168.0.254 dns-nameservers 8.8.8.8 192.168.0.254 auto eth0

Ubuntu up to version 12.04

In older versions of ubuntu, when there is a need to specify static addresses DNS servers (if they are not provided automatically) run:

$ sudo gedit /etc/resolv.conf

and enter the DNS server addresses there (separate records for each server):

Nameserver 192.168.0.100 nameserver 192.168.0.200

Where 192.168.0.100 and 192.168.0.200 are the DNS server addresses. If you need to add more addresses, each address must start on a new line and with the phrase nameserver

Setting up ppp connections

The daemon is responsible for creating point-to-point connections in Ubuntu. pppd, more detailed information about which is available in the documentation. This guide will cover examples of creating a PPPoE connection via a DSL modem, a PPTP connection (VPN connection) and a DIAL-UP connection via a regular modem.

PPPoE connection

To standard installing Ubuntu includes a utility for setting up PPPoE connections – pppoeconf, to launch it, type:

$ sudo pppoeconf

A “pseudographic” window will appear in the terminal. The utility will search for network devices and display them on the screen, then it will search for a modem on these devices. If at this stage pppoeconf gives a negative result, check the correct connection and power supply of the modem. The next step is choosing “popular options” - in most cases you should agree. Next, the utility will ask for your login and then a password. Now - choosing a method for specifying DNS servers. Again, in most cases you should agree to receive DNS server addresses automatically. Next, you will be asked to limit the MSS size to 1452 bytes - as a rule, you should agree. The next question is whether to establish a connection automatically when the computer boots. The last question from the utility is whether to establish a connection now. pppoeconf by default creates the name dsl-provider for the connection. You can manage the connection using the commands:

$ sudo pon dsl-provider # To connect or $ sudo poff dsl-provider # To disconnect

If in your case the options provided by the utility pppoeconf is not enough - consult the pppd or pppoeconf documentation.

Note: when setting up a connection using pppoeconf Some settings are written to /etc/network/interfaces, as a result of which Network Manager can no longer manage the network. Exit: either use only NM, or only console + configs. You can return control of Network Manager as follows. Bring /etc/network/interfaces to the following form (it is not necessary to delete the excess, just comment it out):

# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback

Restart the network:

Reboot or restart Network Manager:

$ sudo /etc/init.d/NetworkManager restart

PPTP connection

To make a VPN connection using pppd you will need to install the package pptp-linux, which can be found at installation disk Ubuntu. Next, create (as root) in the folder /etc/ppp/peers file with the name of your provider and edit it, for example like this:

$ sudo nano /etc/ppp/peers/my-provider

And add connection options there, for example:

Persist # If the connection is broken, reconnect again. maxfail 0 # Maximum number of failed connection attempts. 0 - infinite. mtu 1476 # Value MTU name (login) # Your login. #nodefaultroute # Do not be the default gateway defaultroute # Be the default gateway replacedefaultroute # Replace the default gateway if it was remotename (vpn) # Name remote server(for us) can be anything. pty "pptp (server_address) --nolaunchpppd" # Command to launch pptp. # Server address - can be either an IP address or domain name, for example vpn.foo.bar

(login) (vpn) (password)

After the system reboots, you will be able to manage the connection using the commands:

The process of setting up a VPN connection can be greatly simplified by a script assistant.

Setting up DIAL-UP connection

To configure a modem connection, you can use the built-in configurator pppd - pppconfig or special utility wvdial .

Using pppconfig

Setup process using pppconfig looks a lot like a utility pppoeconfig, You will be asked one by one questions about the connection parameters, and will be asked to enter your phone number, login and password, as well as the connection name. You should run pppconfig with superuser rights. For example like this:

$sudo pppconfig

You can manage the connection like this:

$ sudo pon my-provider # To connect or $ sudo poff my-provider # To disconnect

Where my-provider is the name you assigned to the connection during setup.

Using wvdial

In some cases (for example, when connecting using mobile phone), more convenient to use wvdial. To do this, you need to install it first. For example like this:

$ sudo apt-get install wvdial

Included in the package wvdial includes an automatic configuration utility - wvdialconf .

$sudo wvdialconf

The output will be something like this:

Ubuntu@ubuntu:~$ sudo wvdialconf password for ubuntu: Editing `/etc/wvdial.conf". Scanning your serial ports for a modem. Modem Port Scan<*1>: S0 S1 S2 S3 WvModem<*1>: Cannot get information for serial port. ttyACM0<*1>: ATQ0 V1 E1 -- ​​OK ttyACM0<*1>: ATQ0 V1 E1 Z -- OK ttyACM0<*1>: ATQ0 V1 E1 S0=0 -- OK ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK ttyACM0<*1>: Modem Identifier: ATI -- Manufacturer: QUALCOMM INCORPORATED ttyACM0<*1>: Speed ​​4800: AT -- OK ttyACM0<*1>: Speed ​​9600: AT -- OK ttyACM0<*1>: Speed ​​19200: AT -- OK ttyACM0<*1>: Speed ​​38400: AT -- OK ttyACM0<*1>: Speed ​​57600: AT -- OK ttyACM0<*1>: Speed ​​115200: AT -- OK ttyACM0<*1>: Speed ​​230400: AT -- OK ttyACM0<*1>: Speed ​​460800: AT -- OK ttyACM0<*1>: Max speed is 460800; that should be safe. ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK Found an USB modem on /dev/ttyACM0. Modem configuration written to /etc/wvdial.conf. ttyACM0 : Speed ​​460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

Now all that remains is to edit the file /etc/wvdial.conf and add your phone number, login and password to it.

$ sudo nano /etc/wvdial.conf

Init1 = ATZ Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Modem Type = USB Modem ISDN = 0 Idle Seconds = 0 New PPPD = yes Dial Attempts = 0 Phone = #777 Modem = /dev/ttyACM0 Username = mobile Password = internet Baud = 460800 Idle Seconds = 0 # The time the connection is idle, # after which it will need to be disconnected. Value 0 - never. Dial Attempts = 0 # Number of dial attempts. 0 - infinite. Dial Command = ATDP # Dial command (P - pulse, T - tone). Makes sense for pulse dialing on older PBXs.

The /etc/wvdial.conf file is divided into sections, the separators of which are the section names themselves, preceded by the word Dialer, in square brackets. If you execute the command without parameters, then the settings listed in the Defaults section will be used. IN otherwise In addition, the commands specified in the additional sections will be executed.

Now that everything is configured, the connection can be established by typing:

$sudo wvdial

If you need to start wvdial with pulse dialing, you can do this with the command

$ sudo wvdial pulse

You can terminate the connection by interrupting the execution of the wvdial command, i.e. in the same terminal you need to press Ctrl + C.

Automatic connection

Edit the configuration file /etc/network/interfaces, for example like this:

$ sudo nano /etc/network/interfaces

And add to it:
For pppoe, pptp, and modem connection without using wvdial :

Iface ppp0 inet ppp provider my-provider auto ppp0

Where my-provider- the name of your connection.
Using wvdial:

Iface ppp0 inet wvdial provider wvdial auto ppp0

Now when you restart network services, the connection will be automatically established.

Manual routing setup

If you do not receive the default gateway address from the server you are connecting to, or for any other reason you need to specify routes manually, you can create your own script in /etc/ppp/ip-up.d/, or according to the recommendation of the official documentation, create /etc/ppp/ip-up.local for example like this:

$ sudo nano /etc/ppp/ip-up.local

$ sudo nano /etc/ppp/ip-up.d/routing

with with the following code:

#! /bin/sh # route del default route add default ppp0 # Ppp connection name. # here are the necessary routes, for example: route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1 dev eth0

$ sudo chmod ug+x /etc/ppp/ip-up.local

$ sudo chmod ug+x /etc/ppp/ip-up.d/routing

Now routes will be automatically connected when a ppp connection is established.

Setting MTU and TTL

MTU (Maximum Transfer Unit) - the parameter determines the value of the maximum transfer unit. This is the maximum number of octets (bytes) that the interface is capable of supporting in a single transmit/receive operation. For Ethernet this default value is 1500 ( maximum size Ethernet packet).

TTL (Time To Live) - lifetime of an IP packet in seconds. Needed to avoid overloading the network with packets. Typically, each router through which the packet passed reduces the TTL by one. If TTL=0, the packet is removed from the system. Initially TTL=128 (for Windows) and TTL=64 (for Ubuntu). For DNS records TTL determines how long data is up to date when caching queries.

To change the MTU value, edit the configuration file /etc/network/interfaces, for example like this:

Auto eth0 iface eth0 inet static address 192.168.1.5 netmask 255.255.255.0 mtu 600

To change the TTL value, type:

$ sudo su then # echo "128" > /proc/sys/net/ipv4/ip_default_ttl

The TTL value changes only with administrator rights, to log out of the administrator account, enter exit

WiFi setup

Setting up Wi-Fi using wpa-supplicant and /etc/network/interfaces

This chapter will talk about setting up a connection to existing Wi-Fi networks using the most secure encryption and authentication standard available today, WPA2. Additionally, examples of settings for less secure connections are provided.

If you can influence the settings of the access point, for example, if it is your home Wi-Fi router- try to configure authorization using WPA2, because This is the most secure authentication protocol for wireless networks currently available.

Notes

Problem solving

Wi-Fi/Ethernet connection with access point/router cannot be established

Symptoms: The network usually initially works fine, for a long or short time, and then suddenly disappears and does not appear after a reboot. This problem may not be permanent. The network starts working “by itself” and then disappears again. When restarting the network adapter this way:

Sudo ifdown wlan0 sudo ifup wlan0

similar text will be displayed in the console

Listening on LPF/wlan0/00-02-2A-E1-E0-6C Sending on LPF/wlan0/00-02-2A-E1-E0-6C Sending on Socket/fallback DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8 DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8 DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 15 No DHCPOFFERS received. No working leases in persistent database - sleeping.

Cause of the problem maybe that motherboard It is not completely de-energized when the computer is turned off. In this case, some peripheral equipment is probably not de-energized, incl. may not be de-energized usb ports. If you use for example Wi-Fi USB adapter, then in this case you can see the LED on the adapter burning (if it is equipped with one). The problem probably occurs because the network equipment does not work entirely correctly in this mode.

A simple solution The problem is to turn off the computer and unplug the power cord from the outlet, then plug in the power cord and turn on the computer.

Difficult decision the problem is the setup BIOS parameters to complete blackout network equipment when turning off the computer.

Sometimes the Wi-Fi connection to the access point/router drops completely

Symptoms: the network initially works, and then after rebooting the access point/router it suddenly disappears, and does not appear either after a reboot or after dancing with a tambourine. Wherein wireless adapter he doesn’t see the access point point-blank (although it may be standing next to the computer), but he sees all the neighboring networks perfectly. Then, after the ~tenth~ reboot of the router, the network reappears by itself.

Cause of the problem It may be that some routers arbitrarily select the working channel number, ignoring the channel number selected in the router settings. If the channel number for the wireless interface is listed in the /etc/network/interfaces file, then this is likely the problem. Channel number 6 is indicated in the file something like this:

Auto wlan0 ... wireless-channel 6

A simple solution The problem is to comment out this parameter so that the adapter is not limited to only this channel, and restart the network

Auto wlan0 ... #wireless-channel 6

Difficult decision The problem is to register the bug on the website of the router manufacturer (firmware for it) and update the router firmware after (if) it is fixed.

Restarting the network

Now that all the necessary steps have been completed, you can restart the network and check the connection. For this:

$ sudo /etc/init.d/networking restart

Now, when you run the ip addr command, the eth0 connection with the configured parameters should be displayed. If the connection is visible, but the settings are not the same as those specified in the /etc/network/interfaces file, or any other errors occur, double-check this file for inaccuracies or typos and try restarting the network again.

Network FAQ

How to log into my computer from outside (via the Internet)?

First, you need to find out what IP address your provider gives you - gray or white (not to be confused with static/dynamic). If it's gray, then nothing will work. If white, then two options are possible:

    There is no router or it is operating in bridge mode. In this case, a white IP address is assigned to the computer itself. We enter the address - we get to the computer, everything is simple.

    The white address is assigned to the router. Accordingly, this address takes us to the router, and not to the computer. To get to the computer, you need to forward ports on the router (see below).

I think my network is too slow!

Measure the network speed between two computers using iperf. You can use this instruction. It suggests compiling the program from source, but you can simply install it from the repository. If iperf shows a value slightly lower than expected, then everything is fine with the network, the problem may be in the hardware (hard drive/processor cannot provide high speed), in the transfer method (for example, scp and ftp are very slow), in the settings ( speed may be limited, e.g. FTP settings-server) or something else. If iperf showed a value that is several times less than desired, then yes, there is a problem with the network. It’s worth checking whether the card is working in the required mode (for example, using ethtool), checking for “errors” in the ifconfig output, and testing the connection speed to a third computer.

How can I find out what programs are listening on ports on my computer?

To view a list of open ports and the names of programs listening to them, use the command:

Sudo netstat -nlpA inet,inet6

You can use grep to display information about a specific port. For example, for 80 port:

Sudo netstat -nlpA inet,inet6 | grep:80

It is not always clear from the netstat output which program is being referred to (for example, 2671/python), ps will tell you more about the process:

PS aux | grep 2671

How to assign two IP addresses to one network card?

For example, the interface eth0 need to add address 192.168.1.1 . Briefly, until the network is restarted:

Sudo ip addr add 192.168.1.1/24 dev eth0

Forever - add the following to /etc/network/interfaces:

#fix line auto auto eth0 eth0:1 # add alias iface eth0:1 inet static address 192.168.1.1 netmask 255.255.255.0

How to forward a port?

For example, you need to forward port 8081. Let's call the address to which the client accesses external_ip, and the address to which it should go is internal_ip.

Iptables -t nat -A PREROUTING -p tcp -d external_ir --dport 8081 -j DNAT --to-destination internal_ir:8081 iptables -t nat -A POSTROUTING -p tcp --dst internal_ir --dport 8081 -j SNAT - -to-source external_ir

And you definitely need something like

Iptables -t filter -A FORWARD -m conntrack --ctstate DNAT -j ACCEPT

IN modern world It's rare to find people who use a wired connection directly to their laptop. Most often, the wire is connected to a router, which, in turn, distributes Wi-Fi to other devices on the network. There are gadgets on which Wi-fi setup in Ubuntu is not required - the device is capable of accessing the network out of the box. However, there are also products that require certain actions to be able to access the Internet.

Installing Wi-fi driver in Ubuntu

If Ubuntu does not detect the presence network connections to Wi-fi, most likely not installed in the system required driver. There are a huge number of manufacturers, as well as the models of Wi-Fi adapters they offer, and the method of installing drivers is universal for everyone, so the Broadcom adapter was chosen as an example.

The first step is to determine the manufacturer network card installed on the computer. To do this, run the command:

sudo lspci | grep Network

There can be many options here:

  • Broadcom;
  • Intel;
  • Realtek;

There are several driver options available for each manufacturer. To select a utility for your device, you need to use the official Linux driver repository:

There are 4 drivers for Broadcom. You need to select among those for which the last column indicates connection via PCI bus. This criterion is satisfied:

  • brcmfmac;
  • b43-legacy;

Among them you can find a driver with advanced capabilities, but it is not a fact that it will fit the existing adapter. b43 offers many modes, but the list of supported models does not include the one you need (BCM 4313).

This does not mean that setting up Wi-fi in Linux is complete. Now we need to consider other options. brcmcmac is suitable for model 4313. So you need to download it.

You can find a suitable driver by PCI ID. This parameter makes it clear that the software is compatible with the board. To view the PCI ID for Broadcom, enter the following command in the terminal:

Using this principle, you can find drivers for any model of network adapter.

Attention! Before starting the driver, you may need to install firmware, as described on the download page.

According to the instructions, the downloaded fw file must be copied to the /lib/firmware/brcm folder. To do this, in the terminal you need to run:

sudo cp bcm43* /lib/firmware/brcm/

Finally, the required kernel module is loaded. Before doing this, you should block the remaining modules to prevent them from loading automatically.

  1. Unload modules:
    sudo modprobe -r wl
    s udo modprobe -r b43
    sudo modprobe -r b43-legaxy
  2. Restrict their downloads by adding them to the blacklist:

    vi /etc/modprobe.d/blacklist-bcm.conf

    blacklist b43
    blacklist b43-legacy
    blacklist wl

  3. Launch the driver itself:

This completes the steps for setting up Wi-fi in Linux.

How to connect Wi-fi Ubuntu

There are now two ways to connect to a wireless network. The first is to use the GUI, the second is to configure Wi-fi connection through Linux console. The terminal is used in cases where the graphical interface is not available, or more specific network settings are required.

Setting up Wi-fi in Ubuntu via GUI

This method is already familiar and visually convenient. After setting up the Wi-Fi adapter, the “Network” icon appeared in the Linux tray. Clicking on it with the left mouse button opens the network connections menu, which lists a list of available networks. Once you select the desired access point, Ubuntu will notify you that authentication is required. All that remains is to enter the password. If successful, a message will appear that the connection has been established, and the tray icon will show the Wi-fi signal strength.

Setting up Wi-fi in Ubuntu via terminal

Network Manager, which allows you to configure your connection automatically, is usually installed by default with Ubuntu. However, in some builds it is missing. For example, to configure Wi-fi on Ubuntu Server easier to use command line. Sometimes users uninstall the manager themselves because it slows down the system boot.

Transferring data to Wi-fi networks encrypted with WEP, WEB and WPA/WPA2 protocols. The first one can be hacked in a matter of minutes, as a result of which it is rarely used. Therefore, the most reliable and widespread WPA protocol will be considered.

The process is divided into the following stages:

  1. Check the network for available access points.
  2. Connect to the selected point via wpa_supplicant.
  3. Assign an IP address.
  4. Configure DNS servers to open web pages correctly.

At the first stage, the iwlist utility is launched:

Subsequent configuration requires creation configuration file. Since the H30_CE550 network has been identified, we will work with it:

wpa_passphrase H30_CE550 > wpa.conf

The connection is created using wpa_supplicant:

sudo wpa_supplicant -Dnl80211 -iwlp3s0b1 -cwpa.conf

D – option that specifies the Ubuntu nl80211 Wi-fi driver. It should not be confused with device drivers, since it is initially present in the system and serves as an intermediary between the system and the adapter. If the command does not work, then you need to specify an outdated wext driver in the -D option.

I indicates the interface. It can be found out from the result of the iwlist scan.

In the -c parameter you need to enter the created configuration file.

The DHCP protocol is used to obtain an IP address. First you need to scan available servers using the dhclient utility:

Next, a request to obtain an IP is sent:

sudo dhclient -i wlp3s0b1

You can verify the successful assignment of the address using the ifconfig command.

At this point, the Ubuntu connection to Wi-fi is completed - Internet access is open.

How to distribute Wi-fi in Ubuntu

This instruction Suitable for users of OS version 16.04 and higher. In old Ubuntu versions ability to create an access point for Wi-fi distribution implemented through the terminal.

For Ubuntu settings As a kind of router, you need a Wi-Fi adapter.

It is assumed that the Ethernet cable is connected directly to the device. Now in the “Network” menu, called up from the tray, you need to select “Edit connections”, and then, highlighting “Ethernet”, click the Add button. “Wi-fi” should be set in the drop-down list. After clicking the “Create” button, the connection settings window will open.

The following values ​​are set on the Wi-fi tab:

  • SSID – laptop-share;
  • Mode -

On the “Security” tab, you need to install the WPA/WPA2 protocol and set a password, and in the IPv4 parameters select the “Provide the network to other computers” mode.

After saving the settings, you will need to activate the connection by selecting the created access point in the “Connect to Hidden Wi-fi network” window.

Dot Ubuntu access created and available for connecting other devices to it.

Why Ubuntu won't connect to Wi-fi

There may be several reasons.

  1. Adapter missing. Terminal commands will help you find out:
  • ifconfig;
  • iwconfig;
  • lspci;
  • lsusb;
  • lsmod.

If the results of their execution do not show the adapter, then that is the problem.

  1. There is an adapter, but it is disabled. Some laptops have the ability to disable it by pressing one of the Fn keys.
  2. There are no Wi-Fi networks.

Conclusion

Wi-fi setup in Ubuntu is not difficult even for beginners Linux environment. Essentially, the main task is to install the driver on the Wi-Fi adapter. All subsequent actions are usually performed using the graphical interface and only in rare cases when it is not available, they resort to the terminal. In new versions of Ubuntu, it has become possible to configure an access point without using the console, which greatly simplifies the distribution of the Internet for an inexperienced user.

How to turn on wifi on a laptop? This question is often asked by beginners who are just learning how to use a computer. Their question is quite appropriate, since wifi on a laptop does not always connect to the network automatically.

In addition, in most cases you need to manually select a network and then enter a password. In this article I will talk about basic concepts that simply answer the question posed. So, how to connect to laptop wifi, on Linux and Windows?

Firstly, you need to make sure at the beginning that your wifi router working and configured. Perhaps necessary. If this is not the case, or you just bought it and didn’t even try to configure it, or your settings are lost, then you need to configure your wifi router yourself.

If you understand the essence and learn to do it yourself, then you will not need to constantly call a specialist and pay him money if there are failures. And setting up a router is very simple if you understand the concept. There are a lot of models of wifi routers, but the essence and principles are the same. I will show it on my wifi router, and you just project it onto your box with an antenna.


To set up your router, you need to connect it to your laptop via a network cable:

After you connect the wifi router to your laptop, you need to open your browser and enter the following address in the address bar: 192.168.1.0 The address in rare cases may be different and then you will need to read the instructions for the router.


After entering your address, you will be asked to enter your username and password. They are usually like this: admin and admin. If everything is correct, then you will connect to your router and see something like this:

After this, you need to do the following, as shown in the picture and signed with numbers:

1. Look for a tab in the menu called Wireless or Wifi.

2. Enter in English letters the name that your access point will be called. It is by this name that you will then distinguish your wifi from someone else’s.

3. Choose the type of encryption, you can set it as shown in the photo.

4. And comes up with a long password of letters and numbers so that... That's it, now save the settings, your wifi router is configured and ready to go.

Now all we have left is setting up wifi on laptop.

How to enable wifi on a laptop in Linux?

Since I use Linux, I'll start with it. The first thing you should check is whether wifi is turned on at all on the laptop? The fact is that many laptop models have a mechanical wifi switch.

And some people, without knowing this, complain that... Usually, when there is such a button or switch, there is also a light that signals whether wifi is on or not.

But let's assume that everything works for you. Then you just need to find the wireless networks icon and left-click on it. You should see a list of available wireless networks. This is what it looks like for me:

We find our network, click on it with the mouse, enter the password and enjoy the Internet. It's simple, as you can see. But what about on Windows?

How to enable wifi on a laptop in Windows?

It's all the same analogy. In the right corner of the panel, look for the network connection shortcut. We find ours there wireless network, click on it, press the connect button and enter the password. After this, the Internet should connect.

Well, if you still don’t fully understand how to connect Wi-Fi on a laptop, then watch this video instruction, since it’s better to see once than to read a hundred times.

In general, dedicated to all those who are killing time setting up Wi-Fi on Ubuntu after Windows 7;)

P.S. I hope my case will help someone ;)

Yes, there are such tricks. I had this: I go into Linux - the sound works, I reboot into Windows - it’s gone. I turn it off and on and it works. Miracles, I still don’t understand on what principle all this happens, like at the BIOS level, probably.

Greetings my dear reader! Today we will talk about Ubuntu WiFi problems. The surest way to connect a computer to any operating system is the wire. But it is not always possible to install a cable, so an even simpler connection method is Wi-Fi.

This is where Linux OS users may have problems, since not all Ubuntu distributions have built-in Wi-Fi module drivers. This is understandable; system manufacturers specifically try not to load it with all sorts of rubbish. Since you are reading these lines, then most likely you are having difficulties with WiFi setup. But there is nothing terrible and now we will solve this unfortunate and nasty problem.

How to install drivers

And so, first of all, you need to find out what model of transmitter is inside. In addition, it would be good to know the name of the company that produced the transmitter. To do this, open the console and carefully enter the command:

$sudo lspci | grep Network

Now we know the model name of the hardware transmitter. All that remains is to download the driver for Linux. Go to the page.


Now look very carefully at the second column - this is the manufacturer. There may be several options like mine. Therefore, after this we find the last column - the connection type will be indicated there. Since I am using an internal module that is connected to PCI, I choose this option. So you can look at the types of standards supported - "a/b/g/n" to make sure that you are downloading exactly what you need.


Open the driver that you consider the most acceptable option. Now find the name of the model of your module in the table. And so, just to be sure, let's check that PCI-ID is the first column. You can find out the PCI-ID using the command:


Now look carefully at the second column - if there is a driver, then you will see the inscription “Yes”, if it is not there, then “No”. If you see that there is no firewood of this type, then go back to the page and look at another package.


As soon as we find the required driver, we need to download it. Click on the link at the very beginning after the inscription “For example”. You may need to install a driver, but as already mentioned, it is built into the system itself.

But you will need to install the firmware. Therefore, you need to look at the “Firmware installation” section. There may be a link to the file and firmware that you will need to copy and download. Each driver may have its own specific nuances, so just read this point carefully.

In my case, I need to download the package and copy it to a separate folder. Next, you will need to unload the modules in order:

$ sudo modprobe -r wl
$ sudo modprobe -r b43
$ sudo modprobe -r b43-legaxy

We also add modules to the emergency situation so that the system does not load them.

$ vi /etc/modprobe.d/blacklist-bcm.conf
blacklist b43
blacklist b43-legacy
blacklist wl

Now the module needs to be launched, for this there is a simple command in the console:

$ sudo modprobe brcmsmac

All Wi-Fi radio waves should now be hovering around you. I’ll say right away that I gave an example on my device, installing drivers follows the same principle, but there may be some differences. This is especially true for firmware - about it you need to look at the separate instructions for your model.

How to connect WiFi in Ubuntu

The connection is now approximately the same as in Windows or other operating systems. At the very top you should see a small icon that somewhat resembles a triangle. Just click on it and select the desired network and enter the password. Now there should be internet on your computer.


There are cases when such an icon simply does not appear or you need to do it through the command line. To connect to WiFi, open the console. And so all the actions will need to be done manually, so let’s get started.

  1. We scan all the nearest airspace:


  1. The ESSID line will contain the name that we will use to connect. Next we write:

$ wpa_passphrase NETWORK_NAME_ESSID > wpa.conf


  1. I hope you already understand that instead of the second word you need to enter the name of your network. Next, enter the connection key.


  1. Now to connect you need to enter the command as in the picture above. After “-D” you need to enter the name of the driver. After “-i” is the name of the interface that is used by your equipment. The last “-c” is the name of the file we created earlier.
  2. We connected to the router, but now we need to get a network address and register DNS. Open a new window, but without closing the old one, and write:

$ sudo dhclient -r
$ sudo dhclient -i wlp3s0b1



Now you know how to quickly set up WiFi and get it running, the connection should already be working. You can try pinging a website to be sure. On Linux everything is much more complicated, but after all the steps described in the article everything should work stably.

WITH Wi-Fi support There are some problems with adapters in Ubuntu. It’s good if you can choose a known compatible model when purchasing, but more often you have to use the equipment that you have. In this case, you will have to install the adapter yourself. Today we will look at just such a case.

Looking ahead, let's say that there is nothing complicated about connecting unsupported Wi-Fi adapters. Despite the fact that a number of actions we perform can be performed using a graphical interface, we will work exclusively in the console, which will allow us to use the recommendations in this article for both desktop and server versions of Ubuntu.

For example, consider connecting an inexpensive USB adapter in Ubuntu 12.04 LTS TP-Link TL-WN725N.

Let's go to the home directory and download the repository archive, having previously elevated the rights to superuser:

Sudo-s
cd ~
wget "https://github.com/lwfinger/rtl8188eu/archive/master.zip"

Let's unpack the archive (if necessary, install unzip).

Unzip master.zip

As you can see from the command output, the contents of the archive were unpacked into the directory rtl8188eu-master, go to it and build the module:

Cd rtl8188eu-master
make

After building the module, it should appear in the directory file 8188eu.ko, this is the required kernel module. Now install it with the command:

Make install

All that remains is to enable our module by running the command:

Modprobe 8188eu

or simply disconnect and reconnect the adapter. IN desktop system you will immediately see a message about the ability to connect to a wireless network.

Or run the command in the console:

Ifconfig

In the output you will see the wireless interface appear wlan0.

As you can see, there is nothing complicated. However, you should remember that the module is built and installed under the current version of the kernel, and when updating it, you will need to build and install the module again. If this is not possible, then you should hold Shift When loading, select and load the kernel version for which the module is built.

Computer