Can't start dnsmasq server if laptop's generating hotspot

0

I am using kde5-nm-connection-editor to generate hotspot from my laptop. Now I want to start a dnsmasq dns server. It seems that these 2 things can't run simultaneously.

  1. If I first create a hotspot and then start the dnsmasq dns server, it says:

    dnsmasq: failed to create listening socket for port 53: Address already in use
    
  2. If I try to kill the process using port 53 (which is probably network-manager), it kills it but the error persists. I think that network manager very quickly takes control of port 53 again!

If I first start the dns server, I am not able to start the hotspot. Please help!

vaibhavS

Posted 2017-08-05T13:42:55.463

Reputation: 3

Answers

0

This will be because the hotspot mode is using dnsmasq to provide the DHCP server for the WiFi clients when they connect.

If you want to use dnsmasq to provide DNS to the connecting clients then you may want to look at how it's been started by the hotspot mode and add in any extra config you need.

Else you may be able to run a second instance by making it only bind to the none WiFi interface

hardillb

Posted 2017-08-05T13:42:55.463

Reputation: 390

Thanks @hardillb I described what I did in the answer below. However, can you explain a bit more about this line: "Else you may be able to run a second instance by making it only bind to the none WiFi interface"? – vaibhavS – 2017-08-05T18:16:12.013

When you say 'bind to none WiFi interface', do you mean setting 'interface=lo' and 'bind-interface' in dnsmasq.conf. If you mean this, I tried it but it doesn't listen to public IPs. In this case my dns server will only be served to my machine but not on the hosts it is connected to. – vaibhavS – 2017-08-05T18:20:29.053

If one instance isn't told to limit which interfaces it will bind to all, this will stop any other instances only binding to specific interfaces. – hardillb – 2017-08-05T18:22:04.413

0

When a hotspot is created using kde5-nm-connection editor, it asks for the method in IPv4 tab:

Connection editor tab image When the method is set to 'Automatic' or 'Shared with other computers', the connection manager uses a dnsmasq to manage the connections. In this case when you try to run the dnsmasq, it is already being used and hence the port is not free.

To be able to run your dnsmasq server, you will have to set the connection mode to 'Disabled' or maybe 'Link-local' (whichever suits your need).

Once the connection is set, you will need to manually set your ip address using 'ifconfig '

vaibhavS

Posted 2017-08-05T13:42:55.463

Reputation: 3