Low level connecting to WiFi or wired network.

Share your own howto's etc. Not for support questions!

Low level connecting to WiFi or wired network.

Postby edbarx » 2017-01-28 08:11

This howto is intended for those who are not afraid of the inner workings of their operating system. Establishing a network connection is a simple process involving these steps:

  1. bring the physical network interface up
  2. chose a security system if required
  3. assign an IP address

The Procedure:
  1. To bring up an iterface use:
    Code: Select all
    ifconfig interface up

    Where interface can be wlan0, wlan1, wlan2, etc. It can also be a wired interface like eth0, eth1, eth2, ... The new naming scheme should make no difference, although I did not them.
  2. In the case of a WiFi, associate the interface with a hotspot as follows:
    Code: Select all
    iwconfig interface essid mywifihotspot
  3. If you want security start the required daemon. In our case, we will use wpa_supplicant. If one want something else one can attempt to use it, but again, I did not do any such tests apart from using wpa_supplicant.
    To use wpa_supplicant we need to create a .conf file which will hold the essid and password for our hotspot. The required contents as as follows:
    Code: Select all

    I will assume the .conf file above is save as wpa_supp1.conf. Start the wpa_supplicant daemon as follows:
    Code: Select all
    wpa_supplicant -i interface -B -c wpa_supp.conf
  4. Assign an IP address or use dhclient. In the case of wpa_supplicant I did not do any tests of assigning an IP directly without dhclient. Using dhclient worked as follows:
    Code: Select all
    dhclient interface
Debian == { > 30, 000 packages }; Debian != systemd
The worst infection of all, is a false sense of security!
It is hard to get away from CLI tools.
User avatar
Posts: 5404
Joined: 2007-07-18 06:19
Location: 35° 50 N, 14 º 35 E

Re: Low level connecting to WiFi or wired network.

Postby marcetm » 2017-01-28 11:16

To my bookmarks. Thanks for sharing.
Posts: 135
Joined: 2015-08-02 21:30

Re: Low level connecting to WiFi or wired network.

Postby Head_on_a_Stick » 2017-01-28 12:17

For `wpa_supplicant`, I use this command (as root!) to create a configuration file:
Code: Select all
# wpa_passphrase $SSID $PASSWORD >> /etc/wpa_supplicant/wpa_supplicant.conf

This will generate an obfuscated psk section for better security, the un-obfuscated line will be commented out and can even be removed from the file.

The command can be repeated to add new access points, signal strength will determine the order of connection if several APs are available.

Example output:
Code: Select all
Puffy: ~ $ wpa_passphrase examplessid examplepassword

So the commented-out psk line could be removed completely and leave no trace on your system of the actual password :)
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Posts: 13269
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Low level connecting to WiFi or wired network.

Postby Bulkley » 2017-01-28 16:55

Ed, this is an important topic. We have seen so many posters struggle with Network-Manager or Wicd on a desktop that doesn't move, thus uses one connection only. A few lines of script can fix such a connection permanently. Even portable machines do not need Network-Manager or Wicd. The real difficulty for so many is not understanding those simple scripts that actually make the connections and fall back on GUI's thinking they have to.
Posts: 6064
Joined: 2006-02-11 18:35

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 7 guests