I want first to apologize for my bad English...
I'm encountering an error using hostapd and most precisely with dnsmasq: when I edit my /etc/dnsmasq.conf and I refresh it, I have an error message :
root@bob-E202SA:/home/bob/Scripts# sudo /etc/init.d/dnsmasq restart
[....] Restarting dnsmasq (via systemctl): dnsmasq.serviceJob for dnsmasq.service failed because the control process exited with error code. See "systemctl status dnsmasq.service" and "journalctl -xe" for details.
failed!
Ok, so I did :
root@bob-E202SA:/home/bob/Scripts# systemctl status dnsmasq.service
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
Drop-In: /run/systemd/generator/dnsmasq.service.d
└─50-dnsmasq-$named.conf, 50-insserv.conf-$named.conf
Active: failed (Result: exit-code) since mar. 2018-04-03 14:35:33 CEST; 5h 1min ago
Process: 3351 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=2)
Process: 3348 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
april 03 14:35:33 bob-E202SA systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
april 03 14:35:33 bob-E202SA dnsmasq[3348]: dnsmasq: verifying syntax OK.
april 03 14:35:33 bob-E202SA dnsmasq[3351]: dnsmasq: unknown interface wlx00c0ca964944
april 03 14:35:33 bob-E202SA systemd[1]: dnsmasq.service: Control process exited, code=exited status=2
april 03 14:35:33 bob-E202SA systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
april 03 14:35:33 bob-E202SA systemd[1]: dnsmasq.service: Unit entered failed state.
april 03 14:35:33 bob-E202SA systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
Hostapd works, I can see and connect my smartphone to Internet, but google pages don't load and it's written "This site is inaccessible" I think so the problem is dnsmasq, and that it's due to these error messages... Thanks for your help !!
EDIT : This is the output of 'ifconfig -a'
root@bob-E202SA:/home/bob# ifconfig -a
lo Link encap:Boucle locale
inet adr:127.0.0.1 Masque:255.0.0.0
adr inet6: ::1/128 Scope:Hôte
UP LOOPBACK RUNNING MTU:65536 Metric:1
Packets reçus:7308 erreurs:0 :0 overruns:0 frame:0
TX packets:7308 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
Octets reçus:563568 (563.5 KB) Octets transmis:563568 (563.5 KB)
wlp1s0 Link encap:Ethernet HWaddr 30:5a:3a:89:2d:ee
UP BROADCAST MULTICAST MTU:1500 Metric:1
Packets reçus:10 erreurs:0 :0 overruns:0 frame:0
TX packets:22 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
Octets reçus:1433 (1.4 KB) Octets transmis:3929 (3.9 KB)
wlx00c0ca964944 Link encap:Ethernet HWaddr 00:c0:ca:96:49:44
UP BROADCAST MULTICAST MTU:1500 Metric:1
Packets reçus:0 erreurs:0 :16 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 lg file transmission:1000
Octets reçus:834 (834.0 B) Octets transmis:8040 (8.0 KB)
And this is my /etc/network/interface
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
allow-hotplug wlp1s0
auto wlp1s0
iface wlp1s0 inet dhcp
allow-hotplug wlx00c0ca964944
iface wlx00c0ca964944 inet static
address 10.0.0.1
netmask 255.255.255.0
network 10.0.0.0
broadcast 10.0.0.255
And my hostapd script
#!/bin/sh
iInf="wlp1s0" #Interface with Internet Connectivity (ex: eth0)
wInf="wlx00c0ca964944" #Wireless interface (ex: wlan2)
sudo rm /var/run/hostapd/wlx00c0ca964944
sudo service dnsmasq stop
echo "Stopping port 5353 ..."
sudo kill -9 $( lsof -i:5353 -t )
echo "Bringing down wireless interface ..."
sudo ifconfig $wInf down
echo "Starting hostapd ..."
sudo hostapd -dd -B /etc/hostapd/hostapd.conf
echo "Configuring wireless interface ..."
sudo ifconfig $wInf 10.0.0.1 netmask 255.255.255.0
echo "Starting dnsmasq as DHCP server ..."
sudo dnsmasq
echo "Stopping firewall and allowing everyone ..."
sudo iptables -F
sudo iptables -X
sudo iptables -t nat -F
sudo iptables -t nat -X
sudo iptables -t mangle -F
sudo iptables -t mangle -X
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
echo "Enabling NAT ..."
sudo iptables -t nat -A POSTROUTING -o $iInf -j MASQUERADE
echo "Enabling IP forwarding ..."
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "Wireless gateway setup is complete"
... And my /etc/dnsmasq.conf
port=5353
no-resolv
server=8.8.8.8
server=8.8.4.4
interface=wlx00c0ca964944
dhcp-range=10.0.0.3,10.0.0.20,12h
0 Answers