/etc/init.d/networking restart wpa_supplicantを以前の構成で実行する方法は?

/etc/init.d/networking restart wpa_supplicantを以前の構成で実行する方法は?

背景:

私はDebian Lennyを使用しており、2つのWiFiインターフェースを持っています。一般的な設定を使用します。/etc/network/interfaces

iface wlan0 inet static
        address 10.0.0.1
        network 10.0.0.0
        netmask 255.255.255.0
        broadcast 10.0.0.255

auto wlan1
iface wlan1 inet static
        address 192.168.5.1
        network 192.168.5.1
        netmask 255.255.255.0
        broadcast 192.168.0.25

それで、そのような兆候はまったくありませんwpa_supplicant

/etc/wpa_supplicant.confwpa_supplicant(v2.0)を使用して(wlan0の場合)および(wlan1の場合)を介して手動で/etc/wpa_supplicant2.confWLANに接続します。

質問:

Wi-Fi インターフェイスは WLAN に接続されていますが、

ip link set wlan0 down
ip link set wlan1 up
rm /var/run/wpa_supplicant/wlan0
rm /var/run/wpa_supplicant/wlan1

だから私はそうしましたip link set wlan0 (and 1) up。この場合、iwconfig は Wi-Fi インターフェイスがどのネットワークにも接続されていないことを示しています。

その後私は走った/etc/init.d/networking restart。プロセスが完了すると、iwconfig は、Wi-Fi インターフェイスが以前に接続された WLAN に接続されたことを示します。

質問:

/etc/init.d/networking restart以前に使用したインターフェイスに対して.configファイルを使用してwpa_supplicantを実行するのはなぜですか(wlan0の場合はwpa_suppliant.conf、wlan1の場合はwpa_supplicant2.conf).このプロセスを何度も繰り返し、毎回Wi-Fiインターフェイスが.configファイルで定義されているのと同じネットワークに接続しました。

私がしたこと:

1)/etc/init.d/networkingスクリプトが何らかの方法でwpa_supplicantを使用しているようです。だから私は台本を読んだ。

     #!/bin/sh -e
    ### BEGIN INIT INFO
    # Provides:          networking
    # Required-Start:    mountkernfs ifupdown $local_fs
    # Required-Stop:     ifupdown $local_fs
    # Default-Start:     S
    # Default-Stop:      0 6
    # Short-Description: Raise network interfaces.
    ### END INIT INFO
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"

[ -x /sbin/ifup ] || exit 0

. /lib/lsb/init-functions

process_options() {
    [ -e /etc/network/options ] || return 0
    log_warning_msg "/etc/network/options still exists and it will be IGNORED! R
ead README.Debian of netbase."
}

check_network_file_systems() {
    [ -e /proc/mounts ] || return 0

    exec 9<&0 < /proc/mounts
    while read DEV MTPT FSTYPE REST; do
        case $DEV in
        /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
            log_warning_msg "not deconfiguring network interfaces: network devic
es still mounted."
            exit 0
            ;;
        esac
        case $FSTYPE in
        nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse
.curlftpfs)
            log_warning_msg "not deconfiguring network interfaces: network file 
systems still mounted."
            exit 0
            ;;
        esac
    done
    exec 0<&9 9<&-
}

case "$1" in
start)

        process_options

        log_action_begin_msg "Configuring network interfaces"
        if ifup -a; then
            log_action_end_msg $?
        else
            log_action_end_msg $?
        fi
        ;;

stop)
        check_network_file_systems

        log_action_begin_msg "Deconfiguring network interfaces"
        if ifdown -a --exclude=lo; then
            log_action_end_msg $?
        else
            log_action_end_msg $?
        fi
        ;;

force-reload|restart)
        process_options

        log_action_begin_msg "Reconfiguring network interfaces"
        ifdown -a --exclude=lo || true
        if ifup -a --exclude=lo; then
            log_action_end_msg $?
        else
            log_action_end_msg $?
        fi
        ;;

*)
        echo "Usage: /etc/init.d/networking {start|stop|restart|force-reload}"
        exit 1
        ;;
esac

exit 0

ifupdownifdownを実行する前にwpa_supplicantを終了するスクリプト(スクリプトの説明に従って)。私はシェルやbashプログラミングを知りませんが、私が理解しているように、再起動するとインターフェイスでifdownとifupの操作のみが行われます。

2)ifupを読むマニュアルページこれは次のように言います。

ifupおよびifdownコマンドを使用すると、/ etc / network / interfacesファイルのインターフェース定義に基づいてネットワークインターフェースを構成(またはそれぞれ構成解除)できます。

これには/etc/network/interfaceswpa_supplicant の構成は含まれていません。

ベストアンサー1

おすすめ記事