You are not logged in.

#1 2013-02-11 09:58:55

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

[SOLVED] systemd : need to restart dnsmasq and sshd so they work

Hi there,
my gateway computer has a few problems since arch switched to systemd. I have to manually restart sshd and dnsmasq otherwise they won't work properly. I suspect systemd starts them to early, i.e. before my network is operational (I use ifplugd and my internet connection may take a while to become operational). Here's a few logs (10:29 system boots, 10:32 I manually restart ssh and dnsmasq):

# journalctl -b | grep sshd
Feb 11 10:29:40 harrypotter sshd[216]: error: Bind to port XXXX on 192.168.0.10 failed: Cannot assign requested address.
Feb 11 10:29:40 harrypotter sshd[216]: fatal: Cannot bind any address.
Feb 11 10:29:40 harrypotter systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Feb 11 10:29:40 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:29:40 harrypotter systemd[1]: sshd.service holdoff time over, scheduling restart.
Feb 11 10:29:40 harrypotter sshd[251]: error: Bind to port XXXX on 192.168.0.10 failed: Cannot assign requested address.
Feb 11 10:29:40 harrypotter sshd[251]: fatal: Cannot bind any address.
Feb 11 10:29:40 harrypotter systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Feb 11 10:29:40 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:29:40 harrypotter systemd[1]: sshd.service holdoff time over, scheduling restart.
Feb 11 10:29:41 harrypotter sshd[254]: error: Bind to port XXXX on 192.168.0.10 failed: Cannot assign requested address.
Feb 11 10:29:41 harrypotter sshd[254]: fatal: Cannot bind any address.
Feb 11 10:29:41 harrypotter systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Feb 11 10:29:41 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:29:41 harrypotter systemd[1]: sshd.service holdoff time over, scheduling restart.
Feb 11 10:29:41 harrypotter sshd[259]: error: Bind to port XXXX on 192.168.0.10 failed: Cannot assign requested address.
Feb 11 10:29:41 harrypotter sshd[259]: fatal: Cannot bind any address.
Feb 11 10:29:41 harrypotter systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Feb 11 10:29:41 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:29:41 harrypotter systemd[1]: sshd.service holdoff time over, scheduling restart.
Feb 11 10:29:41 harrypotter sshd[269]: error: Bind to port XXXX on 192.168.0.10 failed: Cannot assign requested address.
Feb 11 10:29:41 harrypotter sshd[269]: fatal: Cannot bind any address.
Feb 11 10:29:41 harrypotter systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Feb 11 10:29:41 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:29:41 harrypotter systemd[1]: sshd.service holdoff time over, scheduling restart.
Feb 11 10:29:42 harrypotter sshd[282]: error: Bind to port XXXX on 192.168.0.10 failed: Cannot assign requested address.
Feb 11 10:29:42 harrypotter sshd[282]: fatal: Cannot bind any address.
Feb 11 10:29:42 harrypotter systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Feb 11 10:29:42 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:29:42 harrypotter systemd[1]: sshd.service holdoff time over, scheduling restart.
Feb 11 10:29:42 harrypotter systemd[1]: sshd.service start request repeated too quickly, refusing to start.
Feb 11 10:29:42 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:32:52 harrypotter sshd[1630]: Server listening on 192.168.0.10 port XXXXX
# journalctl -b | grep dnsmasq
Feb 11 10:29:52 harrypotter dnsmasq[516]: started, version 2.65 cachesize 500
Feb 11 10:29:52 harrypotter dnsmasq[516]: compile time options: IPv6 GNU-getopt DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack
Feb 11 10:29:52 harrypotter dnsmasq[516]: DBus support enabled: connected to system bus
Feb 11 10:29:52 harrypotter dnsmasq-dhcp[516]: DHCP, IP range 192.168.0.70 -- 192.168.0.99, lease time 1d
Feb 11 10:29:52 harrypotter dnsmasq[516]: read /etc/hosts - 9 addresses
Feb 11 10:29:52 harrypotter dnsmasq[516]: ignoring nameserver 127.0.0.1 - local interface
Feb 11 10:29:53 harrypotter dnsmasq[507]: dnsmasq: syntax check OK.
Feb 11 10:32:48 harrypotter dnsmasq[516]: exiting on receipt of SIGTERM
Feb 11 10:32:48 harrypotter dnsmasq[1581]: dnsmasq: syntax check OK.
Feb 11 10:32:48 harrypotter dnsmasq[1584]: started, version 2.65 cachesize 500
Feb 11 10:32:48 harrypotter dnsmasq[1584]: compile time options: IPv6 GNU-getopt DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack
Feb 11 10:32:48 harrypotter dnsmasq[1584]: DBus support enabled: connected to system bus
Feb 11 10:32:48 harrypotter dnsmasq-dhcp[1584]: DHCP, IP range 192.168.0.70 -- 192.168.0.99, lease time 1d
Feb 11 10:32:48 harrypotter dnsmasq[1584]: read /etc/hosts - 9 addresses
Feb 11 10:32:48 harrypotter dnsmasq[1584]: using nameserver 213.138.16.1#53
Feb 11 10:32:48 harrypotter dnsmasq[1584]: using nameserver 208.67.220.220#53
Feb 11 10:32:48 harrypotter dnsmasq[1584]: using nameserver 208.67.222.222#53
Feb 11 10:32:48 harrypotter dnsmasq[1584]: ignoring nameserver 127.0.0.1 - local interface

What would be the proper way to make them work without manual commands?

Thanks for any guidance.

Last edited by brazzmonkey (2013-02-27 07:56:48)


what goes up must come down

Offline

#2 2013-02-12 23:09:04

ron9
Member
From: Norway
Registered: 2011-02-02
Posts: 119

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

I use Wants and After=sys-subsystem-net-devices-<your interface>.device in my network.service.
Then the unit will not start before the network is ready.

systemctl --full | grep subsystem

< huawei matebook 14 | archlinux | labwc | alacritty | pcman | falkon | zen-browser >

Offline

#3 2013-02-13 00:01:02

debijan
Member
Registered: 2010-09-14
Posts: 37

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

Hi,

i've similar problems with my gateway.
It seems dbus related as my systemd-logind service also stuck and got hold in "activating" when you review whith systemctl status.
I had tho change the Type of the service from dbus to notify and then logind is working fine again.
Can you confirm that your systemd-logind service has problems too?

Offline

#4 2013-02-13 09:14:00

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

@ron9
I think you point me to the right direction. Could you be more specific, please?
Does this  mean I have to create this directory: /etc/systemd/system/network.target.wants, add my interfaces, and create a network.service in /etc/systemd/system/? (not very KISS if you ask me...)

@debijan

# systemctl status logind
logind.service                                                                                                                                                                          
          Loaded: error (Reason: No such file or directory)                                                                                                                             
          Active: inactive (dead) 

So I have problems too?


what goes up must come down

Offline

#5 2013-02-13 11:38:07

debijan
Member
Registered: 2010-09-14
Posts: 37

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

sorry if i wasn't explicit enough. the service is called systemd-logind, so please provide output of:
# systemctl status systemd-logind

here is mine:
[root@pactor ~]# systemctl status systemd-logind
systemd-logind.service - Login Service
          Loaded: loaded (/etc/systemd/system/systemd-logind.service; static)
          Active: activating (start) since Mi 2013-02-13 12:36:19 CET; 1min 17s ago
            Docs: man:systemd-logind.service(8)
                  man:logind.conf(5)
                  http://www.freedesktop.org/wiki/Softwar … /multiseat
        Main PID: 195 (systemd-logind)
          CGroup: name=systemd:/system/systemd-logind.service
                  └─195 /usr/lib/systemd/systemd-logind

Offline

#6 2013-02-13 14:38:27

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

# systemctl status systemd-logind                                                                                                                                 
systemd-logind.service - Login Service                                                                                                                                                  
          Loaded: loaded (/usr/lib/systemd/system/systemd-logind.service; static)                                                                                                       
          Active: active (running) since Wed 2013-02-13 08:29:04 CET; 7h ago                                                                                                            
            Docs: man:systemd-logind.service(8)                                                                                                                                         
                  man:logind.conf(5)                                                                                                                                                    
                  http://www.freedesktop.org/wiki/Software/systemd/multiseat                                                                                                            
        Main PID: 212 (systemd-logind)                                                                                                                                                  
          CGroup: name=systemd:/system/systemd-logind.service
                  └─212 /usr/lib/systemd/systemd-logind

Seems fine to me...


what goes up must come down

Offline

#7 2013-02-13 15:04:13

debijan
Member
Registered: 2010-09-14
Posts: 37

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

ok sorry, was just a guess. i've explained my problem here: https://bbs.archlinux.org/viewtopic.php?id=158044

Offline

#8 2013-02-20 13:38:57

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

I'm sorry but I'm really getting lost here...

My gateway computer has 2 NICs : one for the internet, one for LAN.
Back in time I had both these NICs configured in rc.conf. Then I had to switch to netcfg and ifplugd. Now I guess I have to make the proper switch to systemd. In the meantime I realised my internet IP is always the same, so I think my ISP switched to static IP.

So I'm wondering, maybe the simplest way to get my network working is to statically configure both my NICs, without netcfg nor ifplugd. How could I configure 2 NICs with systemd?

Thanks for any guidance.


what goes up must come down

Offline

#9 2013-02-20 15:38:21

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 1,360

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

brazzmonkey wrote:

I'm sorry but I'm really getting lost here...

My gateway computer has 2 NICs : one for the internet, one for LAN.
Back in time I had both these NICs configured in rc.conf. Then I had to switch to netcfg and ifplugd. Now I guess I have to make the proper switch to systemd. In the meantime I realised my internet IP is always the same, so I think my ISP switched to static IP.

So I'm wondering, maybe the simplest way to get my network working is to statically configure both my NICs, without netcfg nor ifplugd. How could I configure 2 NICs with systemd?

Thanks for any guidance.

I have a system with two nics also and I have had a lot of problems getting the network up after boot both with ifplugd/netcfg as well as independently using NetworkManager instead.  What I found is that I had to follow the advice at https://wiki.archlinux.org/index.php/Ud … ork_device, and then also add in a change to the NetworkManager service file for systemd as per the note part way down the page at: https://wiki.archlinux.org/index.php/Re … interfaces

This gives at least the network running after boot - but if I allow systemd to start the dhcp server via systemctl enable dhcpd4, and bind via systemctl enable named then there is no dns available after boot and dhcpd4 is in a failed state - once booted however I can start dhcpd4 and then named manually and the system works fine - this is all under systemd.  However there appears to be a timing issue between starting the network interfaces up, getting the network running and then starting services that depend on the network.

At this point I don't have a good solution but I posted to the arch mailing list and hoping that someone can help me out.  It is possible that your problem with sshd and/or dnsmasq not being functional after boot may be a similar issue to mine?

Added 20th February at 4.30pm - I have just tried a test on my system - by enabling NetworkManager-wait-online using systemctl enable NetworkManager-wait-online - I now find that the dhcpd4 service now correctly waits until the network interfaces are up and running before starting so the system now behaves nicely and all the services I need are running properly after the system has booted.

Last edited by mcloaked (2013-02-20 16:32:17)


Mike C

Offline

#10 2013-02-20 21:06:51

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

Thanks for sharing your experience mcloaked.

I don't have the NIC names (nicknames?) issue any more, I've solved it a few months ago.
Your timing issue seems very similar to mine,that's why I suspect ron9 to provide relevant advices (although I haven't be able to implement them so far...).
My gateway is a fairly old system that doesn't run a GUI, so I would'nt look into NetworkManager. My satellite internet connection is sometimes slow to initialize, that's why I use ifplugd in the first place. But since I now have static internet IP, I thought having a static network configuration (not relying on DHCP nor ifplugd), I could overcome these network-depending services issues. Unfortunately I have yet to figure out how to have a static setup on both my NICs. So far all I achieved is break one or the other network connection...


what goes up must come down

Offline

#11 2013-02-20 22:22:53

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

brazzmonkey wrote:

Hi there,
my gateway computer has a few problems since arch switched to systemd. I have to manually restart sshd and dnsmasq otherwise they won't work properly. I suspect systemd starts them to early, i.e. before my network is operational (I use ifplugd and my internet connection may take a while to become operational). Here's a few logs (10:29 system boots, 10:32 I manually restart ssh and dnsmasq):

# journalctl -b | grep sshd
Feb 11 10:29:40 harrypotter sshd[216]: error: Bind to port 2210 on 192.168.0.10 failed: Cannot assign requested address.
Feb 11 10:29:40 harrypotter sshd[216]: fatal: Cannot bind any address.
Feb 11 10:29:40 harrypotter systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Feb 11 10:29:40 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:29:40 harrypotter systemd[1]: sshd.service holdoff time over, scheduling restart.
Feb 11 10:29:40 harrypotter sshd[251]: error: Bind to port 2210 on 192.168.0.10 failed: Cannot assign requested address.
Feb 11 10:29:40 harrypotter sshd[251]: fatal: Cannot bind any address.
Feb 11 10:29:40 harrypotter systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Feb 11 10:29:40 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:29:40 harrypotter systemd[1]: sshd.service holdoff time over, scheduling restart.
Feb 11 10:29:41 harrypotter sshd[254]: error: Bind to port 2210 on 192.168.0.10 failed: Cannot assign requested address.
Feb 11 10:29:41 harrypotter sshd[254]: fatal: Cannot bind any address.
Feb 11 10:29:41 harrypotter systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Feb 11 10:29:41 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:29:41 harrypotter systemd[1]: sshd.service holdoff time over, scheduling restart.
Feb 11 10:29:41 harrypotter sshd[259]: error: Bind to port 2210 on 192.168.0.10 failed: Cannot assign requested address.
Feb 11 10:29:41 harrypotter sshd[259]: fatal: Cannot bind any address.
Feb 11 10:29:41 harrypotter systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Feb 11 10:29:41 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:29:41 harrypotter systemd[1]: sshd.service holdoff time over, scheduling restart.
Feb 11 10:29:41 harrypotter sshd[269]: error: Bind to port 2210 on 192.168.0.10 failed: Cannot assign requested address.
Feb 11 10:29:41 harrypotter sshd[269]: fatal: Cannot bind any address.
Feb 11 10:29:41 harrypotter systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Feb 11 10:29:41 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:29:41 harrypotter systemd[1]: sshd.service holdoff time over, scheduling restart.
Feb 11 10:29:42 harrypotter sshd[282]: error: Bind to port 2210 on 192.168.0.10 failed: Cannot assign requested address.
Feb 11 10:29:42 harrypotter sshd[282]: fatal: Cannot bind any address.
Feb 11 10:29:42 harrypotter systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Feb 11 10:29:42 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:29:42 harrypotter systemd[1]: sshd.service holdoff time over, scheduling restart.
Feb 11 10:29:42 harrypotter systemd[1]: sshd.service start request repeated too quickly, refusing to start.
Feb 11 10:29:42 harrypotter systemd[1]: Unit sshd.service entered failed state
Feb 11 10:32:52 harrypotter sshd[1630]: Server listening on 192.168.0.10 port XXXXX
# journalctl -b | grep dnsmasq
Feb 11 10:29:52 harrypotter dnsmasq[516]: started, version 2.65 cachesize 500
Feb 11 10:29:52 harrypotter dnsmasq[516]: compile time options: IPv6 GNU-getopt DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack
Feb 11 10:29:52 harrypotter dnsmasq[516]: DBus support enabled: connected to system bus
Feb 11 10:29:52 harrypotter dnsmasq-dhcp[516]: DHCP, IP range 192.168.0.70 -- 192.168.0.99, lease time 1d
Feb 11 10:29:52 harrypotter dnsmasq[516]: read /etc/hosts - 9 addresses
Feb 11 10:29:52 harrypotter dnsmasq[516]: ignoring nameserver 127.0.0.1 - local interface
Feb 11 10:29:53 harrypotter dnsmasq[507]: dnsmasq: syntax check OK.
Feb 11 10:32:48 harrypotter dnsmasq[516]: exiting on receipt of SIGTERM
Feb 11 10:32:48 harrypotter dnsmasq[1581]: dnsmasq: syntax check OK.
Feb 11 10:32:48 harrypotter dnsmasq[1584]: started, version 2.65 cachesize 500
Feb 11 10:32:48 harrypotter dnsmasq[1584]: compile time options: IPv6 GNU-getopt DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack
Feb 11 10:32:48 harrypotter dnsmasq[1584]: DBus support enabled: connected to system bus
Feb 11 10:32:48 harrypotter dnsmasq-dhcp[1584]: DHCP, IP range 192.168.0.70 -- 192.168.0.99, lease time 1d
Feb 11 10:32:48 harrypotter dnsmasq[1584]: read /etc/hosts - 9 addresses
Feb 11 10:32:48 harrypotter dnsmasq[1584]: using nameserver 213.138.16.1#53
Feb 11 10:32:48 harrypotter dnsmasq[1584]: using nameserver 208.67.220.220#53
Feb 11 10:32:48 harrypotter dnsmasq[1584]: using nameserver 208.67.222.222#53
Feb 11 10:32:48 harrypotter dnsmasq[1584]: ignoring nameserver 127.0.0.1 - local interface

What would be the proper way to make them work without manual commands?

Thanks for any guidance.

I am really confused about your setup. If I understand correctly, you have 2 NICs: 1 external (DHCP) and 1 internal (dnsmasq gives IPs 192.168.0.70-99). In your sshd_config, you have ListenAddress 192.168.0.10? Is that the external IP?

I'm afraid, I can't answer your question w/o further info, but I can say what the problem is not. It is not related to systemd-logind.service, or your ISP. By the way, your external IP is not static, it's just their DHCP server has not been rebooted. After reboot, your IP will change...

Regarding NIC naming, I'd not touch that, but tell us which interface does dnsmasq listen on (interface= in dnsmasq.conf)?


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#12 2013-02-21 10:13:05

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

Thanks Leonid.I

This computer is gateway to the internet. My setup is actually the following :
- eth0 is the internet, it gets IP with DHCP, which basically is 213.138.16.XX (external)
- eth1 is LAN, it has static IP (192.168.0.10, internal)

sshd listens to 192.168.0.10 so I can access this computer from LAN side.
dnsmasq acts as a DHCP server for computers connected to my LAN.

How can you say my internet IP is not static?


what goes up must come down

Offline

#13 2013-02-21 18:22:51

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

brazzmonkey wrote:

This computer is gateway to the internet. My setup is actually the following :
- eth0 is the internet, it gets IP with DHCP, which basically is 213.138.16.XX (external)
- eth1 is LAN, it has static IP (192.168.0.10, internal)

sshd listens to 192.168.0.10 so I can access this computer from LAN side.
dnsmasq acts as a DHCP server for computers connected to my LAN.

OK. How do you assign this static IP? Do you use netcfg profile, custom service, etc? Does this service start Before=network.target (both sshd and dnsmasq are supposed to start After=network.target)?

For example, I currently use netcfg to create a bridge br0 and assign a static IP 10.0.0.1 to it. Then dnsmasq is configured to serve IPs 10.0.0.2 up on br0. The key is that br0 is setup before network.target is reached, while dnsmasq starts after this target. The system boots in ~10 sec, but external interface usually takes up to a minute to obtain an IP (ifplugd as well),
so ifplugd has nothing to do with your problem...

brazzmonkey wrote:

How can you say my internet IP is not static?

Have you explicitly signed up for a static IP?

I can't say for sure because I don't know which DHCP server your ISP is using, but from my experience the situation is as follows. Take for instance, dnsmasq. It stores a map IP-to-MAC in /var/lib/misc. Now, if there are many clients this file is long and is probably only stored in RAM. This means that if ISP's DHCP server is up, your IP is not likely to change between reboots of your server (your MAC is fixed). However, if ISP server restarts, your IP would depend on the order clients actually connect. For instance, my IP was stable for ~6 months, but after a storm knocked out power to half of the city, it has changed because ISP had to shut down.


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#14 2013-02-21 20:15:22

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

Leonid.I wrote:

OK. How do you assign this static IP? Do you use netcfg profile, custom service, etc?

I suppose this is a netcfg profile, because it's defined in /etc/network.d/eth1-ethernet.

Does this service start Before=network.target (both sshd and dnsmasq are supposed to start After=network.target)?

Which service is this supposed to be? netcfg.service? The latter seems to be configured to start after network.target, and so is dnsmasq dnsmasq (according to service files in /lib/systemd/system/).
That's not the case for sshd, though.

The system boots in ~10 sec, but external interface usually takes up to a minute to obtain an IP (ifplugd as well),
so ifplugd has nothing to do with your problem...

Actually you're right, I should leave this one as it is, because my concern seems to be more on the LAN side.

Have you explicitly signed up for a static IP?

I can't say for sure because I don't know which DHCP server your ISP is using, but from my experience the situation is as follows. Take for instance, dnsmasq. It stores a map IP-to-MAC in /var/lib/misc. Now, if there are many clients this file is long and is probably only stored in RAM. This means that if ISP's DHCP server is up, your IP is not likely to change between reboots of your server (your MAC is fixed). However, if ISP server restarts, your IP would depend on the order clients actually connect. For instance, my IP was stable for ~6 months, but after a storm knocked out power to half of the city, it has changed because ISP had to shut down.

No I haven't. It hasn't changed in several years any how. But as you stated before, I should leave this aside for the moment.

Many thanks for taking time to help, much appreciated wink

Last edited by brazzmonkey (2013-02-21 20:16:02)


what goes up must come down

Offline

#15 2013-02-22 17:09:46

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

brazzmonkey wrote:
Leonid.I wrote:

OK. How do you assign this static IP? Do you use netcfg profile, custom service, etc?

I suppose this is a netcfg profile, because it's defined in /etc/network.d/eth1-ethernet.

Keep in mind that profiles in /etc/networks.d are not universal, so this name means nothing unless you post the actual file.

brazzmonkey wrote:

Does this service start Before=network.target (both sshd and dnsmasq are supposed to start After=network.target)?

Which service is this supposed to be? netcfg.service? The latter seems to be configured to start after network.target, and so is dnsmasq dnsmasq (according to service files in /lib/systemd/system/).
That's not the case for sshd, though.

netcfg.service + profile in /etc/network.d is how I do it, but I don't know about you. Also, I don't understand what you said because

$ cat /usr/lib/systemd/system/netcfg.service
[Unit]
Description=Netcfg multi-profile daemon
Before=network.target  <====== !!!!!!!!
Wants=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/netcfg-daemon start
ExecStop=/usr/bin/netcfg-daemon stop
KillMode=none

[Install]
WantedBy=multi-user.target

Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#16 2013-02-22 17:41:34

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

Leonid.I wrote:

Keep in mind that profiles in /etc/networks.d are not universal, so this name means nothing unless you post the actual file.

Here's the file

$ cat /etc/network.d/eth1-ethernet 
CONNECTION='ethernet'
DESCRIPTION='LAN connection'
INTERFACE='eth1'
IP="static"
ADDR='192.168.0.10'
DNS=("127.0.0.1")

netcfg.service + profile in /etc/network.d is how I do it, but I don't know about you. Also, I don't understand what you said

My mistake. It's "before", not "after" for netcfg.service.
But it's "after" for dnsmasq, and nothing for sshd (except "After=sshdgenkeys.service").


what goes up must come down

Offline

#17 2013-02-22 18:19:28

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

1. If you remove DNS from the profile and only run dnsmasq, does it give out leases w/o manual restarting?

2. Sshd may be starting before your network is available, although this is strange. Copy sshd.service to /etc/systemd/system, append network.target to After=, do systemctl reenable sshd.service and reboot to see if sshd starts fine on boot.


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#18 2013-02-26 08:16:03

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

Well, Leonid.I, I followed your instructions and it seems to work!
I'll wait a few days and mark this thread as solved.
Many many thanks! What lead you to think I had to comment out the DNS line in my network profile?


what goes up must come down

Offline

#19 2013-02-27 07:55:07

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

I confirm it works. Many thanks again Leonid.I.


what goes up must come down

Offline

#20 2013-02-27 18:01:54

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

brazzmonkey wrote:

Well, Leonid.I, I followed your instructions and it seems to work!
I'll wait a few days and mark this thread as solved.
Many many thanks! What lead you to think I had to comment out the DNS line in my network profile?

Glad to help smile

I had problems when I used local loopback as a DNS server (with dnsmasq running), so I figured your sshd was starting too fast, i.e. before the interface is assigned an IP. If you had ListenAddress 0.0.0.0 in sshd_config, this wouldn't be a problem I guess. So, you did order sshd.service after network.target, right?

I have no idea why/what was wrong with dnsmasq though because in your OP i didn't see any errors...


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#21 2013-03-01 09:25:01

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: [SOLVED] systemd : need to restart dnsmasq and sshd so they work

Leonid.I wrote:

So, you did order sshd.service after network.target, right?

Yes.

I have no idea why/what was wrong with dnsmasq though because in your OP i didn't see any errors...

Neither do I. It's been working for ages with this configuration, that's why I suspected systemd in the first place.
You had good intuition.


what goes up must come down

Offline

Board footer

Powered by FluxBB