Support Support Downloads Knowledge Base Juniper Support Portal Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

[Contrail] How to start a tmux session in Contrail



Article ID: KB37199 KB Last Updated: 14 Jul 2021Version: 1.0

In many Contrail setups today, in order to log in to a Contrail node (for example a controller node or a compute node), you need to first log in to an intermediate host to prepare the login environment, and from there you may need to log in to another server (for example an undercloud server). Only after that can you log in to a target Contrail node.

Repeating these steps each time just to log in to multiple Contrail nodes in a cluster is tedious and inefficient. However, there are many tools that can be used to simplify this process, such as the open source tool tmux. Tmux is a lightweight and powerful screen multiplexer tool that is typically used for this very scenario.

In this article, we demonstrate how to initiate a tmux session in Contrail environments.


Before starting tmux, execute the following steps:

  1. Log in to the RHOST13 host (the first SSH session).

  2. SSH into the undercloud server (the second SSH session).

  3. Source the stackrc environmental file.

  4. Type "openstack server list" to list all Contrail nodes.

  5. Type "tmux ls" to list existing tmux sessions. This is also to make sure that tmux is available.

  6. Type "tmux new -s jtac" to start a (new) tmux session named "jtac" in the undercloud server.

  7. SSH into any of the Contrail nodes (the third SSH session).

Some example outputs in the lab environment are given as follows:

$ ssh
Last login: Sat Jun 12 18:55:22 2021 from

[root@global-intel4 ~]# ssh stack@undercloud
Last login: Sat Jun 12 21:55:31 2021 from

[stack@queensa ~]$ source stackrc
(undercloud) [stack@queensa ~]$ openstack server list
| ID                                   | Name                           | Status | Networks               | Image          | Flavor              |
| 30ebd697-c756-4ee4-a09c-dec1eb37fd50 | overcloud-contrailcontroller-0 | ACTIVE | ctlplane= | overcloud-full | contrail-controller |
| 1b7f2838-f950-4ae1-885e-d111a9c673be | overcloud-novacompute-0        | ACTIVE | ctlplane=  | overcloud-full | compute             |
| 74280d13-99d6-47fa-94fd-953eaf22ef0f | overcloud-contrailcontroller-1 | ACTIVE | ctlplane= | overcloud-full | contrail-controller |
| a65e70c7-ef77-4cc3-864b-1989302aa28f | overcloud-controller-0         | ACTIVE | ctlplane= | overcloud-full | control             |
| ef531c6b-5773-4973-a302-1082279db354 | overcloud-contrailcontroller-2 | ACTIVE | ctlplane= | overcloud-full | contrail-controller |

(undercloud) [stack@queensa ~]$ tmux -V
tmux 1.8
(undercloud) [stack@queensa ~]$ tmux ls
(undercloud) [stack@queensa ~]$

From the undercloud server, Contrail nodes can be listed with the openstack server list command. From the output, you see five nodes:

  • Contrail Controller0 (cc0)
  • Contrail Controller1 (cc1)
  • Contrail Controller2 (cc2)
  • Contrail Compute0    (cp0)
  • Openstack Controller (oc0)

If the Contrail nodes are listed and tmux prints the version, you are ready to start the tmux session.

  1. Now start a tmux session:

(undercloud) [stack@queensa ~]$ tmux new -s jtac

From this time on, you are working in a tmux session. 


  1. Inside the tmux session, you can proceed with the Contrail login process, which is to start an SSH session (the third) toward a Contrail node.

In this article, you will log in to the first Contrail node "cc0," as shown below:

(undercloud) [stack@queensa ~]$ ssh heat-admin@
Last login: Sun Jun 13 02:09:31 2021 from
[heat-admin@overcloud-contrailcontroller-0 ~]$ sudo -i

[root@overcloud-contrailcontroller-0 ~]# docker ps | head | less -XES

One well-known benefit of running login sessions in tmux is that even when a login session to the remote server gets lost, all sessions started on the remote server within tmux will persist. In this case, assume that you are experiencing some temporary Internet issues, and the first SSH session toward the RHOST13 host gets lost. Naturally the second SSH session from the RHOST13 host to the undercloud server will be disconnected too. However, the third SSH session initiated from the undercloud server to the target Contrail node will remain up and connected.

When you reconnect, you only need to rebuild the first and second SSH sessions, and then you can "attach" the target session with tmux again. This usage case is demonstrated with a detailed example in KB37201- [Contrail] How to detach and reattach a tmux session in Contrail.

Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search