Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
setting up wired network interface with systemd
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
mounty1
l33t
l33t


Joined: 06 Jul 2006
Posts: 768
Location: Queensland

PostPosted: Wed Feb 12, 2014 10:24 am    Post subject: setting up wired network interface with systemd Reply with quote

I'm missing something obvious here but my wired interface isn't being configured during boot of a fresh systemd based system. So I have:
cat /etc/systemd/system/network-enp2s14.service:
[Unit]
Description=Static network service
After=local-fs.target
Documentation=man:ifconfig(8)
Documentation=man:route(8)

[Service]
# Type=oneshot
# RemainAfterExit=yes
ExecStart=/bin/ifconfig enp2s14 192.168.1.60 broadcast 192.168.1.255 netmask 192.168.1.255 up
ExecStart=/bin/route add default gw 192.168.1.1

[Install]
Alias=network-enp2s14.service
but:
Code:
# systemctl enable network-enp2s14.service
Failed to issue method call: Invalid argument

I tried without those two commented-out lines as well. Is this even the right way to go about it ? Manual setup of networking is:
Code:
# ifconfig enp2s14 192.168.1.59;route add default gw cortex

_________________
Michael Mounteney
Back to top
View user's profile Send private message
sling
n00b
n00b


Joined: 28 Nov 2004
Posts: 18
Location: Singapore

PostPosted: Wed Feb 12, 2014 11:11 am    Post subject: Reply with quote

Emerge and use netctl. You can more or less follow the Archlinux Wiki (https://wiki.archlinux.org/index.php/Netctl to set-up your interface(s).
Back to top
View user's profile Send private message
dambacher
Apprentice
Apprentice


Joined: 11 Feb 2003
Posts: 288
Location: Germany

PostPosted: Wed Feb 12, 2014 4:33 pm    Post subject: Reply with quote

the net has the syntax:
http://www.freedesktop.org/software/systemd/man/systemd.service.html

Quote:

ExecStart=
Commands with their arguments that are executed when this service is started. For each of the specified commands, the first argument must be an absolute and literal path to an executable.

When Type is not oneshot, only one command may be given. When Type=oneshot is used, more than one command may be specified. Multiple command lines may be concatenated in a single directive, by separating them with semicolons (these semicolons must be passed as separate words). Alternatively, this directive may be specified more than once with the same effect. Lone semicolons may be escaped as "\;". If the empty string is assigned to this option, the list of commands to start is reset, prior assignments of this option will have no effect.


what I get is that the service files are not good for scripting and ExecStart only works once if you not explicitly specify "Type=oneshot"
You commented it out...
Back to top
View user's profile Send private message
Marlo
Veteran
Veteran


Joined: 26 Jul 2003
Posts: 1414

PostPosted: Wed Feb 12, 2014 4:53 pm    Post subject: Reply with quote

Try this:

cat /usr/lib/systemd/system/static-network.service wrote:

[Unit]
Description=Static network service
After=local-fs.target
Documentation=man:ifconfig( 8 )
Documentation=man:route( 8 )

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/ifconfig enp2s14 192.168.1.60 broadcast 192.255.255.255 netmask 255.0.0.0 up
ExecStart=/bin/route add default gw 192.168.1.1 enp2s14

[Install]
WantedBy=multi-user.target

_________________
Thank you for your attention, interest and support.
------------------------------------------------------------------
http://radio.garden/
Back to top
View user's profile Send private message
mounty1
l33t
l33t


Joined: 06 Jul 2006
Posts: 768
Location: Queensland

PostPosted: Thu Feb 13, 2014 11:19 am    Post subject: still out of sequence Reply with quote

Thanks to all for the suggestions. As the machine has just one, wired, interface, I went with Marlo's proposal. The problem now is that the machine still attempts to perform the NFS mounts before the network is up. I tried
Code:
[Install]
WantedBy=network-online.target
and
Code:
[Install]
WantedBy=remote-fs-pre.target
but they don't work either. What's the correction sequencing declaration ?
_________________
Michael Mounteney
Back to top
View user's profile Send private message
Marlo
Veteran
Veteran


Joined: 26 Jul 2003
Posts: 1414

PostPosted: Thu Feb 13, 2014 4:21 pm    Post subject: Reply with quote

When the network is working, this thread is solved.
If you have an NFS question, open a new thread

(but for your interest follow the link)
http://gentoo-en.vfose.ru/wiki/Systemd#NFS
Ma
_________________
Thank you for your attention, interest and support.
------------------------------------------------------------------
http://radio.garden/
Back to top
View user's profile Send private message
mounty1
l33t
l33t


Joined: 06 Jul 2006
Posts: 768
Location: Queensland

PostPosted: Fri Feb 14, 2014 4:22 am    Post subject: Not an NFS question Reply with quote

No, it's still a systemd question. I'm asking about sequencing of systemd services.

Thanks for the link but it describes an older version of systemd. E.g., nfs4_client.target does not exist on my system.
_________________
Michael Mounteney
Back to top
View user's profile Send private message
dambacher
Apprentice
Apprentice


Joined: 11 Feb 2003
Posts: 288
Location: Germany

PostPosted: Fri Feb 14, 2014 6:53 am    Post subject: Reply with quote

lvn runs an article about systemd, look at

http://lwn.net/Articles/584176/

maybe you have to wait for a week if you're not a subscriber.
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