> For the complete documentation index, see [llms.txt](https://jncia-workbook.gitbook.io/workbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jncia-workbook.gitbook.io/workbook/junos-switching/5-irb.md).

# 5) IRB

### Pre-Work

Load the config called **lab4.cfg** using the **load\_config\_on\_nodes.py** script.

```
python3 load_config_on_nodes.py --lab_dir switched-lan --config_filename lab4.cfg
```

### Lab

Labs 1-3 are already pre-configured.&#x20;

Instead of using R1 as the default gateway, configure SW1 as the default gateway using IRBs.

* VLAN 100 - `10.0.100.1/24` and `2001:db8:100::1/64`
* VLAN 200 - `10.0.200.1/24` and `2001:db8:200::1/64`

Note that you may need to clear arp from HOST-RTR:

```
clear arp all
```

### Answer

<details>

<summary>Expand to reveal</summary>

```
set interfaces irb.100 family inet address 10.0.100.1/24
set interfaces irb.100 family inet6 address 2001:db8:100::1/64
set interfaces irb.200 family inet address 10.0.200.1/24
set interfaces irb.200 family inet6 address 2001:db8:200::1/64
set vlans PROD l3-interface irb.100
set vlans DEV l3-interface irb.200
```

</details>

### Explanation

<details>

<summary>Expand to reveal</summary>

IRB stands for integrated routing and bridging. IOS calls this SVI (switched virtual interface), and IOS-XR calls this BVI (bridged virtual interface). The concept is that the switch can perform layer 3 routing by having a virtual interface within the VLAN.

\
On Junos, you have one single irb interface, with a logical unit per VLAN.

```
set interfaces irb.100 family inet address 10.0.100.1/24
set interfaces irb.100 family inet6 address 2001:db8:100::1/64
set interfaces irb.200 family inet address 10.0.200.1/24
set interfaces irb.200 family inet6 address 2001:db8:200::1/64
```

\
We must add the irb logical interface to the VLAN using `set vlans <name> l3-interface irb.<unit>`:

```
set vlans PROD l3-interface irb.100
set vlans DEV l3-interface irb.200
```

\
We can see the irb interfaces listed under `show interfaces`:

```
admin@SW1> show interfaces terse irb 
Interface               Admin Link Proto    Local                 Remote
irb                     up    up
irb.100                 up    up   inet     10.0.100.1/24   
                                   inet6    2001:db8:100::1/64
                                            fe80::2e6b:f500:645d:cdf0/64
                                   multiservice
irb.200                 up    up   inet     10.0.200.1/24   
                                   inet6    2001:db8:200::1/64
                                            fe80::2e6b:f500:c85d:cdf0/64
                                   multiservice
```

\
When we look at the `show vlans` output, we will not see the IRB interface:

```
admin@SW1> show vlans 

Routing instance        VLAN name             Tag          Interfaces
default-switch          DEV                   200      
                                                           ae1.0*
                                                           ge-0/0/2.0*
                                                           ge-0/0/3.0*
default-switch          PROD                  100      
                                                           ae1.0*
                                                           ge-0/0/2.0*
                                                           ge-0/0/3.0*
default-switch          default               1        
```

\
However, `show vlans detail` does list the irb interface as the `l3-interface`:

```
admin@SW1> show vlans detail 

Routing instance: default-switch
VLAN Name: DEV                            State: Active
Tag: 200                                
Internal index: 3, Generation Index: 2, Origin: Static
Mac aging: Enabled
MAC aging time: 300 seconds
Layer 3 interface: irb.200  <--------------------------
Mac-IP-Snooping Enabled : No
VXLAN Enabled : No  
Interfaces:
    ae1.0*,tagged,trunk
    ge-0/0/2.0*,tagged,trunk
    ge-0/0/3.0*,tagged,trunk
Number of interfaces: Tagged 3    , Untagged 0    
Total MAC count: 2 

Routing instance: default-switch
VLAN Name: PROD                           State: Active
Tag: 100                                
Internal index: 4, Generation Index: 3, Origin: Static
Mac aging: Enabled
MAC aging time: 300 seconds
Layer 3 interface: irb.100  <--------------------------
Mac-IP-Snooping Enabled : No
VXLAN Enabled : No  
Interfaces:
    ae1.0*,tagged,trunk
    ge-0/0/2.0*,tagged,trunk
    ge-0/0/3.0*,tagged,trunk
Number of interfaces: Tagged 3    , Untagged 0    
Total MAC count: 2 

Routing instance: default-switch
VLAN Name: default                        State: Active
Tag: 1                                  
Internal index: 2, Generation Index: 1, Origin: Static
Mac aging: Enabled
MAC aging time: 300 seconds
Mac-IP-Snooping Enabled : No
VXLAN Enabled : No  
Number of interfaces: Tagged 0    , Untagged 0    
Total MAC count: 0 
```

\
Host1 can ping Host3 in another VLAN:

```
admin@HOST-RTR> ping 10.0.200.104 routing-instance host1 
PING 10.0.200.104 (10.0.200.104): 56 data bytes
64 bytes from 10.0.200.104: icmp_seq=0 ttl=63 time=3.819 ms
64 bytes from 10.0.200.104: icmp_seq=1 ttl=63 time=3.843 ms

admin@HOST-RTR> ping 2001:db8:200::104 routing-instance host1 
PING6(56=40+8+8 bytes) 2001:db8:100::101 --> 2001:db8:200::104
16 bytes from 2001:db8:200::104, icmp_seq=0 hlim=63 time=1874.741 ms
16 bytes from 2001:db8:200::104, icmp_seq=2 hlim=63 time=3.793 ms
16 bytes from 2001:db8:200::104, icmp_seq=3 hlim=63 time=4.019 ms

```

\
We can see the ARP and ND tables popoulated on SW1:

```
admin@SW1> show arp 
MAC Address       Address         Name                      Interface               Flags
52:55:0a:00:00:02 10.0.0.2        10.0.0.2                  fxp0.0                  none
aa:c1:ab:c1:75:ad 10.0.100.101    10.0.100.101              irb.100 [ge-0/0/2.0]    none
aa:c1:ab:fd:25:4d 10.0.100.103    10.0.100.103              irb.100 [ge-0/0/3.0]    none
aa:c1:ab:93:18:a7 10.0.200.102    10.0.200.102              irb.200 [ge-0/0/2.0]    none
aa:c1:ab:21:93:2d 10.0.200.104    10.0.200.104              irb.200 [ge-0/0/3.0]    none
02:00:00:00:00:10 128.0.0.16      fpc0                      em1.0                   none
Total entries: 6

admin@SW1> show ipv6 neighbors 
IPv6 Address                            Linklayer Address  State       Exp   Rtr  Secure  Interface               
2001:db8::1                              none               unreachable  3    no   no      fxp0.0                  
2001:db8:100::101                        aa:c1:ab:c1:75:ad  stale       1199  yes  no      irb.100 [ge-0/0/2.0]    
2001:db8:200::104                        aa:c1:ab:21:93:2d  reachable   7     yes  no      irb.200 [ge-0/0/3.0]    
fe80::2                                  52:56:00:00:00:02  stale       1166  yes  no      fxp0.0                  
fe80::a8c1:abff:fe21:932d                aa:c1:ab:21:93:2d  stale       1173  no   no      irb.200 [ge-0/0/3.0]    
fe80::a8c1:abff:fec1:75ad                aa:c1:ab:c1:75:ad  stale       1173  no   no      irb.100 [ge-0/0/2.0]    
Total entries: 6
```

</details>

### Further Reading

<https://www.juniper.net/documentation/us/en/software/junos/multicast-l2/topics/topic-map/irb-and-bridging.html>

<https://www.youtube.com/watch?v=oGtWxnS4S8Q>

<https://www.reddit.com/r/Juniper/comments/m8urie/questions_regarding_irb_interfaces/>
