From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 9C1611381F3 for ; Thu, 25 Jul 2013 15:43:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CB478E0A94; Thu, 25 Jul 2013 15:42:58 +0000 (UTC) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com [209.85.215.51]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A480CE0946 for ; Thu, 25 Jul 2013 15:42:57 +0000 (UTC) Received: by mail-la0-f51.google.com with SMTP id fp13so1411681lab.38 for ; Thu, 25 Jul 2013 08:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=79If8PVSsR9kjqp3P3Wt77V+r0a1J5wetJu5dc/sWCM=; b=nEktgWCNsld85oiBqrXQXQwhbEW6zvCmv6176l4cW81atfxqU/2/P9+DR81IxbnimT HfvIEX7xk1B6/89eHdOKQh6sF8UBkXa6rV8NND1D5aw7L/va2v8V8snXUMZGZXXG2/zc obnt5960LisOmZoCLr0tFVmlwI7iulOwwJ34i/rgCknICReTz0BjJWwph1JPg6ZVH++h YeA1De/FpzgbYVcV2PL0bopAGWfIC4MZoZNdI94t8PE++kGWk0ls4X+ocBAB54IiGeoQ ZEjX4VLYJ4/WONCW3Ior9qw4cWES9PTZCWlQgNiB7ZE+8XhnKumNI/X7DRW5LFZmgQ8t t/DA== Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 X-Received: by 10.152.5.227 with SMTP id v3mr19590165lav.31.1374766975912; Thu, 25 Jul 2013 08:42:55 -0700 (PDT) Received: by 10.114.199.38 with HTTP; Thu, 25 Jul 2013 08:42:55 -0700 (PDT) In-Reply-To: <51F10221.1080807@hadt.biz> References: <51F10221.1080807@hadt.biz> Date: Thu, 25 Jul 2013 10:42:55 -0500 Message-ID: Subject: Re: [gentoo-user] Systemd and static network From: =?UTF-8?B?Q2FuZWsgUGVsw6FleiBWYWxkw6lz?= To: gentoo-user@lists.gentoo.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 94c3d3eb-14bb-41cf-91bd-1ddca4bb9370 X-Archives-Hash: fb6743c34656f73f601e7a4b979746b8 On Thu, Jul 25, 2013 at 5:46 AM, Michael Hampicke 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=3DStatic network service After=3Dlocal-fs.target Documentation=3Dman:ifconfig(8) Documentation=3Dman:route(8) [Service] Type=3Doneshot RemainAfterExit=3Dyes ExecStart=3D/bin/ifconfig broadcast netmask = up ExecStart=3D/bin/route add default gw # -------------------------------------------------------------------------= ------------------ 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=3DDHCP on %I After=3Dbasic.target [Service] ExecStartPre=3D/bin/ifconfig %I up ExecStart=3D/sbin/dhcpcd -B %I [Install] WantedBy=3Dmulti-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. --=20 Canek Pel=C3=A1ez Vald=C3=A9s Posgrado en Ciencia e Ingenier=C3=ADa de la Computaci=C3=B3n Universidad Nacional Aut=C3=B3noma de M=C3=A9xico