public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* Re: [gentoo-user] Systemd and static network
  @ 2013-07-26  4:46 99%   ` Michael Hampicke
  0 siblings, 0 replies; 1+ results
From: Michael Hampicke @ 2013-07-26  4:46 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2294 bytes --]

Am 25.07.2013 17:42, schrieb Canek Peláez Valdés:
> On Thu, Jul 25, 2013 at 5:46 AM, Michael Hampicke <mh@hadt.biz> wrote:
>> Howdy folks,
>>
>> currently I am migrating some servers to systemd, and I am wondering
>> what's the best way to set up static networking. Until now, I always
>> used dhcp + networkmanager (workstations, laptops).
>>
>> Some suggested creating your own network unit and manually start
>> ifconfig/route or ip via ExecStart, some suggested Arch's netctl which
>> seems to support static addresses and brings a systemd unit file.
>>
>> At the moment, following the KISS principle, I tend to a customized unit
>> file.
>>
>> What do you use - and what are the benefits of your method?
> 
> I use the following unit in one of my servers:
> 
> # -------------------------------------------------------------------------------------------
> [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 <DEVICE> <IP> broadcast <BCAST> netmask <NETMASK> up
> ExecStart=/bin/route add default gw <GW> <DEVICE>
> # -------------------------------------------------------------------------------------------
> 
> Obviously, change the necessary parameters.
> 
> The benefit is that it doesn't get any more simple, I believe. If DHCP
> is available and I don't want to use NetworkManager, I use the
> following unit:
> 
> # -------------------------------------------------------------------------------------------
> [Unit]
> Description=DHCP on %I
> After=basic.target
> 
> [Service]
> ExecStartPre=/bin/ifconfig %I up
> ExecStart=/sbin/dhcpcd -B %I
> 
> [Install]
> WantedBy=multi-user.target
> # -------------------------------------------------------------------------------------------
> 
> You can then enable the unit with:
> 
> systemctl enable dhcpcd@DEV.service
> 
> where DEV is enp0s0, or whatever funny name udev gives to your network
> card. I think I got the unit from Arch, or maybe I wrote; I honestly
> don't remember.
> 
> Regards.
> 

Tanks. I will give netctl a try in a VM. For now, on real machines, I am
going with the unit you suggested.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2013-07-25 10:46     [gentoo-user] Systemd and static network Michael Hampicke
2013-07-25 15:42     ` Canek Peláez Valdés
2013-07-26  4:46 99%   ` Michael Hampicke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox