Search for:

Available article translations:

How to create a container attached to two different networks

Article ID: 112961, created on Dec 7, 2011, last review on Aug 15, 2014

  • Virtuozzo
  • Virtuozzo containers for Linux
  • Virtuozzo hypervisor


This article explains how to assign a container with two NICs attached to different networks.

This configuration is required in cases where a container needs to have separate private and public network access with appropriate routing rules, e.g., when FrontNet is used for external access and BackNet is used for internal traffic.


The example below illustrates how to connect a container to bridged FrontNet and BackNet networks:

  1. Create two bridged networks:

    ~# vznetcfg net new FrontNet
    ~# vznetcfg net new BackNet
  2. Find out which hardware NIC corresponds to which network:

    ~# ip a l
    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 scope host lo
            valid_lft forever preferred_lft forever
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 48:5b:39:19:6d:66 brd ff:ff:ff:ff:ff:ff
        inet brd scope global eth0
            valid_lft forever preferred_lft forever
    3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 48:5b:39:19:6d:68 brd ff:ff:ff:ff:ff:ff
        inet brd scope global eth1
            valid_lft forever preferred_lft forever
  3. Assign network interfaces to the virtual networks:

    ~# vznetcfg net addif FrontNet eth1
    ~# vznetcfg net addif BackNet eth0
  4. Add two network interfaces to the container:

    ~# vzctl set CTID --save --netif_add eth0
    ~# vzctl set CTID --save --netif_add eth1
  5. Assign them to the corresponding networks and configure the virtual adapters:

    ~# vzctl set CTID --save --ifname eth0 --network BackNet --ipadd --gw
    ~# vzctl set CTID --save --ifname eth1 --network FrontNet --ipadd

NOTE: The "--gw" option specifies the default gateway setting, therefore it should be set only for one adapter. Set the most preferable route according to your needs.

For more information, refer to Parallels Virtuozzo Containers User's Guide, pages 210-238.

Search words:


two adapters

pcs: networking

Virtual network

e8e50b42231236b82df27684e7ec0beb d02f9caf3e11b191a38179103495106f 2897d76d56d2010f4e3a28f864d69223 0dd5b9380c7d4884d77587f3eb0fa8ef a26b38f94253cdfbf1028d72cf3a498b

Was this article helpful?
Tell us how we may improve it.
Yes No
Server Virtualization
- Odin Cloud Server
- Odin Containers for Windows 6.0
- Odin Virtuozzo Containers
- Odin Automation
- Odin Automation for Cloud Infrastructure
- Odin Business Automation Standard
- Odin Virtual Automation
- Odin Plesk Panel Suite
- Web Presence Builder
- Odin Plesk Automation
- Odin Small Business Panel
- Value-added Services for Hosters
- Odin Partner Storefront
Services & Resources
- Cloud Acceleration Services
- Professional Services
- Support Services
- Training & Certification