Am 25.07.2013 17:42, schrieb Canek Peláez Valdés:
>> What do you use - and what are the benefits of your method?
>
> I use the following unit in one of my servers:
>
> #
> -------------------------------------------------------------------------------------------
> [Unit]
My current version, using "ip" :
# cat network.service
[Unit]
Description=Network Connectivity
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network_systemd
ExecStart=/bin/ip link set dev ${interface} up
ExecStart=/bin/ip addr add ${address}/${netmask} broadcast ${broadcast}
dev ${interface}
ExecStart=/bin/ip route add default via ${gateway}
ExecStop=/bin/ip addr flush dev ${interface}
ExecStop=/bin/ip link set dev ${interface} down
[Install]
WantedBy=network.target
----- so that unitfile does not have to be touched again and you only
edit /etc/conf.d/network_systemd ->
# cat /etc/conf.d/network_systemd
PATH=/sbin:/usr/sbin
interface=p4p1
address=192.x.y.z
netmask=255.255.255.0
broadcast=192.x.y.zz
gateway=192.x.y.zzz
-----
I have a second unitfile with a more complicated setup for bridging
(with KVM).
Stefan