Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can't get static IP with systemd -- RESOLVED with OpenRC
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Fred Krogh
Veteran
Veteran


Joined: 07 Feb 2005
Posts: 1019
Location: Tujunga, CA

PostPosted: Wed Jan 24, 2018 11:56 pm    Post subject: Can't get static IP with systemd -- RESOLVED with OpenRC Reply with quote

A recent news item convinced me to give systemd a try. I'm hoping it is easier to get this working than to figure out how to get back tow here I was. My biggest issue is that I can't get a static ip addreess set up. In /etc/systemd/network/50-static.network, I have
Code:
[Match]
Name=mon1
[Network]
Address=192.168.1.2/24
Gateway=192.168.1.1

If someone could suggest something (anything!) to get this static IP address working under systemd I would be very grateful.
The following services are listed as failed when using systemctl list-units
Quote:
● mysqld.service loaded failed failed MySQL database server
● NetworkManager.service loaded failed failed Network Manager
● pulseaudio.service loaded failed failed Sound Service
● systemd-logind.service loaded failed failed Login Service
If someone has a suggestion for any of these others it would certainly save me some time, and perhaps others that want to experience the hell of systemd. Many Thanks,
Fred
Should have added that I'm using xfce4 and network coonections does not give anything.
From the status
Code:
 NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: failed (Result: timeout) since Wed 2018-01-24 16:38:52 PST; 1min 13s ago
     Docs: man:NetworkManager(8)
  Process: 189 ExecStart=/usr/sbin/NetworkManager --no-daemon (code=exited, status=0/SUCCESS)
 Main PID: 189 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/NetworkManager.service
           └─200 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /run/dhclient-eth0.pid -lf /var/lib/NetworkManager/dhclient-ebfe5d2e-087c-3cbe-90f7-8127f20af7b7-eth0.lease -cf /var/lib/NetworkManager/dhclient-eth0.conf eth0

Jan 24 16:38:52 mon1 systemd[1]: NetworkManager.service: Service hold-off time over, scheduling restart.
Jan 24 16:38:52 mon1 systemd[1]: NetworkManager.service: Failed to schedule restart job: Unit dbus.socket not found.
Jan 24 16:38:52 mon1 systemd[1]: NetworkManager.service: Failed with result 'timeout'.


Last edited by Fred Krogh on Thu Jan 25, 2018 6:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
mike155
Veteran
Veteran


Joined: 17 Sep 2010
Posts: 1303
Location: Frankfurt, Germany

PostPosted: Thu Jan 25, 2018 1:04 am    Post subject: Reply with quote

Don't start NetworkManager. Start/enable systemd-networkd.service instead.

NetworkManager and systemd-networkd.service are two different services and they use different configuration files. You have a systemd-networkd configuration file and you start NetworkManager - this won't work.

https://wiki.gentoo.org/wiki/Systemd#Network
https://forums.gentoo.org/viewtopic-p-8066540.html#8066540
https://wiki.archlinux.org/index.php/systemd-networkd
Back to top
View user's profile Send private message
Fred Krogh
Veteran
Veteran


Joined: 07 Feb 2005
Posts: 1019
Location: Tujunga, CA

PostPosted: Thu Jan 25, 2018 2:13 am    Post subject: Reply with quote

If I disable NetworkManager, I get no network at all. It seems systemd-networkd is running
Code:
# systemctl status systemd-networkd
● systemd-networkd.service - Network Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; v>
   Active: active (running) since Wed 2018-01-24 17:33:15 PST; 9min ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 137 (systemd-network)
   Status: "Processing requests..."
   CGroup: /system.slice/systemd-networkd.service
           └─137 /usr/lib/systemd/systemd-networkd

Jan 24 17:33:15 mon1 systemd[1]: Starting Network Service...
Jan 24 17:33:15 mon1 systemd-networkd[137]: Enumeration completed
Jan 24 17:33:15 mon1 systemd[1]: Started Network Service.
but there is no sign of the network (eth0 in this case).
And I see nothing that indicates where the problem might be. I appreciate your suggestion. I had already come across the first two links, but not the last. None of them seem to get me around the problem I'm having.
Back to top
View user's profile Send private message
Fred Krogh
Veteran
Veteran


Joined: 07 Feb 2005
Posts: 1019
Location: Tujunga, CA

PostPosted: Thu Jan 25, 2018 2:53 am    Post subject: Reply with quote

As a temporary measure I have managed to get the network running with
Code:
ifconfig eth0 inet up 192.168.1.2/24
route add default gw 192.168.1.1
I then sent an email to myself, and tried to fetch it with thunderbird. This results in the connection to 192.168.1.2 being refused.
At least some mail seems to be coming in now (mail-notification). So in addition to wanting a more permanent fix, I'd be interested in how to fix this problem of the connection being refused. Thanks,
Fred
Perhaps the following sheds light on this for a guru. postfix.service contains
Code:
[Unit]
Description=Postfix Mail Transport Agent
After=network.target

[Service]
Type=forking
ExecStartPre=-/usr/bin/newaliases
ExecStart=/usr/sbin/postfix start
ExecStop=/usr/sbin/postfix stop
ExecReload=/usr/sbin/postfix reload
# Hardening
PrivateTmp=yes
PrivateDevices=yes
ProtectSystem=full
ReadWritePaths=-/etc/mail/aliases.db
CapabilityBoundingSet=~ CAP_NET_ADMIN CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_MODULE
MemoryDenyWriteExecute=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectControlGroups=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_NETLINK AF_UNIX
RestrictNamespaces=true
RestrictRealtime=true

[Install]
WantedBy=multi-user.target

And
Code:
# systemctl status postfix
● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/lib64/systemd/system/postfix.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-01-24 18:42:35 PST; 19min ago
 Main PID: 3870 (master)
   CGroup: /system.slice/postfix.service
           ├─3870 /usr/libexec/postfix/master -w
           ├─3871 pickup -l -t unix -u
           ├─3872 qmgr -l -t unix -u
           ├─3877 tlsmgr -l -t unix -u
           ├─3878 anvil -l -t unix -u
           ├─4427 smtpd -n smtp -t inet -u -o stress=
           ├─4428 trivial-rewrite -n rewrite -t unix -u
           ├─4429 smtpd -n smtp -t inet -u -o stress=
           ├─4435 cleanup -z -t unix -u
           ├─4436 smtp -n smtp-amavis -t unix -u -o smtp_data_done_timeout=1200 -o smtp_send_xforward_command=yes -o disable_dns_lookups=yes -o max_use=20
           ├─4441 smtpd -n 127.0.0.1:10025 -t inet -u -o content_filter= -o local_recipient_maps= -o relay_recipient_maps= -o smtpd_restriction_classes= -o smtpd_delay_reject=no -o smtpd_client_restrictions=permit_mynetworks,reject -o smtpd_helo_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o mynetworks_style=h>
           └─4442 local -t unix

Jan 24 19:00:20 mon1 postfix/qmgr[3872]: DE7AB9E01C5: from=<forum-mods@gentoo.org>, size=2326, nrcpt=1 (queue active)
Jan 24 19:00:20 mon1 postfix/smtpd[4441]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Jan 24 19:00:20 mon1 postfix/smtp[4436]: B18A69E01B7: to=<fkrogh@mathalacarte.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=18, delays=0.15/0.01/0/18, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as DE7AB9E01C5)
Jan 24 19:00:20 mon1 postfix/qmgr[3872]: B18A69E01B7: removed
Jan 24 19:00:20 mon1 postfix/local[4442]: DE7AB9E01C5: to=<fkrogh@mathalacarte.com>, relay=local, delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Jan 24 19:00:20 mon1 postfix/qmgr[3872]: DE7AB9E01C5: removed
Jan 24 19:00:50 mon1 postfix/smtpd[4429]: connect from mta21-9934.e-activist.com[66.11.152.105]
Jan 24 19:00:50 mon1 postfix/smtpd[4429]: Anonymous TLS connection established from mta21-9934.e-activist.com[66.11.152.105]: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Jan 24 19:00:51 mon1 postfix/smtpd[4429]: NOQUEUE: reject: RCPT from mta21-9934.e-activist.com[66.11.152.105]: 554 5.7.1 <bounces@us.e-activist.com>: Sender address rejected: Access denied; from=<bounces@us.e-activist.com> to=<amv@mathalacarte.com> proto=ESMTP helo=<mta21-9934.e-activist.com>
Jan 24 19:00:51 mon1 postfix/smtpd[4429]: disconnect from mta21-9934.e-activist.com[66.11.152.105] ehlo=2 starttls=1 mail=1 rcpt=0/1 quit=1 commands=5/6
Back to top
View user's profile Send private message
mike155
Veteran
Veteran


Joined: 17 Sep 2010
Posts: 1303
Location: Frankfurt, Germany

PostPosted: Thu Jan 25, 2018 3:14 am    Post subject: Reply with quote

If your interface is called "eth0", the second line in your configuration file should be "Name=eth0" - and not "Name=mon1".

Stop and disable NetworkManager. You won't need it. Then run "systemctl restart systemd-networkd.service". What is the output of "ifconfig -a"? Any related messages in "journalctl -e" ?

You should defer configuration of your e-mail server. Get the network up and running first. If you want to test network connectivity, ping your server: "ping 192.168.1.1"
Back to top
View user's profile Send private message
Fred Krogh
Veteran
Veteran


Joined: 07 Feb 2005
Posts: 1019
Location: Tujunga, CA

PostPosted: Thu Jan 25, 2018 3:55 am    Post subject: Reply with quote

That did not fix my problem. This line in the journalctl -e
systemd-networkd[3731]: eth0: Gained IPv6LL

looks a bit strange to me. I have found in the past the IPv6 did not work well for me.
I've also discovered recently that I only have 1 console. Thanks for the help.
Back to top
View user's profile Send private message
grumblebear
Tux's lil' helper
Tux's lil' helper


Joined: 26 Feb 2008
Posts: 141

PostPosted: Thu Jan 25, 2018 9:25 am    Post subject: Reply with quote

mike155 wrote:
If your interface is called "eth0", the second line in your configuration file should be "Name=eth0" - and not "Name=mon1".

Nowadays eth0 gets renamed, so that line should read "Name=en*".
Back to top
View user's profile Send private message
Fred Krogh
Veteran
Veteran


Joined: 07 Feb 2005
Posts: 1019
Location: Tujunga, CA

PostPosted: Thu Jan 25, 2018 12:51 pm    Post subject: Reply with quote

Thanks for that suggestion, but neither "Name=en", nor "Name=eth0" bring up the network. I can still get it up using ifconfig as above. At the moment I'm most bothered by thunderbird getting a connection refused.
Back to top
View user's profile Send private message
Fred Krogh
Veteran
Veteran


Joined: 07 Feb 2005
Posts: 1019
Location: Tujunga, CA

PostPosted: Thu Jan 25, 2018 6:37 pm    Post subject: Reply with quote

Systemd is really nice, it makes the system boot over twice as fast!! Minor problems: I never got the network to start up properly, thunderbird wouldb't load emails, I never got userful messages from the logs, no virtual consoles, and never got pulseaudio to work. It will probably be a long time before I once again try booting with systemd on gentoo.
Back to top
View user's profile Send private message
grumblebear
Tux's lil' helper
Tux's lil' helper


Joined: 26 Feb 2008
Posts: 141

PostPosted: Thu Jan 25, 2018 8:11 pm    Post subject: Reply with quote

Fred Krogh wrote:
Thanks for that suggestion, but neither "Name=en", nor "Name=eth0" bring up the network. I can still get it up using ifconfig as above. At the moment I'm most bothered by thunderbird getting a connection refused.


I wrote en*, not en. The wildcard is important. How about posting the output of "ifconfig -a"?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum