AHV 主机联网

AHV 主机联网

AHV 主机联网

这是机器翻译的文章,请单击此处查看原始英文版本。

描述

Nutanix 支持门户上提供的文档涵盖了 AHV 网络。

解决方案

注意:请勿在用户 VM 或 CVM 接口(vnet 接口)上使用任何这些命令。

涵盖的主题:

Open vSwitch 配置

Nutanix AHV 主机预配置了 Open vSwitch。“ovs-vsctl show”命令将打印 Open vSwitch 配置的概述:

 [root@ahv ~]#  ovs-vsctl show e0d89b99-335d-417f-9fd1-4a0cb8db711e    Bridge "br0"        Port "br0"            Interface "br0"                type: internal        Port "vnet0"            Interface "vnet0"        Port "bond0"            Interface "eth2"            Interface "eth1"            Interface "eth0"    ovs_version: "1.10.0"

有一个名为“br0”的桥,它有多个端口。

  • 端口“br0”是网桥 br0 上的内部接口。这是 AHV 主机的外部管理接口。
  • 端口“vnet0”是 CVM(控制器虚拟机)使用的虚拟接口端口。
  • 端口“bond0”或端口“br0-up”是包含来自 AHV 主机的多个物理接口的绑定端口。

注意:在 AOS 5.5 中引入了桥接链接,因此您可以在“ovs-vsctl show”输出中看到更多桥接。
[回到顶部]

manage_ovs 实用程序

Nutanix 提供了一个名为“manage_ovs”的实用程序,该实用程序安装在每个 CVM 上,用于管理 AHV 主机上的 Open vSwitch 配置。有关使用的详细信息,请参阅“manage_ovs --helpshort”输出。

AOS 5.10.2 的示例输出:

 nutanix@cvm$ manage_ovs --helpshort USAGE: manage_ovs [flags] Where is one of the following: show_bridges: Shows a list of the uplink bridges. show_interfaces: Shows a list of host physical interfaces. show_uplinks: Shows the current uplink configuration for the OVS bridge. update_uplinks: Updates the uplink configuration for the OVS bridge. enable_bridge_chain: Enables bridge chaining on the host. disable_bridge_chain: Disables bridge chaining on the host. create_single_bridge: Adds one OVS bridge to the host. delete_single_bridge: Removes one OVS bridge from the host. The update_uplinks action requires the --interfaces flag, which indicates the desired set of uplinks for the OVS bridge. The script will remove any existing uplinks from the bridge, and replace them with the specified set of uplinks on a single bonded port. flags: /usr/local/nutanix/cluster/bin/manage_ovs: --bond_mode: Bond mode to use: active-backup, balance-slb, or balance-tcp (default: 'active-backup') --bond_name: Bond name to use --bridge_name: Openvswitch on which to operate (default: '') --[no]dry_run: Just print what would be done instead of doing it (default: 'false') --[no]enable_vlan_splinters: Enable VLAN splintering on uplink interfaces (default: 'true') --[no]force: Reconfigure the bridge even if the the set of uplinks has not changed (default: 'false') -?,--[no]help: show this help --[no]helpshort: show usage only for this module --[no]helpxml: like --help, but generates XML output --host: Host on which to operate (default: '192.168.5.1') --interfaces: Comma-delimited list of interfaces to configure as bridge uplinks, or a keyword based on the NIC speed: all, 100g, 40g, 10g, 1g, etc. --[no]json: Output in json format. (default: 'false') --lacp_fallback: If LACP negotiation fails, set the bond_mode to active-backup: true, false (default: 'true') --lacp_mode: LACP mode for the uplink bond: off, slow, or fast (default: 'off') --mtu: Maximum transmission unit (an integer) --num_arps: Number of gratuitous ARPs to send on the bridge interface after updating uplinks (default: '3') (an integer) --[no]prevent_network_loop: Enables network loop prevention when bridge chain is enabled. (default: 'false') --[no]require_link: Require that at least one uplink has link status (default: 'true') 
  nutanix@cvm$ manage_ovs --helpshort USAGE: manage_ovs [flags] Where is one of the following: show_bridges: Shows a list of the uplink bridges. show_interfaces: Shows a list of host physical interfaces. show_uplinks: Shows the current uplink configuration for the OVS bridge. update_uplinks: Updates the uplink configuration for the OVS bridge. enable_bridge_chain: Enables bridge chaining on the host. disable_bridge_chain: Disables bridge chaining on the host. create_single_bridge: Adds one OVS bridge to the host. delete_single_bridge: Removes one OVS bridge from the host. The update_uplinks action requires the --interfaces flag, which indicates the desired set of uplinks for the OVS bridge. The script will remove any existing uplinks from the bridge, and replace them with the specified set of uplinks on a single bonded port. flags: /usr/local/nutanix/cluster/bin/manage_ovs: --bond_mode: Bond mode to use: active-backup, balance-slb, or balance-tcp (default: 'active-backup') --bond_name: Bond name to use --bridge_name: Openvswitch on which to operate (default: '') --[no]dry_run: Just print what would be done instead of doing it (default: 'false') --[no]enable_vlan_splinters: Enable VLAN splintering on uplink interfaces (default: 'true') --[no]force: Reconfigure the bridge even if the the set of uplinks has not changed (default: 'false') -?,--[no]help: show this help --[no]helpshort: show usage only for this module --[no]helpxml: like --help, but generates XML output --host: Host on which to operate (default: '192.168.5.1') --interfaces: Comma-delimited list of interfaces to configure as bridge uplinks, or a keyword based on the NIC speed: all, 100g, 40g, 10g, 1g, etc. --[no]json: Output in json format. (default: 'false') --lacp_fallback: If LACP negotiation fails, set the bond_mode to active-backup: true, false (default: 'true') --lacp_mode: LACP mode for the uplink bond: off, slow, or fast (default: 'off') --mtu: Maximum transmission unit (an integer) --num_arps: Number of gratuitous ARPs to send on the bridge interface after updating uplinks (default: '3') (an integer) --[no]prevent_network_loop: Enables network loop prevention when bridge chain is enabled. (default: 'false') --[no]require_link: Require that at least one uplink has link status (default: 'true')
   
   nutanix@cvm$ manage_ovs --helpshort USAGE: manage_ovs [flags] Where is one of the following: show_bridges: Shows a list of the uplink bridges. show_interfaces: Shows a list of host physical interfaces. show_uplinks: Shows the current uplink configuration for the OVS bridge. update_uplinks: Updates the uplink configuration for the OVS bridge. enable_bridge_chain: Enables bridge chaining on the host. disable_bridge_chain: Disables bridge chaining on the host. create_single_bridge: Adds one OVS bridge to the host. delete_single_bridge: Removes one OVS bridge from the host. The update_uplinks action requires the --interfaces flag, which indicates the desired set of uplinks for the OVS bridge. The script will remove any existing uplinks from the bridge, and replace them with the specified set of uplinks on a single bonded port. flags: /usr/local/nutanix/cluster/bin/manage_ovs: --bond_mode: Bond mode to use: active-backup, balance-slb, or balance-tcp (default: 'active-backup') --bond_name: Bond name to use --bridge_name: Openvswitch on which to operate (default: '') --[no]dry_run: Just print what would be done instead of doing it (default: 'false') --[no]enable_vlan_splinters: Enable VLAN splintering on uplink interfaces (default: 'true') --[no]force: Reconfigure the bridge even if the the set of uplinks has not changed (default: 'false') -?,--[no]help: show this help --[no]helpshort: show usage only for this module --[no]helpxml: like --help, but generates XML output --host: Host on which to operate (default: '192.168.5.1') --interfaces: Comma-delimited list of interfaces to configure as bridge uplinks, or a keyword based on the NIC speed: all, 100g, 40g, 10g, 1g, etc. --[no]json: Output in json format. (default: 'false') --lacp_fallback: If LACP negotiation fails, set the bond_mode to active-backup: true, false (default: 'true') --lacp_mode: LACP mode for the uplink bond: off, slow, or fast (default: 'off') --mtu: Maximum transmission unit (an integer) --num_arps: Number of gratuitous ARPs to send on the bridge interface after updating uplinks (default: '3') (an integer) --[no]prevent_network_loop: Enables network loop prevention when bridge chain is enabled. (default: 'false') --[no]require_link: Require that at least one uplink has link status (default: 'true')
   
  nutanix@cvm$ manage_ovs --helpshort USAGE: manage_ovs [flags] Where is one of the following: show_bridges: Shows a list of the uplink bridges. show_interfaces: Shows a list of host physical interfaces. show_uplinks: Shows the current uplink configuration for the OVS bridge. update_uplinks: Updates the uplink configuration for the OVS bridge. enable_bridge_chain: Enables bridge chaining on the host. disable_bridge_chain: Disables bridge chaining on the host. create_single_bridge: Adds one OVS bridge to the host. delete_single_bridge: Removes one OVS bridge from the host. The update_uplinks action requires the --interfaces flag, which indicates the desired set of uplinks for the OVS bridge. The script will remove any existing uplinks from the bridge, and replace them with the specified set of uplinks on a single bonded port. flags: /usr/local/nutanix/cluster/bin/manage_ovs: --bond_mode: Bond mode to use: active-backup, balance-slb, or balance-tcp (default: 'active-backup') --bond_name: Bond name to use --bridge_name: Openvswitch on which to operate (default: '') --[no]dry_run: Just print what would be done instead of doing it (default: 'false') --[no]enable_vlan_splinters: Enable VLAN splintering on uplink interfaces (default: 'true') --[no]force: Reconfigure the bridge even if the the set of uplinks has not changed (default: 'false') -?,--[no]help: show this help --[no]helpshort: show usage only for this module --[no]helpxml: like --help, but generates XML output --host: Host on which to operate (default: '192.168.5.1') --interfaces: Comma-delimited list of interfaces to configure as bridge uplinks, or a keyword based on the NIC speed: all, 100g, 40g, 10g, 1g, etc. --[no]json: Output in json format. (default: 'false') --lacp_fallback: If LACP negotiation fails, set the bond_mode to active-backup: true, false (default: 'true') --lacp_mode: LACP mode for the uplink bond: off, slow, or fast (default: 'off') --mtu: Maximum transmission unit (an integer) --num_arps: Number of gratuitous ARPs to send on the bridge interface after updating uplinks (default: '3') (an integer) --[no]prevent_network_loop: Enables network loop prevention when bridge chain is enabled. (default: 'false') --[no]require_link: Require that at least one uplink has link status (default: 'true')
 

AOS 5.19 或更高版本

可以使用 Prism Element 或 Prism Central UI 管理主机网络配置。 有关虚拟交换机的更多信息,请参阅关于虚拟交换机一章。有关如何管理虚拟交换机的信息,请参阅创建或更新虚拟交换机一章。
[回到顶部]

附加信息

添加或删除 CVM 和 AHV 主机的 VLAN 标签的步骤

通过使用 IPMI 连接到主机并打开远程控制台来执行所有 AHV 主机和 CVM 网络更改。在物理交换机级别进行 VLAN 更改而不按照这些步骤协调主机更改可能会导致 CVM 访问和连接问题,并可能导致 UVM 停机,并且集群在 VLAN 配置完成或任何不匹配得到解决之前无法从 Prism Central 或 Prism Element 访问。建议在维护模式下一次对一个主机/CVM/上行链路绑定/交换机端口执行此类更改,完成单个主机/CVM 并将其重新联机,然后再转到下一个。请参阅KB4639 -如何将 CVM 和主机置于维护模式
另请参阅: AHV 管理指南/ 使用 Open vSwitch 进行第 2 层网络管理/ VLAN 配置

要更改 AHV 主机上的 VLAN,请运行以下命令:

 [root@ahv ~]# ovs-vsctl set port br0 tag=<vlan tag>

注意:请确保您正在更新br0而不是 br0-up 或 bond0 端口。如果 VLAN 分配给 br0-up 或 bond0,则 CVM 和主机可能会失去网络连接。如果 VLAN 分配给 br-up 或 bond0,请运行以下命令将其删除:

 [root@ahv ~]# ovs-vsctl remove port br0-up tag <vlan tag>

使用“ovs-vsctl show”命令验证更改。正确的配置应如下所示:

 [root@ahv ~]# ovs-vsctl show ... Bridge "br0" ... Port "br0-up" Interface "eth2" Interface "eth3" Port "br0" tag: 1234 <<<<< Correct vlan tag location for AHV host Interface "br0" type: internal ...

要更改 CVM 上的 VLAN,请使用要配置的 VLAN 标签(标记为 X)运行以下命令:

 nutanix@cvm$ change_cvm_vlan <vlan tag>

注意:请勿使用 AHV 主机中的 ovs-vsctl 命令来设置 CVM(在 vnet0 上)的 VLAN 标记。相反,请使用 CVM 中的 change_cvm_vlan 命令。

要从 AHV 主机删除 VLAN 标签,请在打开远程控制台后运行以下命令:

 [root@ahv ~]# ovs-vsctl set port br0 tag=0

要从 CVM 中删除 VLAN 标记,请按照以下步骤操作:

  • 通过远程控制台登录 AHV 主机
  • 从主机 SSH 到 CVM(始终 SSH 到 192.168.5.254 地址):
     [root@ahv ~]# ssh nutanix@192.168.5.254
  • 在云服务器执行以下命令:
     nutanix@cvm$ change_cvm_vlan --remove

[回到顶部]

LACP 配置

按照KB-3263了解如何在 AHV 中启用、禁用和验证 LACP。

如何查找主机网卡的 MAC 地址

  • 在 AHV 主机上执行以下命令:
 [root@ahv ~]# ethtool -P <interface>

示例输出:

 [root@ahv ~]# ethtool -P eth3 Permanent address: 00:25:90:cb:39:27
  • 在 AHV 主机上执行以下命令:
 [root@ahv ~]# ifconfig <interface>

示例输出:

 [root@ahv ~]# ifconfig eth3 eth3 Link encap:Ethernet HWaddr 00:25:90:CB:39:27 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:46857327754 errors:0 dropped:228250 overruns:0 frame:0 TX packets:49134503170 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:49893674683483 (45.3 TiB) TX bytes:54855610562476 (49.8 TiB)


[回到顶部]

如何在主动备份绑定模式下选择主动网卡

默认情况下,在启动时,AHV 会随机选择绑定的其中一个 NIC 并将其激活。所有其他 NIC 都被分配了备份角色,并且只有在活动 NIC 发生故障时才会激活它们。
如果要设置首选 NIC 作为主 NIC,可以使用以下命令(AOS 5.15.4 及更高版本):

 ovs-vsctl set port other_config:bond-primary= 
  ovs-vsctl set port other_config:bond-primary=
   
  ovs-vsctl set port other_config:bond-primary=
 

例如:

 ovs-vsctl set port br0-up other_config:bond-primary=eth2

要检查哪个 NIC 处于活动状态和/或首选状态,请连接到 AHV 主机并运行以下命令:

 [root@ahv ~]# ovs-appctl bond/show

在命令输出中,活动接口将被标记为活动从属。在下面的示例中,eth3 是 br0-up 绑定中的活动接口:

 [root@ahv ~]# ovs-appctl bond/show ---- br0-up ---- bond_mode: active-backup active-backup primary: eth2 ... slave eth2: enabled may_enable: true slave eth3: enabled active slave may_enable: true

要更改活动 NIC,请连接到 AHV 主机并运行以下命令:

 [root@ahv ~]# ovs-appctl bond/set-active-slave <bond name> <interface name>

例子:

 [root@ahv ~]# ovs-appctl bond/set-active-slave br0-up eth2 done

现在,当你检查 bond/show 输出时,你可以看到 eth2 接口作为活动从属接口出现:

例子:

 [root@ahv ~]# ovs-appctl bond/show ---- br0-up ---- bond_mode: active-backup ... slave eth2: enabled        active slave        may_enable: true slave eth3: enabled        may_enable: true

[回到顶部]

将 1G 接口与 10G 接口分开绑定

查看KB 8835了解工作流程的详细描述。
[回到顶部]

具有单个上行链路的桥接器

查看KB 8015了解工作流程的详细描述。
[回到顶部]

已知的问题

症状: manage_ovs 失败,出现“ovs-vsctl:未找到”错误:

 CRITICAL manage_ovs:166 Failed to execute ovs command: list-br ... stderr: sh: ovs-vsctl: not found ...

解决方法:确保底层虚拟机管理程序是 AHV。如果使用其他虚拟机管理程序,请参阅其供应商的文档,了解如何从命令行管理网络。

症状:当尝试创建额外的网桥时,manage_ovs 失败并出现“群集 ARP 和 DHCP IP 未初始化。”错误:

 2019-10-24 01:55:57 ERROR manage_ovs:602 OVS error (192.168.5.1 create_single_bridge): Cluster ARP and DHCP ip not initialized.

解决方案:确保添加网桥的节点是现有集群的一部分。manage_ovs 不支持在未加入集群的节点上创建新网桥。
[回到顶部]

相关文章

文件ID:HT516499
初始发布日期:05/17/2024
最近修改日期:05/30/2024