※本ブログは6月末で他サイトに移設する予定です。これまで閲覧ありがとうございました。
(モチベーション)
もとの設定は、rc.localから/root/init_setup.shを
呼んで一旦apモードにして、同じくrc.localの
次の行に/root/wlan.shを呼んでwlanモードにする
ようになっている。
設定がいろいろなところに飛んでいるのは分かりにくいと
感じたので、今回、/etc/network/interfacesに
集中させてみた。
(環境、ネットワーク構成)
カーネルの版数等は
・Linux guru 2.6.33.2-00003-g4b82fc0 #1 PREEMPT Thu Apr 22 03:29:35 PDT 2010 armv5tel GNU/Linux
・Debian Lenny
GuruPlugPlus周りのネットワーク構成は、
・BBルータのIPアドレス:192.168.1.1
・GuruPlugPlusのeth0経由でつながるsubnet:192.168.0.0/24
・GuruPlugPlusのeth1経由につながるsubnet:192.168.10.0/24
・GuruPlugPlusのwlan経由につながるsubnet:192.168.1.0/24。BBルータを介してWANへ
のようになっている
(手順等)
[/etc/network/interfaces]
------------------------------------------------------------
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
pre-up /usr/sbin/ethtool -s eth0 autoneg on speed 1000 duplex full
# pre-up /usr/sbin/ethtool -s eth0 autoneg on speed 100 duplex full
address 192.168.0.1
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
dns-nameservers 192.168.1.1
auto eth1
iface eth1 inet static
# pre-up /usr/sbin/ethtool -s eth0 autoneg on speed 1000 duplex full
pre-up /usr/sbin/ethtool -s eth0 autoneg on speed 100 duplex full
address 192.168.10.1
network 192.168.10.0
netmask 255.255.255.0
broadcast 192.168.10.255
dns-nameservers 192.168.1.1
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
pre-up /root/wlan.sh
pre-up /sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
address 192.168.1.17
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
wpa-driver wext
wpa-ssid your_ssid
wpa-psk xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
dns-nameservers 192.168.1.1
------------------------------------------------------------
[N.B.] MASQUERADE設定は不要かも知れない(BBルータの方でやっているから?)
と思っていろいろやってみたが、これがないとインタネットにpingが通らなくなった
[N.B.] wpaに関する設定はこれだけ。wpa_supplicantも陽には起動していない。
ifupdownが「wpa」のキーワードを認識してwpa_supplicantを適当な引数で
起動してくれるようだ
[/root/wlan.sh]
------------------------------------------------------------
#!/bin/sh
# The firmware files are -> sd8688.bin & sd8688_helper.bin
# The firmware files need to be present in /lib/firmware/
rmmod libertas_sdio libertas
cp /root/firmware/sd8688* /lib/firmware/
#/etc/init.d/udhcpd stop
#/etc/init.d/dnsmasq stop
echo 2 > /proc/uap/uap0/hwstatus
ifconfig uap0 down
rmmod uap8xxx
modprobe libertas_sdio
# This will be deleted on bootup.
# Bootup by-default is always AP mode.
touch /etc/wlanclient.mode
# Delete the firmware immediately so that next bootup is in AP mode.
rm -f /lib/firmware/sd8688*
# The newly created interface will be wlan(n)
# The following command lists all the available wireless networks
# iwlist
# To connect to a particular SSID
# iwconfig
#Set leds for client mode
echo 0 > `eval ls /sys/class/leds/guruplug\:green\:wmode/brightness`
echo 1 > `eval ls /sys/class/leds/guruplug\:red\:wmode/brightness`
------------------------------------------------------------
なんか不要な設定がいっぱいありそうだ。
[/etc/sysctl.conf]
------------------------------------------------------------
# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
net.ipv4.ip_forward=1
------------------------------------------------------------
init_setup.shはLEDの設定だけになっている
これで普通(WPA2で暗号化して)に無線LANモードが動くようになった。
(参考にしたリンク先)
WPAで無線LAN on Debian sid-unstable - Let’s start something new!
http://d.hatena.ne.jp/nshttsk/20071023/1193146188
お試しネットワーク環境を作る - いますぐ実践! Linuxシステム管理 - Vol.065
http://www.usupi.org/sysad/065.html
HP2133日記 wpa_supplicantの設定
http://admin.homev6.jp/HP2133/2008/09/wpa_supplicant.html
iptables tutorial 1.2.2 - ステート機構
http://www.asahi-net.or.jp/~aa4t-nngk/ipttut/output/statemachine.html
以上
0 件のコメント:
コメントを投稿