Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Dowse Raspberry image) fix IP breaks functionality #42

Open
christiansievers opened this issue Sep 30, 2017 · 30 comments
Open

(Dowse Raspberry image) fix IP breaks functionality #42

christiansievers opened this issue Sep 30, 2017 · 30 comments

Comments

@christiansievers
Copy link

christiansievers commented Sep 30, 2017

Hi, the Raspberry image we got from you a couple of days ago works fine on my home network. I plug it in, the Dowse box gets an IP from the router, and then I turn off DHCP on the router. So far so good. I ask for a new DHCP lease on my laptop, and bingo, I'm in.

But when I edit /etc/network/interfaces on the Dowse box to give it a fix IP, that breaks things somehow. Dowse's DHCP doesn't work any more. I was stumped and even re-flashed the Raspberry to revert to the original image, but still the same problem.

I reverted things back to Dowse getting an IP from the router's DHCP, and now everything works again. So right now I can't restart the Dowse box, because that would leave it without an IP (it still uses the IP given to it by the router right now)...

For your reference, the home network is 192.168.178.0
The router is at 192.168.178.1
The dowse box gets this IP from the router: 192.168.178.20

This is the part in /etc/network/interfaces that breaks things, if I uncomment it (basically I was thinking to give it the same IP that it received from the router):
#auto eth0
#iface eth0 inet static
#address 192.168.178.20
#netmask 255.255.255.0

@parazyd
Copy link
Member

parazyd commented Sep 30, 2017 via email

@christiansievers
Copy link
Author

christiansievers commented Sep 30, 2017

Yes, I saw the two lines to uncomment, I had done that. And after DHCP didn't work I added exactly those lines you mention:
'gateway 192.168.178.1'
'network 192.168.178.0'
Didn't help...

@parazyd
Copy link
Member

parazyd commented Oct 1, 2017 via email

@christiansievers
Copy link
Author

christiansievers commented Oct 1, 2017

Hi,
right now it's
interfaces_dhcp.txt

What didn't work was this:

interfaces_fixed_ip.txt

Also what happens if you do /etc/init.d/networking restart on the Pi once it boots without an IP?

It's headless so if that happens I can only do a hard restart. I don't have a spare monitor at home, but I guess if it's important to try this I could use a serial cable to log in to the Pi.

By the way, not sure if this is related or not, there is another issue with the ON-button not working properly. I can click it and it reloads the page, but the button stays off, and that particular phone is left without connection. Is there a shell command I could try? Or any other idea? I also wouldn't mind turning on party mode, but my version of Dowse doesn't seem to give me that option, at least in the web interface.
UPDATE: I ssh'd into the Dowse console and ran dowse-stop and then dowse-start, and now I can turn things on and off again

@kneibdev
Copy link

kneibdev commented Oct 5, 2017

I have exactly the same problems. Tried for hours now but fixed IP doesn't seem to work. Also dhcp settings are ignored (see my other issue).

@jaromil
Copy link
Member

jaromil commented Oct 5, 2017

Hi everyone!
have you tried to edit /etc/dowse/settings (starting from the template in /etc/dowse/settings.dist)?

@kneibdev
Copy link

kneibdev commented Oct 5, 2017

Yes I did...
Status is now:
After booting the Dowse Pi it has no default gateway. I have it set in /etc/network/interfaces
After manually added it seems to work but Dowse is always dhcp-ing the range: 101 till 149, whatever I set in /etc/dowse/settings

@jaromil
Copy link
Member

jaromil commented Oct 5, 2017

ACK, you are right (well, its 101-249, anyway yes) the dhcp range setting isn't converted into the configuration of the ISC DHCP daemon.

About the gateway, you mean also setting wan inside /etc/dowse/settings doesn't give a default gateway on boot? In this case we may want to fix this as well, however is good practice to use also /etc/network/interfaces

@kneibdev
Copy link

kneibdev commented Oct 5, 2017

Correct: wan=192.168.100.102 is set in my /etc/dowse/settings but after booting I don't have a default gw. Have to add it manually.

Can i specify the range for DHCP for the time being somewhere else?
Tried als in ~dowse/dowse-src/daemons/dhcpd but no luck.

@jaromil
Copy link
Member

jaromil commented Oct 5, 2017

I'm fixing that (dhcp range) right now and will do more tests on the wan.

the problem is generated by a transition to a smarter detection system, but indeed manual settings should always override all correctly.

To receive the fixes you need to use latest git master branch.

@kneibdev
Copy link

kneibdev commented Oct 5, 2017

Okay thanks. Noob question: can I get to latest git master when I started with the downloadable sdcard image?

jaromil added a commit that referenced this issue Oct 5, 2017
@jaromil
Copy link
Member

jaromil commented Oct 5, 2017

Its actually a good question that we should include in the documentation.

I will try to sketch the procedure, but may be missing some detail:

  • you log inside the box as user dowse
  • cd dowse-src
  • git pull
  • make
    then login as root and
  • cd /home/dowse/dowse-src
  • make install
    it is rather important to not build it as root since during build the user is configured in some scripts.

@kneibdev
Copy link

kneibdev commented Oct 5, 2017

This results in an error:

devuan% more dhcpd.conf                                                                                                        Dowse
option routers 192.168.100.101;
option domain-name "dowse.it";
option domain-name-servers 192.168.100.101;
authoritative;
db-time-format local;
ddns-domainname "dowse.it";
local-address 192.168.100.101;
omapi-port 7911;

subnet 192.168.100.0/24 netmask 255.255.255.0 {
  range 192.168.100.10 192.168.100.65;

  on commit {
    set clip = binary-to-ascii(10, 8, ".", leased-address);
    set clhw  = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
    execute("/usr/local/dowse/bin/pendulum", "lease", clip, clhw, host-decl-name);
  }
}
devuan%

the /24 shouldn't be in the subnet I think...

  .  starting daemon: dhcpd
Internet Systems Consortium DHCP Server 4.3.4
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
/home/dowse/.dowse/run/dhcpd.conf line 10: Expecting netmask
subnet 192.168.100.0/
                     ^
Configuration file errors encountered -- exiting

@stucksubstitute
Copy link

Hi!

have you tried to edit /etc/dowse/settings (starting from the template in /etc/dowse/settings.dist)?

The instructions in that file aren't very clear. So the actual, live settings file should be /etc/dowse/settings, not /etc/dowse/settings.dist ? Can you clarify please?

@kneibdev
Copy link

kneibdev commented Oct 6, 2017

Yes I do my settings in /etc/dowse/settings but @jaromil changed some code to use the dhcp range. But there's still an error.

What file generates: /home/dowse/.dowse/run/dhcpd.conf ??

@kneibdev
Copy link

@jaromil would you mind to have a look at this dhcpd.conf error that occurs in latest branch?
Thanks

@jaromil
Copy link
Member

jaromil commented Oct 13, 2017

sure. sorry this is occurring also because our regression tests on travis are currently broken

@kneibdev
Copy link

kneibdev commented Nov 7, 2017

Is there any view on a solution for this? Thx..

@jaromil
Copy link
Member

jaromil commented Nov 7, 2017

its rather simple. we will merge our webui2 branch which has a lot of updates and then also fix this glitch, probably this week already.

@kneibdev
Copy link

Okay, will wait for that...

@jaromil
Copy link
Member

jaromil commented Nov 17, 2017

its fixed in my test environment now (current master branch). how about your setup?

@kneibdev
Copy link

Nope, the errormessage mentioned before is gone but the dhcp daemon doesn't give a default-gw to the clients.

root@devuan:/home/dowse/.dowse/run# more dhcpd.conf
option routers 192.168.100.101;
option domain-name "dowse.it";
option domain-name-servers 192.168.100.101;
authoritative;
db-time-format local;
ddns-domainname "dowse.it";
local-address 192.168.100.101;
omapi-port 7911;

subnet 192.168.100.0 netmask 255.255.255.0 {
  range 192.168.100.10 192.168.100.65;

  on commit {
    set clip = binary-to-ascii(10, 8, ".", leased-address);
    set clhw  = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
    execute("/usr/local/dowse/bin/pendulum", "lease", clip, clhw, host-decl-name);
  }
}

@jaromil
Copy link
Member

jaromil commented Nov 20, 2017

AFAIK the line option routers IP; should be it: that's the ISC DHCP configuration option to set the announced default gateway. Are you sure there is no other DHCP on your local test network?

@kneibdev
Copy link

kneibdev commented Nov 20, 2017

Yes, sorry, you are right.

But still this part of the config:

#########################
# SAFE TO LEAVE UNCHANGED
# in most cases, if you don't know what you are doing
# its better to not change the values below.

# under which system UID and GID dowse will run
# default is current user
# dowse_uid=proxy
# dowse_gid=proxy

# what network range we choose for our LAN (class C)
dowse_net=192.168.100.0/24

# which netmask to be applied (default is class C)
netmask=255.255.255.0

# ip range reserved for guests (first,last,leasetime)
dowse_guests=192.168.100.65,192.168.100.70,48h

Results in this file ~dowse/.dowse/run/dhpcd.conf:

root@devuan:~# more /home/dowse/.dowse/run/dhcpd.
more: stat of /home/dowse/.dowse/run/dhcpd. failed: No such file or directory
root@devuan:~# more /home/dowse/.dowse/run/dhcpd.conf
option routers 192.168.100.101;
option domain-name "dowse.it";
option domain-name-servers 192.168.100.101;
authoritative;
db-time-format local;
ddns-domainname "dowse.it";
local-address 192.168.100.101;
omapi-port 7911;

subnet 192.168.100.0 netmask 255.255.255.0 {
  range 192.168.100.10 192.168.100.65;

  on commit {
    set clip = binary-to-ascii(10, 8, ".", leased-address);
    set clhw  = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
    execute("/usr/local/dowse/bin/pendulum", "lease", clip, clhw, host-decl-name);
  }
}

I expected the range to be .65 - .70

@jaromil
Copy link
Member

jaromil commented Nov 20, 2017

ok yes the config is not reflecting all the settings, thanks

@kneibdev
Copy link

Ah ok, I think I am almost there... last problem is that DNS on dowse on all clients is returning it's own ip. (ip of dowse box = 192.168.100.101, cable modem/router = 192.168.100.102)

So on a client every nslookup returns in ip of dowse box:
On dowse:

devuan% nslookup nu.nl                                                                                                               Dowse
Server:		8.8.8.8
Address:	8.8.8.8#53

Non-authoritative answer:
Name:	nu.nl
Address: 174.129.25.170

devuan%           
                                                                                                              Dowse

On client with dhcp address from Dowse :


devuan% nslookup nu.nl                                                                                                               Dowse
Server:		192.168.100.101
Address:	192.168.100.101#53

Non-authoritative answer:
Name:	nu.nl
Address: 192.168.100.101

devuan%                                                                                                                              Dowse

@jaromil
Copy link
Member

jaromil commented Nov 20, 2017

this is normal, because Dowse tunnels the DNS via dnscrypt-proxy and because your client is not yet "authorised" to browse. To become admin visit http://dowse.it from inside (or directly 192.168.100.101) and with latest git master you will see the web interface where you can become admin and start watching and authorising devices.

@kneibdev
Copy link

kneibdev commented Nov 20, 2017

no that doesn't work. Looks like there no webserver running. Nothing listening on port 80.

But many many thanks for you effort and help so far!! 👍 I think best for me is to come back in a few weeks/months.

UPDATE: webui2 is never started. No error message...have no idea why.

@jaromil
Copy link
Member

jaromil commented Nov 22, 2017

Thanks to you too for helping us to understand how to smooth all edges. I'm taking notes so we address them in the next code sprint. I think the webui2 may not be started automatically if you don't recompile and make install the latest, then you need to login as user dowse pass dowse and then do start webui2. It should start with the latest version of the software on git branch master, however we'll just release a new SD card image soon.

@kneibdev
Copy link

I just did: remove ~dowse/dowse-src and started all over by git clone...etc
And then all steps, make and as root make install.
Then (with my original /etc/dowse/settings) dowse starts ok, with good dhcpd.conf (origin of this topic) but webui2 doesn't run. When doing start webui2 as user dowse:

devuan% start webui2                                                                                                             Dowse
  .  generating configuration for webui2
  .  starting daemon: webui2
devuan%

but noting listening on port 80

devuan% ps -ef|grep webui                                                                                                        Dowse
dowse    12250 10504  0 22:26 pts/0    00:00:00 grep webui
devuan%
devuan% netstat --listen                                                                                                         Dowse
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 devuan:6378             *:*                     LISTEN
tcp        0      0 devuan:6379             *:*                     LISTEN
tcp        0      0 *:29999                 *:*                     LISTEN
tcp        0      0 192.168.100.101:domain  *:*                     LISTEN
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp        0      0 *:1883                  *:*                     LISTEN
tcp        0      0 *:1888                  *:*                     LISTEN
tcp        0      0 *:7911                  *:*                     LISTEN
tcp6       0      0 [::]:29999              [::]:*                  LISTEN
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN
tcp6       0      0 [::]:1883               [::]:*                  LISTEN
udp        0      0 *:49188                 *:*
udp        0      0 192.168.100.101:domain  *:*
udp        0      0 192.168.100.101:bootps  *:*
udp6       0      0 [::]:44016              [::]:*
raw        0      0 *:icmp                  *:*                     7
raw        0      0 *:255                   *:*                     7
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  2      [ ACC ]     SEQPACKET  LISTENING     1193     /run/udev/control
devuan%

but noting in the logfiles...

Thank you again for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants