Article ID: 120507, created on Mar 12, 2014, last review on May 11, 2014

  • Applies to:
  • Virtuozzo containers for Windows 4.6

Question

How to change the preferred virtual network adapter for containers with multiple networks?

Answer

Starting from PVC4.6 --preffered-adapter option is not supported.

Use native Windows tools to set interfaces metrics.

There are two possible ways:

  • Create or modify InterfaceMetric REG_DWORD registry key in HKEY_LOCAL_MACHINE\_vzCTID_\MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\GUID\
    • requires CT restart to apply.
  • Or execute: vzctl exec CTID netsh interface ipv4 set interface "venetX" metric=XX
    • takes effect immediately.

NOTE CTID should be replaced with actual container number, venetX with the actual name of the network interface, XX with desired metric value.

Use the following command to obtain the name of a network interface:

 vzctl exec netsh interface ipv4 show address 

 Configuration for interface "venet0"
    DHCP enabled: No 
    IP Address: 10.124.45.151
    Subnet Prefix: 10.124.45.0/24 (mask 255.255.255.0) 
    Default Gateway: ♣ 
    Gateway Metric: 256 
    InterfaceMetric: 10 

Configuration for interface "venet1" 
    DHCP enabled: No 
    IP Address: 69.195.252.24 
    Subnet Prefix: 69.195.252.0/26 (mask 255.255.255.192) 
    Default Gateway: 69.195.252.62 
    Gateway Metric: 256 
    InterfaceMetric: 10 

Configuration for interface "Loopback Pseudo-Interface 1" 
    DHCP enabled: No 
    IP Address: 127.0.0.1 
    Subnet Prefix: 127.0.0.0/8 (mask 255.0.0.0) 
    InterfaceMetric: 50 

The smaller metric value leads to higher priority of the interface and its routes.

Information Sources:

How to change the binding order of network adapters

Netsh commands for Interface Internet Protocol version 4 (IPv4)

Search Words

PG Server has issues when trying to use internet with browsers like IE

Issue related with case 1863460

6c20476fe6c3408461ce38cbcab6d03b 2897d76d56d2010f4e3a28f864d69223 d02f9caf3e11b191a38179103495106f 965b49118115a610e93635d21c5694a8

Email subscription for changes to this article
Save as PDF