saeb
Posts: 3
Joined: Sun Sep 04, 2016 5:36 am
Location: iran
Contact: Website Yahoo Messenger

[SOLVED]How I can set dnsmasq start after hostapd

Tue Jun 05, 2018 8:59 am

hi there, I made a tor router but dnsmasq doesnt work

Code: Select all

Jun  5 11:38:04 saeb-pi systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Jun  5 11:38:08 saeb-pi dnsmasq[515]: dnsmasq: syntax check OK.
Jun  5 11:38:09 saeb-pi dnsmasq[530]: dnsmasq: failed to create listening socket for 172.24.1.1: Cannot assign requested address
Jun  5 11:38:09 saeb-pi dnsmasq[530]: failed to create listening socket for 172.24.1.1: Cannot assign requested address
Jun  5 11:38:09 saeb-pi systemd[1]: dnsmasq.service: Control process exited, code=exited status=2
Jun  5 11:38:09 saeb-pi dnsmasq[530]: FAILED to start up
Jun  5 11:38:09 saeb-pi systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Jun  5 11:38:09 saeb-pi systemd[1]: dnsmasq.service: Unit entered failed state.
Jun  5 11:38:09 saeb-pi systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
Jun  5 11:40:20 saeb-pi systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Jun  5 11:40:20 saeb-pi dnsmasq[537]: dnsmasq: syntax check OK.
Jun  5 11:40:20 saeb-pi dnsmasq[540]: dnsmasq: failed to create listening socket for 172.24.1.1: Cannot assign requested address
Jun  5 11:40:20 saeb-pi dnsmasq[540]: failed to create listening socket for 172.24.1.1: Cannot assign requested address
Jun  5 11:40:20 saeb-pi dnsmasq[540]: FAILED to start up
Jun  5 11:40:20 saeb-pi systemd[1]: dnsmasq.service: Control process exited, code=exited status=2
Jun  5 11:40:20 saeb-pi systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Jun  5 11:40:20 saeb-pi systemd[1]: dnsmasq.service: Unit entered failed state.
Jun  5 11:40:20 saeb-pi systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
and I have to run that manually

Code: Select all

sudo service dnsmasq restart
My Os is:

Code: Select all

cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
My hostapd config :

Code: Select all

cat /etc/hostapd/hostapd.conf 
interface=wlan0
# Use the nl80211 driver with the brcmfmac driver
driver=nl80211
# This is the name of the network
ssid=Tor
# Use the 2.4GHz band
hw_mode=g
# Use channel 6
channel=6
# Enable 802.11n
ieee80211n=1
# Enable WMM
wmm_enabled=1
# Enable 40MHz channels with 20ns guard interval
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
# Accept all MAC addresses
macaddr_acl=0
# Use WPA authentication
auth_algs=1
# Require clients to know the network name
ignore_broadcast_ssid=0
# Use WPA2
wpa=2
# Use a pre-shared key
wpa_key_mgmt=WPA-PSK
# The network passphrase
wpa_passphrase=1234567890-+
# Use AES, instead of TKIP
rsn_pairwise=CCMP
My dnsmasq config:

Code: Select all

cat /etc/dnsmasq.conf
interface=wlan0      # Use interface wlan0  
listen-address=172.24.1.1 # Explicitly specify the address to listen on  
bind-interfaces      # Bind to the interface to make sure we aren't sending things elsewhere  
no-resolv
port=53
server=127.0.10.1 # Forward DNS requests to Google DNS  
domain-needed        # Don't forward short names  
bogus-priv           # Never forward addresses in the non-routed address spaces.  
dhcp-range=172.24.1.50,172.24.1.150,12h # Assign IP addresses between 172.24.1.50 and 172.24.1.150 with a 12 hour lease time

My dhcpcd config:

Code: Select all

cat /etc/dhcpcd.conf 

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private
# Example static IP configuration:
interface wlan0
static ip_address=172.24.1.1/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=172.24.1.1
#static domain_name_servers=127.0.10.1 , 208.67.222.222


# Example static IP configuration:
interface eth0
static ip_address=192.168.1.13/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.1.1
#static domain_name_servers=192.168.1.1 

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
 # profile static_eth0
  # static ip_address=192.168.1.23/24
  # static routers=192.168.1.1
  # static domain_name_servers=192.168.1.1

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0

and my torrc :

Code: Select all

Log notice file /var/log/tor/notices.log
VirtualAddrNetwork 10.192.0.0/10
AutomapHostsSuffixes .onion,.exit
AutomapHostsOnResolve 1
TransPort 9040
TransListenAddress 172.24.1.1
DNSPort 127.0.10.1:53
#DNSListenAddress 127.0.10.1
Last edited by saeb on Tue Jun 05, 2018 10:42 am, edited 1 time in total.
kid:dad! how tv works?
dad:I dont know
kid:how mobiles work?
dad:i dont know
mum:kid let dad rest
dad:no let kid learn stuff

epoch1970
Posts: 5907
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: How I can set dnsmasq start after hostapd

Tue Jun 05, 2018 9:30 am

Remove bind-interfaces from dnsmasq.conf.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

saeb
Posts: 3
Joined: Sun Sep 04, 2016 5:36 am
Location: iran
Contact: Website Yahoo Messenger

Re: How I can set dnsmasq start after hostapd

Tue Jun 05, 2018 10:41 am

epoch1970 wrote:
Tue Jun 05, 2018 9:30 am
Remove bind-interfaces from dnsmasq.conf.
It works thanks
kid:dad! how tv works?
dad:I dont know
kid:how mobiles work?
dad:i dont know
mum:kid let dad rest
dad:no let kid learn stuff

Henrique Evangelista
Posts: 1
Joined: Wed Jul 29, 2020 2:17 pm

Re: [SOLVED]How I can set dnsmasq start after hostapd

Wed Jul 29, 2020 2:27 pm

I'll leave it for posterity ...
The dnsmasq server is presenting this error because you are using two flags in your configuration file that, in theory, serve to specify the same thing: "interface" and "listen-address".
This is causing an information conflict in the "bind-interfaces" command and that is why the link is not being communicated.

To resolve this, just specify the IP address in the "interface" flag or the "listen-address" flag.

Return to “General discussion”