Le 19/08/2015 01:37, Isaac Dunham a écrit :
On Tue, Aug 18, 2015 at 02:19:20PM +0200, Didier Kryn wrote:
Le 18/08/2015 12:49, Edward Bartolo a écrit :
At the moment I am stuck trying to use sudo to run ifup from within my
frontend.
     Just in case, here are a few things I know about wpa_supplicant:

      wpa_supplicant does ifups automatically when it connects to a wifi
station. If an interface name is not specified in wpa_supplicant.conf, in
the proper section of this station, it ifups the interface named "default".

     Therefore you shouldn't ifup yourself. You only need to fill the
configuration files, wpa_supplicant.conf, via the control socket and
interfaces by some method probably involving sudo.
I've not been able to figure out what that would look like.
Could you give a sample wpa_supplicant.conf and /etc/network/interfaces?

Assume the following configuration:
network 1: (WPA)
        SSID = "home"
        pass = "topsecret"
        ip = 192.168.1.100
        router = 192.168.1.0
        nameserver = 8.8.8.8

network 2: (open, DHCP)
        SSID = "public"

This is what I know would go in wpa_supplicant.conf:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=net
network={
        ssid="home"
        #psk="topsecret"
        psk=c406ef685867ff2dca906a4992ab997d6ebd5c747451113c0c0ead704d859010
}
network={
        ssid="public"
        key_mgmt=NONE
}

    You add the following line to your home config in wpa_supplicant.conf:
    id_str="foo"

    and you put the following in interfaces:
----------------------------------
allow-hotplug wlan0
iface wlan0 inet manual
        wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface foo inet static
       address      192.168.1.100
       netmask      255.255.255.0
       network      192.168.1.0
       broadcast    192.168.1.255
       gateway      192.168.1.0

iface default inet dhcp
-----------------------------------

With id_str, you can assign an interface name to every wifi station in wpa_supplicant.conf and declare in interfaces how you want it configured. id_str defaults to "default"

Attached are my two files. I have masked the passwords in wpa_supplicant.conf.I tried to use a static address with the wifi in a hotel where dhcp wasn't working; I don't use
it anymore but there is the relic in wpa_supplicant.conf.

For the file interfaces,I don't know how the instruction wpa-roam is executed, since there isno file with this name in the system. I can only guess it is interpreted by ifup/ifdown.Note the last line; it tells ifup that the default interface name used
by wpa_supplicant must be configured by dhcp.

The only 3 package I have installed to manage the network are ifplugd, wpa_supplicant and wpagui. I use the last only to enable a new wifi station or to disconnect/reconnect when there is a problem. The rest of the time, wpa_supplicant does everything automagically.


    For the whole explanation, have a look at this howto:

http://www.debuntu.org/how-to-wifi-roaming-with-wpa-supplicant/

    Didier



# 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

allow-hotplug eth0
iface eth0 inet dhcp

## Static configuration at APC
#iface eth0 inet static
#       address      134.158.186.218
#       netmask      255.255.252.0
#       network      134.158.184.0
#       broadcast    134.158.187.255
#       gateway      134.158.184.1

## Static configuration for local network
#iface eth0 inet static
#       address      192.168.1.1
#       netmask      255.255.254.0
#       network      192.168.0.0
#       broadcast    192.168.1.255
#       gateway      192.168.0.1

# Wifi interface:
allow-hotplug wlan0
iface wlan0 inet manual
        wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

# Default name given by wpa_supplicant for wlan0:
iface default inet dhcp
ctrl_interface=/var/run/wpa_supplicant
update_config=1

network={
        ssid="Livebox-7e88"
        key_mgmt=NONE
}

network={
        ssid="Livebox-7e88"
        psk="xxxxxxxxxxxxxxxxxxxxxxxxxx"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP WEP104 WEP40
}

network={
        ssid="LNCA"
        psk="xxxxxxxxxxxxx"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
}

network={
        ssid="INFN-dot1x"
        proto=RSN
        key_mgmt=WPA-EAP
        pairwise=CCMP
        auth_alg=OPEN
        eap=TTLS
        identity="............"
        password="xxxxxxxxx"
        phase2="auth=PAP"
}

network={
        ssid="daqborex"
        key_mgmt=NONE
}

network={
        ssid="Livebox-D775"
        psk="xxxxxxxxxxxxxxxxxxxxxxxxxx"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}

network={
        ssid="Livebox-D775"
        psk="xxxxxxxxxxxxxxxxxxxxxxxxxx"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP WEP104 WEP40
}

network={
        ssid="escalier1"
        key_mgmt=NONE
        wep_key0=xxxxxxxxxx
        priority=10
        id_str="crotte-de-bique"
}

network={
        ssid="Livebox-273e"
        psk="xxxxxxxxxxxx"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP WEP104 WEP40
}

network={
        ssid="CAES-AUSSOIS"
        psk="xxxxxxxxxxxxxxxxxxxxxxx"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP WEP104 WEP40
}

network={
        ssid="lingrie2"
        key_mgmt=NONE
        auth_alg=OPEN
        wep_key0=xxxxxxxxxx
}

network={
        ssid="Zhone_2621"
        psk="xxxxxxxxxxxxx"
        proto=WPA
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP WEP104 WEP40
        auth_alg=OPEN
}

network={
        ssid="gitejackis"
        psk="xxxxxxxxxxx"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP WEP104 WEP40
        auth_alg=OPEN
}

network={
        ssid="CAES-AUSSOIS"
        psk="centrepaullangevin73500"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP WEP104 WEP40
        auth_alg=OPEN
}

network={
        ssid="CAES-AUSSOIS"
        psk="xxxxxxxxxxxxxxxxxxxxxxx"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP WEP104 WEP40
        auth_alg=OPEN
}

network={
        ssid="ROOSEVELT"
        psk="HOTELROOSEVELT08600"
        psk="xxxxxxxxxxxxxxxxxxx"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}

network={
        ssid="Wifi_Vauban"
        psk="xxxxxxxxxxxxxxx"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP WEP104 WEP40
        auth_alg=OPEN
}

network={
        ssid="Livebox-3f7c"
        psk="xxxxxxxxxxxxxxxxxxxxxxxxxx"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP WEP104 WEP40
        auth_alg=OPEN
}

network={
        ssid="vieuxmorvan2"
        key_mgmt=NONE
        auth_alg=OPEN
}

network={
        ssid="premiere classe chambres"
        key_mgmt=NONE
        auth_alg=OPEN
}

network={
        ssid="Villetta"
        key_mgmt=NONE
        auth_alg=OPEN
}

network={
        ssid="Fiordigigli"
        psk="xxxxxxxxx"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP WEP104 WEP40
        auth_alg=OPEN
}

network={
        ssid="apcmcdf"
        psk="xxxxxxxxxxxx"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}

network={
        ssid="raminagrobis"
        key_mgmt=NONE
        auth_alg=SHARED
        wep_key0=xxxxxxxxxx
}

network={
        ssid="IReS-Conference"
        key_mgmt=NONE
        auth_alg=OPEN
}

network={
        ssid="Freebox-5D0FCE"
        psk="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        proto=WPA
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}

network={
        ssid="TERRAQUE"
        key_mgmt=NONE
        auth_alg=OPEN
}
_______________________________________________
Dng mailing list
[email protected]
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to