ubuntu11.10 hostapdのインストール
1、apt-get install hostapdからインストールすると、hostapdで次のエラーが表示されます.
root@skyi:/media/Loondisk/hostapd/hostapd-git/hostap/hostapd# hostapd -d/etc/hostapd/hostapd.conf Configuration file:/etc/hostapd/hostapd.conf nl80211: Register Action command failed: ret=-19 (No such device) nl80211: Register Action match - hexdump(len=1): 06 nl80211: Failed to register Action frame processing - ignore for now nl80211: Add own interface ifindex 0 Could not read interface wlan0 flags: No such device nl80211 driver initialization failed. ELOOP: remaining socket: sock=4 eloop_data=0x933ca68 user_data=0x933d008 handler=0x807c670 ELOOP: remaining socket: sock=6 eloop_data=0x933e828 user_data=(nil) handler=0x8086770 root@skyi:/media/Loondisk/hostapd/hostapd-git/hostap/hostapd#
nl 80211のドライバをサポートしていないため、hostapdの公式サイトからソースパッケージをダウンロードしてインストールします.
2、公式サイトからダウンロードしたhostapd-1.0バージョンのコンパイル中にエラーが発生し、git cloneからgit://w1.fi/srv/git/hostap.gitここでダウンロードしてコンパイルしてもエラーはありません.
(../src/drivers/driver_nl80211.c:95:9: error: too few arguments to function ‘genl_ctrl_alloc_cache’)
コンパイル前にhostapdディレクトリの下でcp defconfigを実行する.コンフィギュレーションファイルでは、nl 80211のドライバのみがデフォルトでサポートされています(CONFIG_DRIVER_NL 80211=y).
make
make install
3、新規/etc/hostapd/hostapd.conf
interface=wlan0 #interface=wlan0 driver=nl80211 #driver=madwifi ssid=YOUR_SSID channel=9 hw_mode=g macaddr_acl=0 ignore_broadcast_ssid=0 auth_algs=1 wpa=3 wpa_passphrase=YOUR_PASSPHRASE wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
最後に実行:hostapd-d/etc/hostapd/hostapd.conf
4、dhcpdを取り付ける
apt-get install dhcp3-server
今ではワイヤレスカードをapと見なすことができます.
5、ワイヤレスカードのapを引き続き外部ネットワークに接続する
ネット上には多くの資料があり、一般的には2つの方法があります.1つはbridge(ブリッジ)で、もう1つはnat方式で、ここではnat方式だけを紹介します.
前の4つのステップを経て、ワイヤレスカードはすでに自動的にIPを割り当てることができて、今ワイヤレスカードのデータをeth 0(有線ネットワーク)を通じて外網に送るだけで、これはIP転送が必要です.
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
6、組み込み型開発ボードにカーネルを設置してiptabelをサポートする設定は以下の通りである.
カーネルにはiptablesのサポートとnat機能が必要です
Networking support --->
Networking options --->
Network packet filtering framework (Netfilter)
│ │ --- Network packet filtering framework (Netfilter) │ │
│ │ [*] Network packet filtering debugging │ │
│ │ [*] Advanced netfilter configuration │ │
│ │ Core Netfilter Configuration ---> │ │
│ │ < > IP virtual server support ---> │ │
│ │ IP: Netfilter Configuration --->
Core Netfilter Configurationの構成は次のとおりです.
Netfilter connection tracking support
-*- Netfilter Xtables support (required for ip_tables)
IP:Netfilter Configurationの構成は以下の通りです.
[*] proc/sysctl compatibility with old connection tracking
IP tables support (required for filtering/masq/NAT)
Packet filtering
REJECT target support
< > LOG target support
< > ULOG target support
Full NAT
MASQUERADE target support
NETMAP target support
REDIRECT target support
Basic SNMP-ALG support
root@skyi:/media/Loondisk/hostapd/hostapd-git/hostap/hostapd# hostapd -d/etc/hostapd/hostapd.conf Configuration file:/etc/hostapd/hostapd.conf nl80211: Register Action command failed: ret=-19 (No such device) nl80211: Register Action match - hexdump(len=1): 06 nl80211: Failed to register Action frame processing - ignore for now nl80211: Add own interface ifindex 0 Could not read interface wlan0 flags: No such device nl80211 driver initialization failed. ELOOP: remaining socket: sock=4 eloop_data=0x933ca68 user_data=0x933d008 handler=0x807c670 ELOOP: remaining socket: sock=6 eloop_data=0x933e828 user_data=(nil) handler=0x8086770 root@skyi:/media/Loondisk/hostapd/hostapd-git/hostap/hostapd#
nl 80211のドライバをサポートしていないため、hostapdの公式サイトからソースパッケージをダウンロードしてインストールします.
2、公式サイトからダウンロードしたhostapd-1.0バージョンのコンパイル中にエラーが発生し、git cloneからgit://w1.fi/srv/git/hostap.gitここでダウンロードしてコンパイルしてもエラーはありません.
(../src/drivers/driver_nl80211.c:95:9: error: too few arguments to function ‘genl_ctrl_alloc_cache’)
コンパイル前にhostapdディレクトリの下でcp defconfigを実行する.コンフィギュレーションファイルでは、nl 80211のドライバのみがデフォルトでサポートされています(CONFIG_DRIVER_NL 80211=y).
make
make install
3、新規/etc/hostapd/hostapd.conf
interface=wlan0 #interface=wlan0 driver=nl80211 #driver=madwifi ssid=YOUR_SSID channel=9 hw_mode=g macaddr_acl=0 ignore_broadcast_ssid=0 auth_algs=1 wpa=3 wpa_passphrase=YOUR_PASSPHRASE wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
最後に実行:hostapd-d/etc/hostapd/hostapd.conf
4、dhcpdを取り付ける
apt-get install dhcp3-server
echo "1" > /proc/sys/net/ipv4/ip_forward hostapd -B /etc/hostapd/hostapd.conf
/etc/dhcp/dhcpd.conf:
subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.2 192.168.0.10; option routers 192.168.0.1; }
wlan0配置地址: ifconfig wlan0 192.168.0.1 netmask 255.255.255.0 开启dhcp:dhcpd wlan0 -pf /var/run/dhcp-server/dhcpd.pid
今ではワイヤレスカードをapと見なすことができます.
5、ワイヤレスカードのapを引き続き外部ネットワークに接続する
ネット上には多くの資料があり、一般的には2つの方法があります.1つはbridge(ブリッジ)で、もう1つはnat方式で、ここではnat方式だけを紹介します.
前の4つのステップを経て、ワイヤレスカードはすでに自動的にIPを割り当てることができて、今ワイヤレスカードのデータをeth 0(有線ネットワーク)を通じて外網に送るだけで、これはIP転送が必要です.
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/etc/dhcp/dhcpd.conf,添加dns:
subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.2 192.168.0.10;
option domain-name-servers 221.5.88.88;
option routers 192.168.0.1;
}
6、組み込み型開発ボードにカーネルを設置してiptabelをサポートする設定は以下の通りである.
カーネルにはiptablesのサポートとnat機能が必要です
Networking support --->
Networking options --->
Network packet filtering framework (Netfilter)
│ │ --- Network packet filtering framework (Netfilter) │ │
│ │ [*] Network packet filtering debugging │ │
│ │ [*] Advanced netfilter configuration │ │
│ │ Core Netfilter Configuration ---> │ │
│ │ < > IP virtual server support ---> │ │
│ │ IP: Netfilter Configuration --->
Core Netfilter Configurationの構成は次のとおりです.
Netfilter connection tracking support
-*- Netfilter Xtables support (required for ip_tables)
IP:Netfilter Configurationの構成は以下の通りです.
[*] proc/sysctl compatibility with old connection tracking
IP tables support (required for filtering/masq/NAT)
Packet filtering
REJECT target support
< > LOG target support
< > ULOG target support
Full NAT
MASQUERADE target support
NETMAP target support
REDIRECT target support
Basic SNMP-ALG support