LoginSignup
4
4

More than 5 years have passed since last update.

BeagleBoard/Ubuntu によるアクセスポイントの構築

Posted at

だいたいは参考にしたサイトの内容ですが,Ubuntu 14.04で構築した際の内容に一部書き換えてあります.ほとんど設定ファイルの備忘録なので,詳しい説明はありません.

用意するもの

今から買う人はBeagleBone BlackかRaspberry Pi 2のほうが良いと思います.また,この説明ではルーター機能については説明しません.たとえばロボットに積んだLinuxボードに無線でアクセスしたい場合を想定しています.でも,DHCPを設定して,iptablesを適切に設定すればルーター化は簡単です.

インストールし,設定すべき項目

  • Ubuntu 14.04.2
  • hostapd (無線LAN親機になるため.参考サイトのように入れ替える必要はない)
  • iw (無線LANの設定を確認するため)
  • isc-dhcp-server (DHCPサーバーになるため)
  • supervisor (hostapdを立ち上げておくため)

設定ファイル

/etc/network/interfaces

hwaddressの部分は適切なMACアドレスに書き換えるか,ハードウエアがMACアドレスを持っている場合には削除してください.

# 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

# The primary network interface
auto eth0
iface eth0 inet dhcp
# Example to keep MAC address between reboots
hwaddress ether aa:bb:33:99:44:ff

# The secondary network interface
#auto eth1
#iface eth1 inet dhcp

# WiFi Example
#auto wlan0
#iface wlan0 inet dhcp
#    wpa-ssid "essid"
#    wpa-psk  "password"

# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
# Note on some boards, usb0 is automaticly setup with an init script
iface usb0 inet static
    address 192.168.7.2
    netmask 255.255.255.0
    network 192.168.7.0
    gateway 192.168.7.1

iface wlan0 inet static
    address 192.168.230.1
    netmask 255.255.255.0
    network 192.168.230.0

/etc/hostapd.conf

channelssidwpa_passphraseが書き換えポイントです.

interface=wlan0
driver=nl80211
hw_mode=g
channel=1
ssid=Beagle
auth_algs=1
wpa=2
ignore_broadcast_ssid=0
wpa_passphrase=PASSWORD
wpa_key_mgmt=WPA-PSK 
wpa_pairwise=CCMP TKIP
rsn_pairwise=CCMP
logger_syslog=-1
logger_syslog_level=2

/etc/supervisor/conf.d/supervisor-hostapd.conf

HostAPはサービスでなかったので,Supervisorを用いてサービス化します.

[program:hostapd]
command=/usr/sbin/hostapd /etc/hostapd.conf

/etc/default/isc-dhcp-server

DHCPサーバーが無線LANのみに働くように設定します.書き換えポイントは最後の行です.

# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts

#
# This is a POSIX shell fragment
#

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid

# Additional options to start dhcpd with.
#   Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#   Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="wlan0"

/etc/dhcp/dhcpd.conf

今回はDNSやDefault Gatewayを設定していません.

#
# Sample configuration file for ISC dhcpd for Debian
#
# Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as
# configuration file instead of this file.
#
#

# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none;

# option definitions common to all supported networks...
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;

default-lease-time 600;
max-lease-time 7200;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# No service will be given on this subnet, but declaring it helps the 
# DHCP server to understand the network topology.

subnet 192.168.230.0 netmask 255.255.255.0 {
    range 192.168.230.2 192.168.230.100;
}

コマンドによる仕上げ

以下のサービスを有効化します.スタートさせるだけでなく起動時に自動的に実行されるようにしておきます.

  • supervisor
  • isc-dhcp-server
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4