Article ID: 119134, created on Dec 12, 2013, last review on May 9, 2014

  • Applies to:
  • Virtuozzo
  • Virtuozzo containers for Linux
  • Virtuozzo hypervisor

Question

When I execute vzlist command it displays the internal IP address(10.39.97.97) instead of the public one (217.100.101.102) for a container with 2 addresses.

[root@PCS ~]# vzlist 100100
      CTID      NPROC STATUS    IP_ADDR         HOSTNAME
    100100         19 running   10.39.97.97     ipdisplaytest

[root@PCS ~]# vzctl exec 100100 ip addr list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
    link/void
    inet 127.0.0.1/32 scope host venet0
    inet 10.39.97.97/16 brd 10.39.255.255 scope global venet0:0
    inet 217.100.101.102/32 brd 217.100.101.102 scope global venet0:1

Why is that happening?

Answer

There is no mechanism in Parallels Virtuozzo Containers for Linux (and Parallels Cloud Server) to distinguish an internal IP from a public IP.

vzlist always displays IP addresses in the same order they are added inside of the container after its start, the same order reported by ip addr list command. To list all the IP addresses assigned to a container you should specify ip option for vzlist

[root@PCS ~]# vzlist -o ip 100100
IP_ADDR
10.39.97.97 217.100.101.102

Note: execute vzlist -L to see all available display options

If both IP addresses are assigned to a Host-Routed interface you may change the order of IP addresses manually in the configuration file, or by deleting the IP addresses from a container with vzctl and adding them back in the desired order.

NOTE: Due to the product design, a Host-Routed interface will always be added to a container prior to a Bridged interface, therefore there is no way to display the Bridged adapter's IP address prior to the Host-Routed adapter's address.

A real-life example:

Container 100100 has 2 IP addresses:

[root@PCS ~]# vzlist -o ip 100100
IP_ADDR
10.39.97.97 217.100.101.102 

In the vzlist output the internal IP (10.39.97.97) is displayed:

[root@PCS ~]# vzlist 100100
      CTID      NPROC STATUS    IP_ADDR         HOSTNAME
    100100         19 running   10.39.97.97     ipdisplaytest

To force displaying the public IP (217.100.101.102) instead, you may re-add the internal IP, it will make the public IP become the first in a row:

[root@PCS ~]# vzctl set 100100 --ipdel 10.39.97.97 --ipadd 10.39.97.97/16 --save
Saved parameters for Container 100100
[root@PCS ~]# vzlist 100100
      CTID      NPROC STATUS    IP_ADDR         HOSTNAME
    100100         19 running   217.100.101.102 ipdisplaytest

Search Words

frontnet

vzlist -o

IP_ADDR

vzlist

internal ip

public ip

ip address order

backnet

a26b38f94253cdfbf1028d72cf3a498b 2897d76d56d2010f4e3a28f864d69223 d02f9caf3e11b191a38179103495106f e8e50b42231236b82df27684e7ec0beb 0dd5b9380c7d4884d77587f3eb0fa8ef

Email subscription for changes to this article
Save as PDF