dnsmasq のインストール

SheevaPlug

ダイアルアップルータにすると、 LAN 内に DNS や DHCP のサービスをしなければならない。
まさにそのためのパッケージ、dnsmasq をインストールする。

dnsmasq のインストール

root@debian:~# apt-get install dnsmasq
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  consolekit dbus dbus-x11 dnsmasq-base libck-connector0 libdbus-1-3
  libdbus-glib-1-2 libglib2.0-0 libglib2.0-data libpam-ck-connector libpolkit2
  libxml2 sgml-base shared-mime-info xml-core
Suggested packages:
  resolvconf sgml-base-doc debhelper
The following NEW packages will be installed:
  consolekit dbus dbus-x11 dnsmasq dnsmasq-base libck-connector0 libdbus-1-3
  libdbus-glib-1-2 libglib2.0-0 libglib2.0-data libpam-ck-connector libpolkit2
  libxml2 sgml-base shared-mime-info xml-core
0 upgraded, 16 newly installed, 0 to remove and 7 not upgraded.
Need to get 2810kB of archives.
After this operation, 13.8MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ports.ubuntu.com jaunty/main libxml2 2.6.32.dfsg-5ubuntu4 [793kB]
Get:2 http://ports.ubuntu.com jaunty/main sgml-base 1.26 [11.7kB]
Get:3 http://ports.ubuntu.com jaunty/main xml-core 0.12 [23.2kB]
Get:4 http://ports.ubuntu.com jaunty/main libdbus-1-3 1.2.12-0ubuntu2 [122kB]
Get:5 http://ports.ubuntu.com jaunty/main libck-connector0 0.3.0-2ubuntu3 [47.9kB]
Get:6 http://ports.ubuntu.com jaunty/main libglib2.0-0 2.20.1-0ubuntu2 [777kB]
Get:7 http://ports.ubuntu.com jaunty/main libdbus-glib-1-2 0.80-3 [68.0kB]
Get:8 http://ports.ubuntu.com jaunty/main libpolkit2 0.9-2ubuntu1 [49.9kB]
Get:9 http://ports.ubuntu.com jaunty/main dbus 1.2.12-0ubuntu2 [186kB]
Get:10 http://ports.ubuntu.com jaunty/main consolekit 0.3.0-2ubuntu3 [88.6kB]
Get:11 http://ports.ubuntu.com jaunty/main dbus-x11 1.2.12-0ubuntu2 [40.2kB]
Get:12 http://ports.ubuntu.com jaunty/main dnsmasq-base 2.47-3 [221kB]
Get:13 http://ports.ubuntu.com jaunty/universe dnsmasq 2.47-3 [13.0kB]
Get:14 http://ports.ubuntu.com jaunty/main libglib2.0-data 2.20.1-0ubuntu2 [988B]
Get:15 http://ports.ubuntu.com jaunty/main libpam-ck-connector 0.3.0-2ubuntu3 [7916B]
Get:16 http://ports.ubuntu.com jaunty/main shared-mime-info 0.60-1 [359kB]
Fetched 2810kB in 1min 21s (34.6kB/s)
Selecting previously deselected package libxml2.
(Reading database ... 15494 files and directories currently installed.)
Unpacking libxml2 (from .../libxml2_2.6.32.dfsg-5ubuntu4_armel.deb) ...
Selecting previously deselected package sgml-base.
Unpacking sgml-base (from .../sgml-base_1.26_all.deb) ...
Selecting previously deselected package xml-core.
Unpacking xml-core (from .../archives/xml-core_0.12_all.deb) ...
Selecting previously deselected package libdbus-1-3.
Unpacking libdbus-1-3 (from .../libdbus-1-3_1.2.12-0ubuntu2_armel.deb) ...
Selecting previously deselected package libck-connector0.
Unpacking libck-connector0 (from .../libck-connector0_0.3.0-2ubuntu3_armel.deb) ...
Selecting previously deselected package libglib2.0-0.
Unpacking libglib2.0-0 (from .../libglib2.0-0_2.20.1-0ubuntu2_armel.deb) ...
Selecting previously deselected package libdbus-glib-1-2.
Unpacking libdbus-glib-1-2 (from .../libdbus-glib-1-2_0.80-3_armel.deb) ...
Selecting previously deselected package libpolkit2.
Unpacking libpolkit2 (from .../libpolkit2_0.9-2ubuntu1_armel.deb) ...
Selecting previously deselected package dbus.
Unpacking dbus (from .../dbus_1.2.12-0ubuntu2_armel.deb) ...
Selecting previously deselected package consolekit.
Unpacking consolekit (from .../consolekit_0.3.0-2ubuntu3_armel.deb) ...
Selecting previously deselected package dbus-x11.
Unpacking dbus-x11 (from .../dbus-x11_1.2.12-0ubuntu2_armel.deb) ...
Selecting previously deselected package dnsmasq-base.
Unpacking dnsmasq-base (from .../dnsmasq-base_2.47-3_armel.deb) ...
Selecting previously deselected package dnsmasq.
Unpacking dnsmasq (from .../dnsmasq_2.47-3_all.deb) ...
Selecting previously deselected package libglib2.0-data.
Unpacking libglib2.0-data (from .../libglib2.0-data_2.20.1-0ubuntu2_all.deb) ...
Selecting previously deselected package libpam-ck-connector.
Unpacking libpam-ck-connector (from .../libpam-ck-connector_0.3.0-2ubuntu3_armel.deb) ...
Selecting previously deselected package shared-mime-info.
Unpacking shared-mime-info (from .../shared-mime-info_0.60-1_armel.deb) ...
Processing triggers for man-db ...
Setting up libxml2 (2.6.32.dfsg-5ubuntu4) ...

Setting up sgml-base (1.26) ...

Setting up xml-core (0.12) ...

Setting up libdbus-1-3 (1.2.12-0ubuntu2) ...

Setting up libck-connector0 (0.3.0-2ubuntu3) ...

Setting up libglib2.0-0 (2.20.1-0ubuntu2) ...

Setting up libdbus-glib-1-2 (0.80-3) ...

Setting up libpolkit2 (0.9-2ubuntu1) ...

Setting up dnsmasq-base (2.47-3) ...
Setting up dnsmasq (2.47-3) ...
 * Starting DNS forwarder and DHCP server dnsmasq                        [ OK ]

Setting up libglib2.0-data (2.20.1-0ubuntu2) ...
Setting up libpam-ck-connector (0.3.0-2ubuntu3) ...

Setting up shared-mime-info (0.60-1) ...

Setting up consolekit (0.3.0-2ubuntu3) ...
Setting up dbus (1.2.12-0ubuntu2) ...
Adding system user `messagebus' (UID 105) ...
Adding new group `messagebus' (GID 108) ...
Adding new user `messagebus' (UID 105) with group `messagebus' ...
Not creating home directory `/var/run/dbus'.
 * Starting system message bus dbus                                      [ OK ]

Setting up dbus-x11 (1.2.12-0ubuntu2) ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
root@debian:~#
何か、いろいろな物がアップデートされた。

dnsmasq のセットアップ

設定ファイルは、/etc/dnsmasq.conf だが、何を設定すれば良い物やら。
root@debian:~# cd /etc/
root@debian:/etc# mv dnsmasq.conf{,.orig}
root@debian:/etc# cp dnsmasq.conf{.orig,}
root@debian:/etc# vi dnsmasq.conf
	:
	:
root@debian:/etc# diff -c dnsmasq.conf.orig dnsmasq.conf
*** dnsmasq.conf.orig   Sat Feb 14 10:03:29 2009
--- dnsmasq.conf        Wed Feb 24 23:14:07 2010
***************
*** 83,88 ****
--- 83,89 ----
  # interface (eg eth0) here.
  # Repeat the line for more than one interface.
  #interface=
+ interface=eth0
  # Or you can specify which interface _not_ to listen on
  #except-interface=
  # Or which to listen on by address (remember to include 127.0.0.1 if
***************
*** 133,145 ****
  # a lease time. If you have more than one network, you will need to
  # repeat this for each network on which you want to supply DHCP
  # service.
! #dhcp-range=192.168.0.50,192.168.0.150,12h

  # This is an example of a DHCP range where the netmask is given. This
  # is needed for networks we reach the dnsmasq DHCP server via a relay
  # agent. If you don't know what a DHCP relay agent is, you probably
  # don't need to worry about this.
  #dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h

  # This is an example of a DHCP range with a network-id, so that
  # some DHCP options may be set only for this network.
--- 134,147 ----
  # a lease time. If you have more than one network, you will need to
  # repeat this for each network on which you want to supply DHCP
  # service.
! dhcp-range=192.168.0.50,192.168.0.150,12h

  # This is an example of a DHCP range where the netmask is given. This
  # is needed for networks we reach the dnsmasq DHCP server via a relay
  # agent. If you don't know what a DHCP relay agent is, you probably
  # don't need to worry about this.
  #dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h
+ dhcp-range=192.168.2.200,192.168.2.250,255.255.255.0,12h

  # This is an example of a DHCP range with a network-id, so that
  # some DHCP options may be set only for this network.
root@debian:/etc#

dnsmasq の再起動

設定を反映する
root@debian:/etc# /etc/init.d/dnsmasq restart
 * Restarting DNS forwarder and DHCP server dnsmasq                      [ OK ]
root@debian:/etc#

ローカルなネットワークの構築

確認のためには、ローカルなネットワーク、 DHCP のクライアント等が必要。

SheevaPlug を家庭内ネットワークから抜き、
独立した HUB につなぐ。
同じ HUB に PC をつないで起動

確認

PC の IP アドレスが DHCP で割上げられていることを確認する。
C:\Documents and Settings\yasunari>ipconfig /all

Windows IP Configuration

        Host Name . . . . . . . . . . . . : MURAMASA
        Primary Dns Suffix  . . . . . . . :
        Node Type . . . . . . . . . . . . : Unknown
        IP Routing Enabled. . . . . . . . : Yes
        WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter ワイヤレス ネットワーク接続:

        Media State . . . . . . . . . . . : Media disconnected
        Description . . . . . . . . . . . : LAN-Express IEEE 802.11 PCI Adapter
        Physical Address. . . . . . . . . : 00-02-8A-9A-DC-xx

Ethernet adapter ローカル エリア接続:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : Realtek RTL8139/810x Family Fast Eth
ernet NIC
        Physical Address. . . . . . . . . : 08-00-1F-B2-1D-xx
        Dhcp Enabled. . . . . . . . . . . : Yes
        Autoconfiguration Enabled . . . . : Yes
        IP Address. . . . . . . . . . . . : 192.168.2.209
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 192.168.2.85
        DHCP Server . . . . . . . . . . . : 192.168.2.85
        DNS Servers . . . . . . . . . . . : 192.168.2.85
        Lease Obtained. . . . . . . . . . : 2010年2月24日 23:27:40
        Lease Expires . . . . . . . . . . : 2010年2月25日 11:27:40

C:\Documents and Settings\yasunari>
いけてそう


←(前のページ)
samba が動いている
当月のハックの記録
SheevaPlug/玄柴(KURO-SHEEVA)をハックしよう トップ
(次のページ)→
オープンソースカンファレンス 2009 Kansai @ Kobe 展示環境

Copyright (C) 2003-2010 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市