找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 9330|回复: 0

重装xenserver修改网卡顺序

[复制链接]

16

主题

38

帖子

1014

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1014
发表于 2016-1-25 16:48:48 | 显示全部楼层 |阅读模式
请参考以下步骤:
1.使用xe pif-forget 掉 需要修改的NIC
2.使用xe network-destroy 销毁NIC对应的xenbr接口
3.修改/etc/sysconfig/network-scripts/interface-rename-data下的dynamic-rules.json 文件,对 "lastboot" 下的NIC name进行修改,并注释掉不用的“OLD” 下的NIC;(记得按照dynamic-rules.json文档的网卡名称顺序排序)
4.保存重启xenserver reboot
5.xe pif-scan 扫描NIC
6.xe pif-list检查无误后,网卡这时候未连接,使用ifconfig eth* up 启用修改好的网口。下次重启后网卡连接

具体说明可参考以下kb:
http://support.citrix.com/article/CTX135809







Objective
The previous methods for changing the name/ordering of NICs for a host are no longer valid. The procedure outlined in this article must be followed for a post-installation XenServer 6.1 instance.
The interface-rename is a new utility in XenServer 6.1. This utility allows for granular management of network interface cards to facilitate renaming and reordering of them from the default installed configuration. The interface-rename utility refers to two separate files to determine how to name and order NICs during startup:
/etc/sysconfig/network-scripts/interface-rename-data/dynamic-rules.json
The file dynamic-rules.json, is dynamically populated during boot time and uses low-level hardware information derived from the Linux binary biosdevname to create the association between the NIC hardware and the named device (eth0, for example) in the Linux kernel. If no entries exist in static-rules.conf, then this file uses the NIC hardware information described by the system BIOS.
During execution of interface-rename, the utility refers to and applies the rules in the section of this file with the key namelastboot. A key entry might looks similar to the following:["00:23:7d:54:52:88", # MAC address"0000:41:01.0", # PCI BUS ID"eth0" # Assigned device name]As indicated, the three keys correspond to the NIC’s are:
  • MAC address
  • PCI Bus ID
  • Assigned device name

This file allows interface-rename to intelligently maintain the correct hardware/device name associations even if the underlying hardware configuration changes. If NICs are physically reordered in the host this file would ensure that the same device names (eth0, eth1, ethX) are associated with the respective NIC that had this device name at the last boot of the host. This is necessary for XAPI to operate correctly following a change to the NIC hardware configuration.
/etc/sysconfig/network-scripts/interface-rename-data/static-rules.conf
The file static-rules.conf is referred to when interface-rename executes, and any entries into this file overrides any other NIC configuration information, including the information contained in dynamic-rules.json.
Static rules utilize any of the four different characteristics of the NIC:
- mac: value should be the mac address of a device (e.g. DE:AD:C0E:00:00)- pci: value should be the pci bus location of the device (e.g. 0000:01:01.1)- ppn: value should be the result of the biosdevname physical naming policy of a device (e.g. p1p1)- label: value should be the SMBios label of a device (for SMBios 2.6 or above)
Rules are of the form:
target name: id method = "value"(target name must be in the form eth*)An example rule using the MAC address for the NIC would look similar to the following:eth2: mac = "00:24:81:80:19:63"where, eth2 is the device name that should be statically mapped to NIC with MAC address 00:24:81:80:19:63.
Note: In XenServer 6.0 and 6.0.2, interface-rename has no user interactive capabilities. Therefore, it is necessary to add entries into static-rules.conf to change the order and device assignments for the NICs. In XenServer 6.1 the changes can be made using the interface-rename command. Refer to the next section for instructions on how to reorder NICs using interface-rename.



Instructions
Complete the following procedures:
[url=]Identifying Existing NIC Characteristics[/url]
Before applying any ordering changes, it is necessary to determine the current device assignments for the NICs which need to be reordered.
Run interface-rename --list to get this information:

The preceding is a sample output and note that for each NIC there is assigned a Name which corresponds to the device name mapped to the NIC in the kernel, and an ethN value which corresponds to the device as it is described by the system BIOS.
It is also possible to determine the device’s MAC address, PCI bus ID, Phys (physical) name and SMBios name.
On XenCenter > NIC tab, the information such as the MAC address and PCI bus ID are available:

For the NIC or NICs which need to be reordered, take a note of one of the MAC address, the PCI bus ID, the physical name (Phys) or the SMBios name and proceed to the next section which describes how to change the device name/order for the device.
[url=]Changing NIC Ordering[/url]
IMPORTANT! Before making any ordering changes, the interfaces must be taken offline. Run the command ifconfig ethN down for all interfaces to be modified, where ethN is the device name (for example, eth4). The interfaces comes back online automatically when the host is rebooted.
  • Run the command interface-rename --update to update the NIC order/naming in the following manner: interface-rename --update <target eth name>=MAC|PCI|Phys|"SMBios"
    where, the <target eth name> corresponds to the device that is going to be remapped (example, eth4). It is being mapped using one of either the MAC address, the PCI bus ID, the Phys name or the SMBios name.
  • Considering the output from interface-rename --list as an example, assume the NIC order needs to be changed: Device “eth4” and “eth8” are reordered, the device assigned to “eth4” needs to be reassigned to “eth8”, and “eth8” reassigned to “eth4”.
  • Recall the current configuration for “eth4” and “eth8”:
    Name MAC PCI ethN Phys SMBios eth4 00:24:81:7f:cf:8b 0000:4c:00.0 eth4 eth8 00:24:81:80:19:63 0000:50:00.0 eth8
  • To apply the reordering run the following command:
    interface-rename --update eth4=00:24:81:80:19:63 eth8=00:24:81:7f:cf:8b (to use the PCI bus ID, the Phys name or the SMBios name as the criteria for assigning the device name, simply replace the MAC addresses with one of these other values.)
  • Reboot the host after running interface-rename --update. The changes will not take effect until the host reboots.
  • After the host is rebooted, run the command interface-rename --list again and note the changes in the output:

    ethN (physical) devices “eth4” and “eth8” have now been reassigned as desired.
    The same change can be observed in XenCenter:


[url=]NIC Reordering Impact on Pool Networks[/url]
Reordering physical NICs does NOT reorder the logical networks which are bound to those NICs. In the preceding example, where physical devices eth4 and eth8 were reordered, the logical networks associated with these interfaces were not changed:

Device eth4 (or NIC 4) was reassigned to eth8 (or NIC 8), and eth8 to eth4, however the logical networks ‘Network 4’ and ‘Network 8’ have not swapped but remained mapped to the newly assigned physical devices. Because of this, any virtual machine which was utilizing either ‘Network 4’ or ‘Network 8’ prior to the devices being reordered, is no longer mapping to the same physical interfaces once the host reboots.
If this is unintended, it might be necessary to modify the VMs network configurations to map to the correct NIC after the reordering changes are made.
This can be done by selecting the VM in XenCenter and then making the necessary changes under the ‘Networking’ tab for that VM. If many VMs require the new configuration, this process can be scripted/automated.
[url=]NIC Reordering Impact on Bonds[/url]
Though XenServer does not prevent, NICs that are participating in a bond must NOT be reordered/modified. Modifying NICs can cause unpredictable behavior and/or instability for both the host and the underlying network communications.
Before making any ordering changes the bond must be broken/destroyed. After the changes are applied and the host is rebooted, the bond can then be recreated.



Additional Resources
This article intended to provide instructions for reordering NICs in a post-install XenServer 6.1 scenario. It is also possible to apply ordering rules during installation of XenServer 6.1.
Installer options can be provided which applies dynamic or static rules to interface-rename during installation of XenServer. The options are as follows:
  • map_netdev=ethNs,d):<mapping>
    • ethN indicates the target eth name
    • (s,d) indicates static or dynamic rule
  • <mapping> can be:
    • emN or pciNpM – biosdevname naming label
    • 00:23:7d:54:52:88 – MAC address
    • 0000:01:01.0 – PCI ID
    • “smbios label” – SMBios label

NIC ordering rules are applied for the host when interface-rename command isexecuted.




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表