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

  • Parallels Cloud Server
  • Parallels Virtuozzo Containers for Linux
  • Parallels Server


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

eb0ea3b827d18de2329b6477e24c1d59 909d99074e442b52ce54cc7b31cf065d 2897d76d56d2010f4e3a28f864d69223 bf1c3a170005eae151f49ba2720abde9 ca05eaf5b843fbd53589c90d7228a6df

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