Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Low level connecting to WiFi or wired network.

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
User avatar
edbarx
Posts: 5401
Joined: 2007-07-18 06:19
Location: 35° 50 N, 14 º 35 E
Been thanked: 2 times

Low level connecting to WiFi or wired network.

#1 Post by edbarx »

Warning:
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

    network={
                 ssid="mywifihotspot"
                 psk="myverylongpassword"
    }
    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.

marcetm
Posts: 135
Joined: 2015-08-02 21:30

Re: Low level connecting to WiFi or wired network.

#2 Post by marcetm »

To my bookmarks. Thanks for sharing.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Low level connecting to WiFi or wired network.

#3 Post by Head_on_a_Stick »

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 
network={
        ssid="examplessid"
        #psk="examplepassword"
        psk=34cc8324c2e6557492f12bb4e623f9c01a4e9f43e23e7c50535b9f9b20689106
}
So the commented-out psk line could be removed completely and leave no trace on your system of the actual password :)
deadbang

Bulkley
Posts: 6383
Joined: 2006-02-11 18:35
Has thanked: 2 times
Been thanked: 39 times

Re: Low level connecting to WiFi or wired network.

#4 Post by Bulkley »

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.

Post Reply