DNSMASQを機能させるにはどうすればよいですか?

DNSMASQを機能させるにはどうすればよいですか?

私はElementary OS Freya(Ubuntu 14.04)を使用しています。 DNSMASQをインストールしてコマンドを実行しましたが、次のエラーが発生しました。

$ sudo service dnsmasq start
 * Starting DNS forwarder and DHCP server dnsmasq
dnsmasq: bad command line options: try --help     [fail]

/var/log/syslog以下を見つけました。

Dec 22 10:34:10 Marcelo-PC dnsmasq[3176]: bad command line options: try --help
Dec 22 10:34:10 Marcelo-PC dnsmasq[3176]: FAILED to start up

実行すると、sh -x /etc/init.d/dnsmasq次のような結果が得られます。

marcelo@Marcelo-PC:~$ sh -x /etc/init.d/dnsmasq start
+ set +e
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+ DAEMON=/usr/sbin/dnsmasq
+ NAME=dnsmasq
+ DESC=DNS forwarder and DHCP server
+ ENABLED=1
+ [ -r /etc/default/dnsmasq ]
+ . /etc/default/dnsmasq
+ ENABLED=1
+ CONFIG_DIR=/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new
+ [ -r /etc/default/locale ]
+ . /etc/default/locale
+ LANG=en_US.UTF-8
+ export LANG
+ test -x /usr/sbin/dnsmasq
+ [ -f /lib/lsb/init-functions ]
+ . /lib/lsb/init-functions
+ run-parts --lsbsysinit --list /lib/lsb/init-functions.d
+ [ -r /lib/lsb/init-functions.d/01-upstart-lsb ]
+ . /lib/lsb/init-functions.d/01-upstart-lsb
+ unset UPSTART_SESSION
+ _RC_SCRIPT=/etc/init.d/dnsmasq
+ [ -r /etc/init//etc/init.d/dnsmasq.conf ]
+ _UPSTART_JOB=dnsmasq
+ [ -r /etc/init/dnsmasq.conf ]
+ [ -r /lib/lsb/init-functions.d/20-left-info-blocks ]
+ . /lib/lsb/init-functions.d/20-left-info-blocks
+ [ -r /lib/lsb/init-functions.d/50-ubuntu-logging ]
+ . /lib/lsb/init-functions.d/50-ubuntu-logging
+ LOG_DAEMON_MSG=
+ FANCYTTY=
+ [ -e /etc/lsb-base-logging.sh ]
+ true
+ [ !  ]
+ [  != yes ]
+ [ -x /sbin/resolvconf ]
+ RESOLV_CONF=/var/run/dnsmasq/resolv.conf
+ [ !  ]
+ DNSMASQ_USER=dnsmasq
+ test 1 != 0
+ log_daemon_msg Starting DNS forwarder and DHCP server dnsmasq
+ [ -z Starting DNS forwarder and DHCP server ]
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ [ xxterm != x ]
+ [ xxterm != xdumb ]
+ [ -x /usr/bin/tput ]
+ [ -x /usr/bin/expr ]
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ [ -z ]
+ FANCYTTY=1
+ true
+ /usr/bin/tput xenl
+ /usr/bin/tput cols
+ COLS=169
+ [ 169 ]
+ [ 169 -gt 6 ]
+ /usr/bin/expr 169 - 7
+ COL=162
+ log_use_plymouth
+ [ n = y ]
+ plymouth --ping
+ printf  * Starting DNS forwarder and DHCP server dnsmasq      
 * Starting DNS forwarder and DHCP server dnsmasq       + /usr/bin/expr 169 - 1
+ /usr/bin/tput hpa 168
                                                                                                                                                                        + printf  
 + start
+ [ ! -d /var/run/dnsmasq ]
+ start-stop-daemon --start --quiet --pidfile /var/run/dnsmasq/dnsmasq.pid --exec /usr/sbin/dnsmasq --test
+ start-stop-daemon --start --quiet --pidfile /var/run/dnsmasq/dnsmasq.pid --exec /usr/sbin/dnsmasq -- -x /var/run/dnsmasq/dnsmasq.pid -u dnsmasq -r /var/run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new

dnsmasq: opções inválidas de linha de comando: tente --help
+ return 2
+ log_end_msg 1
+ [ -z 1 ]
+ [ 162 ]
+ [ -x /usr/bin/tput ]
+ log_use_plymouth
+ [ n = y ]
+ plymouth --ping
+ printf \r
+ /usr/bin/tput hpa 162
                                                                                                                                                                  + [ 1 -eq 0 ]
+ printf [
[+ /usr/bin/tput setaf 1
+ printf fail
fail+ /usr/bin/tput op
+ echo ]
]
+ return 1
+ exit 1

DNSMASQを操作できません。私のファイルでコメントされていない唯一の行はdnsmasq.conf(完全なファイルを見ることができます)ここ):

address=/nintendowifi.net/192.168.0.8

問題をどのように見ることができますか?

ベストアンサー1

このエラーはパッケージに問題がありますdns-root-data。 DNSmasqには必要ありませんが、必要です。この順序で:

sudo apt-get purge dnsmasq
sudo apt-get autoremove
sudo apt-get install dnsmasq

設定(ある場合)を再接続することを忘れないでください。/etc/dnsmasq.conf

引用する


それがうまくいかない場合、これを試してみてください(少なくともDebian 9とRaspianの場合)

sudo nano /etc/init.d/dnsmasq

どこで読むか

if [ -f $ROOT_DS ]; then

次の行をコメントアウトし(行の先頭に#を追加)、この行をその下に配置します。

`DNSMASQ_OPTS="$DNSMASQ_OPTS `mawk -- '{ printf " --trust-anchor=.,%d,%d,%d,%s", $5, $6, $7, $8 }' $ROOT_DS`"`

構造が/usr/share/dns/root.ds変更されました。以前はフィールドはスペースで区切られていましたが、今はタブ(\ t)で区切られていました。

引用する

おすすめ記事