From patchwork Fri Apr 19 07:33:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurucharan Shetty X-Patchwork-Id: 1088128 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44m4gR4QfLz9s4Y for ; Sat, 20 Apr 2019 04:46:10 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 5BF03239F; Fri, 19 Apr 2019 18:46:07 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 8C5B12399 for ; Fri, 19 Apr 2019 18:45:32 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 33EF814D for ; Fri, 19 Apr 2019 18:45:32 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id c8so2895008pfd.10 for ; Fri, 19 Apr 2019 11:45:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=E8xqEVBwAf4bMKDG8OcIS818U7TD/PGB3zp4kQ27V1c=; b=cYglGwlj2uscS9bsj64hQJOtEPP90LxvXRwJilymDm1ZsNaCvFb9Re7SMN/qyuDohS q67k1U0UDP4GtdedXJG+v9WojmGPrkdzf7D9iWqRkYXWrqzZ8QepspdI/ueiURtnKDsd JA2EOEmKNCWsAea5mBHBUbds8u24qHzlVkFLnimE6ZEj5XaiVVoY21Lj+ZSSZjuh8KVG J2X/SH5XpqRZHRIf1nS675wwPZA6xVOGMlBwuF2CW+d4nOITijuW3tqheFS5ZWRO8PwS Iqq/hidq6h9snoWCWwxumTQ6Tkwx5kcxLTSQ8PLIB5gxQRNMVFM8B/sTLFJu3uA8xdmN QfZw== X-Gm-Message-State: APjAAAWTXLUzusz3V4tCObUVg8GQulxZQc3EnEZ354nYL99DersOu4P3 QuOxwTvzl9QXy7fBycoSlsImK2nQ X-Google-Smtp-Source: APXvYqxqIEg7apPJPYMh2+luUh0AFTK0HxeuO8/N3lix6zycLQcYHNR+knf9jLHCtTITKEstUv+c8A== X-Received: by 2002:a63:7949:: with SMTP id u70mr5274662pgc.418.1555699531419; Fri, 19 Apr 2019 11:45:31 -0700 (PDT) Received: from kube-master.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id v1sm7635285pff.81.2019.04.19.11.45.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Apr 2019 11:45:30 -0700 (PDT) From: Gurucharan Shetty To: dev@openvswitch.org Date: Fri, 19 Apr 2019 00:33:57 -0700 Message-Id: <1555659237-17152-1-git-send-email-guru@ovn.org> X-Mailer: git-send-email 1.9.1 X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DATE_IN_PAST_06_12, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v2] debian: Notes for systemd-networkd integration with OVS. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Signed-off-by: Gurucharan Shetty Acked-by: Ben Pfaff --- v1-v2: use ip instead of ifconfig --- debian/openvswitch-switch.README.Debian | 76 ++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 2 deletions(-) diff --git a/debian/openvswitch-switch.README.Debian b/debian/openvswitch-switch.README.Debian index 7556844..f5a0062 100644 --- a/debian/openvswitch-switch.README.Debian +++ b/debian/openvswitch-switch.README.Debian @@ -40,8 +40,8 @@ In order of increasing manual effort, these are: * Build and install the kernel module by hand. -Debian network scripts integration ----------------------------------- +Debian network scripts (ifupdown) integration +------------------------------------------------ This package lets a user to optionally configure Open vSwitch bridges and ports from /etc/network/interfaces. Please refer to the interfaces(5) manpage for more details regarding /etc/network/interfaces. @@ -205,6 +205,78 @@ ex 8: Create and destroy bridges. ifup --allow=ovs $list_of_bridges ifdown --allow=ovs $list_of_bridges +Open vSwitch integration with systemd-networkd +----------------------------------------------- + +There is no native integration of OVS with systemd-networkd. That is, +you cannot create OVS bridges, ports and bonds by simply writing configuration +files in /etc/systemd/network. But, you can create OVS devices using ovs-vsctl +and then write configuration files to provide them IP addresses. + +As soon as a OVS device is visible, systemd-networkd will provide that device +an IP address. Since OVS database is persistent across reboots, the OVS +devices will get re-created after a reboot as soon as OVS startup script is +invoked. And systemd-networkd will immediately assign the configuration defined +in /etc/systemd/network. + +Example: + +If you have a physical ethernet device "ens160" which has been configured with +DHCP, your systemd-networkd's .network config file will look something like +this: + +``` +[Match] +Name=ens160 + +[Network] +DHCP=ipv4 + +[DHCP] +ClientIdentifier=mac +``` + +Please note how the DHCP ClientIdentifier above has been configured with the +mac address. + +To create a OVS bridge "br-ens160" and add "ens160" as a port of that +bridge, you can change the .network configuration for "ens160" to look like: + +``` +[Match] +Name=ens160 +``` + +Now create a new .network configuration file for "br-ens160". Something like: + +``` +[Match] +Name=br-ens160 + +[Network] +DHCP=ipv4 + +[DHCP] +ClientIdentifier=mac +``` + +Now, use ovs-vsctl to create br-ens160 and add ens160 as a port of it. You +will also have to flush the IP address of ens160 and restart systemd-networkd +in the same line. It is important to let br-ens160 have the same mac address as +ens160 to get the same IP address to br-ens160 from the DHCP server. In the +below command, "$mac_of_ens160" holds the mac address of ens160. For e.g: + +``` +mac_of_ens160='"00:0c:29:77:27:7a"' +ovs-vsctl --may-exist add-br br-ens160 -- \ + --may-exist add-port br-ens160 ens160 -- \ + set interface br-ens160 mac="$mac_of_ens160"; ip addr flush dev ens160; \ + systemctl restart systemd-networkd +``` + +br-ens160 should now have the same DHCP IP. It should also have the correct +DNS resolution servers configured. + Notes on dependencies: ---------------------