Commit Graph

14 Commits

Author SHA1 Message Date
fliiiix
1b459eded4 Rename ifup/down and remove usless parameter passing
Signed-off-by: Felix <de-ch@hotmail.de>
2018-03-22 17:11:17 +01:00
Jonathan Calmels
bbb8e190f1 lxc-net: add LXC_DHCP_PING boolean option
Excerpt from dnsmasq(8):
By default, the DHCP server will attempt to ensure that an address in not
in use before allocating it to a host. It does this by sending an ICMP echo
request (aka "ping") to the address in question. If it gets a reply, then the
address must already be in use, and another is tried. This flag disables this check.

This is useful if one expects all the containers to get an IP address
from the LXC authoritative DHCP server and wants to speed up the process
of getting a lease.

Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
2017-12-19 15:18:28 -08:00
adrian5
09a4c38063 Fix typo in lxc-net script
Signed-off-by: adrian5 <adrian5@users.noreply.github.com>
2017-10-27 20:29:50 +02:00
Carsten Brandt
4f4e7141dd
Make lxc-net return non-zero on failure
I found that even though the service lxc-net failed to start because I made some wrong configuration
settings the command exists zero.
So systemd reports the status of the service as good even though it failed:

    # service lxc-net status
    ● lxc-net.service - LXC network bridge setup
       Loaded: loaded (/lib/systemd/system/lxc-net.service; enabled)
       Active: active (exited) since Wed 2017-02-08 08:17:32 EST; 21min ago
      Process: 529 ExecStart=/usr/lib/x86_64-linux-gnu/lxc/lxc-net start (code=exited, status=0/SUCCESS)
     Main PID: 529 (code=exited, status=0/SUCCESS)
       CGroup: /system.slice/lxc-net.service

    Feb 08 08:17:30 dvm2 systemd[1]: Starting LXC network bridge setup...
    Feb 08 08:17:32 dvm2 lxc-net[529]: dnsmasq: failed to create listening socket for 10.2.2.1: Address already in use
    Feb 08 08:17:32 dvm2 lxc-net[529]: Failed to setup lxc-net.
    Feb 08 08:17:32 dvm2 systemd[1]: Started LXC network bridge setup.

Adding `exit 1` here makes it exit non-zero to make systemd recognize the failure.

Signed-off-by: Carsten Brandt <mail@cebe.cc>
2017-02-08 14:54:02 +01:00
Cam Cope
84432621ed
Configure a static MAC address on the LXC bridge
Signed-off-by: Cam Cope <cam@dropbox.com>
2016-11-22 15:16:32 -08:00
TAMUKI Shoichi
cdcae1034c Fold dnsmasq command line in lxc-net.in
Fold dnsmasq command line at about 80 chars because the line is too
long.

Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-12-09 22:56:59 -05:00
Stéphane Graber
dfb5edcac0 lxc-net: Use iproute and relative paths everywhere (V2)
V2 changes:
 - Keep using /var/lib for the lease file, but making it respect localstatedir
 - Don't pass an empty --conf-file as that confuses dnsmasq when
   /etc/dnsmasq.conf doesn't exist or isn't readable.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-06-29 13:36:55 -04:00
Stéphane Graber
47fcda9926
Fix lxc-net regression on missing restorecon
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2015-04-28 09:01:40 +02:00
Stéphane Graber
370f2e811c lxc-net: Rework/cleanup
This updates lxc-net with the following changes:
 - Better recover from crashes/partial runs
 - Better error detection and reporting
 - Less code duplication (use the stop code on crash)
 - Better state tracking
 - Allow for restart of all of lxc-net except for the bridge itself
 - Only support iproute from this point on (ifconfig's been deprecated
   for years)

V2: Use template variables everywhere

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-04-28 08:23:17 +02:00
Stéphane Graber
d47961ebd6 Add IPv6 support to lxc-net
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-04-24 11:00:32 -04:00
Stéphane Graber
50066f4f7e Prefer iproute over ifconfig
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2015-03-11 12:25:05 -04:00
S.Çağlar Onur
5fdd4b0c11 restore the dropped bits of 1c1bb85ad2 and also implement the logic
suggested at
https://lists.linuxcontainers.org/pipermail/lxc-devel/2014-December/010985.html

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2015-01-20 16:40:41 -05:00
Dwight Engen
f3b8088dd8 systemd/selinux init scripts fixups
- RHEL/OL 7 doesn't have the ifconfig command by default so have the
  lxc-net script check for its existence before use, and fall back
  to using the ip command if ifconfig is not available

- When lxc-net is run from systemd on a system with selinux enabled,
  the mkdir -p ${varrun} will create /run/lxc as init_var_run_t which
  dnsmasq can't write its pid into, so we restorecon it
  after creation (to var_run_t)

- The lxc-net systemd .service file needs an [Install] section so that
  "systemctl enable lxc-net" will work

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
2014-10-08 17:57:33 -04:00
Michael H. Warfield
0af993195c Rework init scripts
This commit is based on the work of:
    Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>

A generic changelog would be:
 - Bring support for lxcbr0 to all distributions
 - Share the container startup and network configuration logic across
   distributions and init systems.
 - Have all the init scripts call the helper script.
 - Support for the various different distro-specific configuration
   locations to configure lxc-net and container startup.

Changes on top of Mike's original version:
 - Remove sysconfig/lxc-net as it's apparently only there as a
   workaround for an RPM limitation and is breaking Debian systems by
   including a useless file which will get registered as a package provided
   conffile in the dpkg database and will therefore cause conffile prompts
   on upgrades...
 - Go with a consistant coding style in the various init scripts.
 - Split out the common logic from the sysvinit scripts and ship both in
   their respective location rather than have them be copies.
 - Fix the upstart jobs so they actually work (there's no such thing as
   libexec on Debian systems).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-09-26 10:55:11 -04:00