From patchwork Fri Apr 19 07:22:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurucharan Shetty X-Patchwork-Id: 1088116 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 44m4Qk24f6z9sBb for ; Sat, 20 Apr 2019 04:35:08 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 77B502303; Fri, 19 Apr 2019 18:35:06 +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 2915722B1 for ; Fri, 19 Apr 2019 18:34:34 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 968F5466 for ; Fri, 19 Apr 2019 18:34:33 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id w23so2950733ply.4 for ; Fri, 19 Apr 2019 11:34:33 -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=lParJy14q+FyfJdr52ejBeQbavwGMXgjNvGkbvW51LE=; b=QOA1sf1FfUP1AxpjFZa0c1ET67TI1JgrIEi+ZLWP+Pt8KM5MZxIz+1YvEsTJTnWnhJ 0LfxkjBIkoW6OhFK+tHWfGBnq6ah7gdtfVkgo2PjqtEwVNddXZ95BJsASf40iQnQWc2g zx6yDovJ6u4gdct2XObX/j99V9rIX9xf4mzag8L+1tvho35HFQZUtQZPQZM+MN4Ajq5a S5lwbK8QjuEkeoNtbd0PdACh5i401nEJ2OmtabwWIfKgiZJMGw+pLCO0py+653kGGjnl XYD/5igVHkTGeP8hYhmtQzQZC47A60IETe7LkRSKY4qdCYDEBu8d1vsr5cbrOK6+rosQ qGmA== X-Gm-Message-State: APjAAAUV1F6vGXltxfYOXkP5cAVGrm5wyVqlP8b9ZzeA8nHAxsLWpEOD 8Y+c8ENf16iqmQksje2ahpOHmEpD X-Google-Smtp-Source: APXvYqzZpV+tSyQ9JSAC4uU+IOw3D8ZA3VgCc3FMoXnuCLNojjlsoOYPbCwQQXk1m1Eq6zsjVyQE1w== X-Received: by 2002:a17:902:b40a:: with SMTP id x10mr5298968plr.231.1555698872584; Fri, 19 Apr 2019 11:34:32 -0700 (PDT) Received: from kube-master.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id b63sm17214815pfj.54.2019.04.19.11.34.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Apr 2019 11:34:31 -0700 (PDT) From: Gurucharan Shetty To: dev@openvswitch.org Date: Fri, 19 Apr 2019 00:22:55 -0700 Message-Id: <1555658575-1579-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] 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 --- 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..ebe4cf0 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"; ifconfig ens160 0.0.0.0; \ + 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: ---------------------