# Configuring Loopback Mode

Loopback-mode means that a physical port can become network-port (ingress) and tool-port(egress) to which flow rules can be applied. A loopback-mode port is operated in loopback mode and avoids customers connecting a physical cable to make it operate in Loopback mode.

As soon as a port is configured as a loopback-mode port, it is internally changed to a loopback mode state. This means that the link is UP with or without cables being inserted. Traffic flows out of a loopback-mode port (Tx direction) and loops back to it (Rx direction).&#x20;

loopback-mode ports can provide the following flexibility:

* Support for multiple lookups on the same packet. For example, decapsulate the tunnel and look up based on the inner header.
* Multiple egress actions on the same traffic. For example (shown here) send to tool as-is and add VLAN tag.

The following command is used to configure the interface to work as both network-port and tool-port. When enabled on an interface, it acts like a mac loopback which loops back the egress packets back to the device on the same port.

<figure><img src="https://2662483853-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhNXO6wTLpx5wBGAVjtJV%2Fuploads%2Fo3lWKhUYfOCco14xmlHt%2FScreenshot%202022-09-26%20at%2011.58.01%20AM.png?alt=media&#x26;token=d54bf522-eac4-46bc-83af-f807452f138d" alt=""><figcaption><p>Loopback Mode Port</p></figcaption></figure>

#### Reference

<table data-header-hidden><thead><tr><th></th><th></th><th data-hidden></th></tr></thead><tbody><tr><td>Command</td><td>loopback-mode<br>no loopback-mode</td><td></td></tr><tr><td>Description</td><td>Activation loopback mode</td><td></td></tr><tr><td>Parameters</td><td>None</td><td></td></tr><tr><td>Mode</td><td>INTERFACE</td><td></td></tr></tbody></table>

#### Example

```
pbnoscli# configure terminal 
pbnoscli(config)# interface ethernet Ethernet4/1
pbnoscli(config-if)# loopback      
  loopback-mode         Activate loopback mode
pbnoscli(config-if)# loopback-mode 
pbnoscli(config-if)# 
```

You can verify the configuration by using the command(s) below:

```
pbnoscli# show interface npb Ethernet4/1
===================================
Interface : Ethernet4/1      
===================================
Mode           : vlan-aware      
Ingress-vlan   : 6              
Egress-tagging : disable         
Loopback-mode  : enable          

pbnoscli# 
```

```
pbnoscli# show running-config 
configure terminal
!
interface ethernet Ethernet4/1
speed 1000
description interface description
mode vlan-aware
loopback-mode
!
interface mgmt
ip address 10.4.4.53/23 gateway 10.4.4.1
!
pbnoscli# 
```
