Re: [gentoo-user] Systemd and static network
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
Re: [gentoo-user] Systemd and static network
Am 2013-07-26 11:26, schrieb Stefan G. Weichinger: 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 Good idea, I already had forgotten that you could parse variables from another file in a systemd unit.
Re: [gentoo-user] Systemd and static network
On Thu, Jul 25, 2013 at 6:46 AM, Michael Hampicke m...@hadt.biz wrote: What do you use - and what are the benefits of your method? Why not continue to use DHCP and simply set a static assignment based on the MAC inside the DHCP server? Then it doesn't matter how the system is setup, it just works... -- Douglas J Hunley (doug.hun...@gmail.com) Twitter: @hunleyd Web: douglasjhunley.com G+: http://goo.gl/sajR3
Re: [gentoo-user] Systemd and static network
On Thursday 25 July 2013 17:23:56 I wrote: Systemd will not read /etc/conf.d/net like /etc/init.d/net.* scripts do. You need some service that will prepare the network. I personally prefer netctl, it is KISS enough. It was me who asked the devs to add it to the tree :) I tried NM too, it does not work out of the box with systemd, there are several issues.
Re: [gentoo-user] Systemd and static network
KMail is messing with my emails here, quotations in sent letters are not the way they used to look in edit mode :)
Re: [gentoo-user] Systemd and static network
On Thursday 25 July 2013 08:18:00 Douglas J Hunley wrote: On Thu, Jul 25, 2013 at 6:46 AM, Michael Hampicke m...@hadt.biz[1] wrote: What do you use - and what are the benefits of your method? Systemd will not read /etc/conf.d/net like /etc/init.d/net.* scripts do. You need some service that will prepare the network. I personally prefer netctl, it is KISS enough. It was me who asked the devs to add it to the tree :) I tried NM too, it does not work out of the box with systemd, there are several issues. [1] mailto:m...@hadt.biz
Re: [gentoo-user] Systemd and static network
Am 2013-07-25 14:18, schrieb Douglas J Hunley: On Thu, Jul 25, 2013 at 6:46 AM, Michael Hampicke m...@hadt.biz wrote: What do you use - and what are the benefits of your method? Why not continue to use DHCP and simply set a static assignment based on the MAC inside the DHCP server? Then it doesn't matter how the system is setup, it just works... There's no DHCP in this particular offsite data center :-)
Re: [gentoo-user] Systemd and static network
On Thu, Jul 25, 2013 at 5:46 AM, Michael Hampicke m...@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. -- Canek Peláez Valdés Posgrado en Ciencia e Ingeniería de la Computación Universidad Nacional Autónoma de México
Re: [gentoo-user] Systemd and static network
Am 25.07.2013 17:42, schrieb Canek Peláez Valdés: On Thu, Jul 25, 2013 at 5:46 AM, Michael Hampicke m...@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. signature.asc Description: OpenPGP digital signature
Re: [gentoo-user] Systemd and static network
Re CADPrc803kq_c76b1oqp3PksvDgyP5MD+zqLGqcsxk=eCT2iYRA@mail.gmail.comCADPrc803kq_c76b1oqp3PksvDgyP5MD+zqLGqcsxk=eCT2iYRA@mail.gmail.com51f10221.1080...@hadt.biz, Michael Hampicke said: Tanks. I will give netctl a try in a VM. For now, on real machines, I am going with the unit you suggested. I'm using netctl on one VM now. I'm... ok with it. for now... it did seem to break during one update, so I think it's still in flux. And the configuration is a bit confusing. -- Keith -- -- ~ Keith Dart ke...@dartworks.biz public key: ID: 19017044 http://www.dartworks.biz/ =