
배경:
저는 Debian Lenny를 사용하고 있으며 두 개의 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.conf
wpa_supplicant(v2.0)를 수동으로 사용하여 (wlan0의 경우) 및 /etc/wpa_supplicant2.conf
(wlan1의 경우)을 통해 WLAN에 연결합니다 .
문제:
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 파일(wlan0의 경우 wpa_suppliant.conf, wlan1의 경우 wpa_supplicant2.conf)을 사용하여 wpa_supplicant가 실행되는 이유는 무엇입니까 ? 나는 이 절차를 여러 번 반복했고 매번 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
ifupdown
ifdown이 실행되기 전에 wpa_supplicant를 종료하는 스크립트입니다(해당 스크립트에서 설명하는 대로). 나는 쉘이나 bash 프로그래밍을 모르지만 이해했듯이 다시 시작하면 인터페이스의 ifdown 및 ifup만 수행됩니다.
2)ifup을 읽어보세요.매뉴얼 페이지이는 다음과 같이 말합니다.
ifup 및 ifdown 명령은 /etc/network/interfaces 파일의 인터페이스 정의를 기반으로 네트워크 인터페이스를 구성(또는 각각 구성 해제)하는 데 사용할 수 있습니다.
my /etc/network/interfaces
에는 wpa_supplicant에 대한 구성이 포함되어 있지 않습니다.