LoginSignup
1
1

More than 5 years have passed since last update.

Open vSwitchとHostapdの連携

Posted at

OVSをBridgeにしてHostapdを使うという話です.
apt-getで入るHostapdはpatchが当たってないのでOVSに接続ができません.
そこでpatchが当たっているHostapdを入れてやります.

目標

image

環境

以下の環境で試しました.

  • PC: NUC5i5RYK
  • OS: Ubuntu Server 14.04.3 LTS

Open vSwitchのインストール

$ git clone https://github.com/openvswitch/ovs.git
$ cd ovs
$ apt-get install build-essential fakeroot 
$ dpkg-checkbuilddeps
$ sudo apt-get install (dpkg-checkbuilddepsで表示されたパッケージ)
$ fakeroot debian/rules binary 
$ cd ..
$ dpkg -i openvswitch-common_amd64.deb openvswitch-switch_amd64.deb
$ sudo ovs-vsctl show
aaaaa-aaaaa-aaaaa-aaaaaaaa
    ovs_version: "2.5.90"

Hostapdのインストール

$ git clone https://github.com/hschaa/hostapd.git
$ cp defconfig .config
$ vi .config //環境に合わせて弄る
$ make

Hostapdの設定

とりあえずArch Linux Wikiの通りにしました.

/etc/hostapd/hostapd.conf
ssid=YourWiFiName
wpa_passphrase=Somepassphrase
interface=wlan0_ap
bridge=br0
auth_algs=3
channel=7
driver=nl80211
hw_mode=g
logger_stdout=-1
logger_stdout_level=2
max_num_sta=5
rsn_pairwise=CCMP
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP

起動

# ovs-vsctl add-br br0
# ovs-vsctl add-port br0 eth0
# ovs-vsctl set bridge br0 protocols=OpenFlow13
# ovs-vstl set-contoller br0 (ControllerのIPアドレス)
# ifconfig eth0 0
# ifconfig br0 (BridgeのIPアドレス)
# route add default gw (ゲートウェイのIPアドレス) br0
# ./hostapd hostapd.conf

疎通確認

今回はControllerとしてRyuを使いたいと思います.
サンプルのスイッチングハブを実行します.

$ ryu-manager simple_switch_13.py

DHCPの設定をやってないのでHostにIPアドレスを振ったあとPingを実行してみましょう.
Pingできてたら成功です.
ありがとうございました.

1
1
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
1
1