# Loopback-mode Port

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

As soon as a loopback-mode port is configured, it is internally changed to loopback mode. This means that the link will always be *UP* with or without cables inserted. Traffic flows out of a loopback 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.&#x20;

  &#x20;  \- For example, Decap the tunnel and look up based on the inner header&#x20;
* Multiple egress actions on the same traffic.&#x20;

  &#x20;  \- For example, send to tool as-is and add a VLAN tag

The following image shows a visual representation of the loopback-mode port:

<figure><img src="https://content.gitbook.com/content/moNcceKhbbta4BgME4L5/blobs/rfE3M0XxC8zwmz5sCXJF/Screenshot%202022-09-26%20at%2011.58.01%20AM.png" alt=""><figcaption><p>Loopback Mode Port</p></figcaption></figure>

### Configuration:

*1. Configure Network/Tool port(s)*

```
//Tool ports
configure terminal
interface ethernet Ethernet16/1
forward-error-correction rs
type tool
end
```

```
//Network ports
configure terminal
interface ethernet Ethernet12/1
forward-error-correction rs
type network
end
```

2\. *Configure the port as Loopback-mode*

```
configure terminal
interface ethernet Ethernet20/1
loopback-mode
end
```

3\. Configure Flow from Network to Loopback port

```
configure terminal
flow flow1
network-ports Ethernet12/1
tool-ports Ethernet20/1
rule 1 permit match-all counters enable
end
```

4\. Configure Flow from Loopback to Tool port

```
configure terminal
flow flow2
network-ports Ethernet20/1
tool-ports Ethernet16/1
rule 1 permit src-ip 1.1.1.1/32 dest-ip 5.5.5.5/32 counters enable
end
```

5\. Verify

```
// verify interface
pbnoscli# show interface status 
================================================================================================
Port              Name                            Oper    Admin   Vlan    Speed   MTU     AutoNeg 
================================================================================================
Ethernet1/1       etp1                            down    up              100000  9100    on      
Ethernet2/1       etp2                            down    up              100000  9100    on      
Ethernet3/1       etp3                            down    up              100000  9100    on      
Ethernet4/1       etp4                            up      up              25000   9100    on      
Ethernet5/1       etp5                            up      up              25000   9100    on      
Ethernet6/1       etp6                            up      up              100000  9100    on      
<..>
Ethernet63/1      etp21                           down    up              100000  9100    on      
Ethernet64/1      etp22                           down    up              100000  9100    on      
pbnoscli# 

```

```
// verify loopback-mode port
pbnoscli# show interface npb Ethernet20/1
===================================
Interface : Ethernet20/1      
===================================
Mode           : vlan-aware      
Ingress-vlan   : 22              
Egress-tagging : disable         
Loopback-mode  : enable          

pbnoscli# 
```

{% hint style="info" %}
Loopback-mode(i.e. Ethernet20/1) port will always be UP
{% endhint %}

```
// verify flow
pbnoscli# show flow summary 
Flow-Name       Rule-Id        Status      Counter-Value
=========================================================
flow1           1             Active          11592               
flow2           1             Active          590            
pbnoscli# 
```
