You are not logged in.

#1 2012-09-23 03:55:05

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Static network setup in systemd (my oops..solved0

System services provides a special service file for static network setup.

Within the file are two data sets one being for use with conf.d and utilizng fixed address data.  Use of this data for a wired static system of eth0 addresses seems incorrect.

The second data file must be edited to reflect the correct addresses for the network.service. 

/etc/conf.d/network
interface=eth0
address=192.168.0.1
netmask=24
broadcast=192.168.0.255
gateway=192.168.0.254

.........................................................................................................................................................................

etc/systemd/system/network.service
[Unit]
Description=Network Connectivity
Wants=network.target
Before=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network
ExecStart=/sbin/ip link set dev ${interface} up
ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}
ExecStart=/sbin/ip route add default via ${gateway}
ExecStop=/sbin/ip addr flush dev ${interface}
ExecStop=/sbin/ip link set dev ${interface} down

[Install]
WantedBy=multi-user.target

It is not apparent what is required to establish the network.service within the system.  It is assumed that a conf.d daemon is probably needed, but the file supplied has fixed addresses.

Using the edited network.service file as the required item to place in systemd/system produces an error when the command....systemctl enable network.service.

The error says.... bad message. It always fails.


What is bad about the message, network format?  Missing /etc/conf.d?

By the title itself, the system service file required follows from the title therein given.

To place the other file in /etc/conf.d is illogical.  Or is that the only solution?

EDIT:  Deleted the title from the network.service file and all is well!

Last edited by lilsirecho (2012-09-23 04:57:45)


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#2 2012-09-23 04:32:49

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: Static network setup in systemd (my oops..solved0

Solved:  Made an oops by keeping the title attached to the network.service file.


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

Board footer

Powered by FluxBB