> 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/6-multiple-access-ports.md).

# 6) Multiple Access Ports

### Pre-Work

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

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

### Lab

<figure><img src="/files/90MyisfqIY2VaI7h2qWT" alt=""><figcaption></figcaption></figure>

Configure SW2 as follows:

* Configure VLAN 100 with name `PROD`
* All ports `ge-0/0/2`, and `ge-0/0/4` through `ge-0/0/8` should belong to VLAN 100
  * Use a method that allows you to assign a range of ports to a VLAN
* These ports should also be RSTP edge ports

### Answer

<details>

<summary>Expand to reveal</summary>

```
set vlans PROD vlan-id 100
set interfaces interface-range IF-RANGE-VL100 member ge-0/0/2
set interfaces interface-range IF-RANGE-VL100 member-range ge-0/0/4 to ge-0/0/8
set interfaces interface-range IF-RANGE-VL100 unit 0 family ethernet-switching vlan members PROD
set protocols rstp interface IF-RANGE-VL100 edge
```

</details>

### Explanation

<details>

<summary>Expand to reveal</summary>

In the real world, you likely would not configure individual switchports one-by-one. Instead, you would use an `interface-range` to automatically configure a group of ports that all have the same config.

\
Using an interface-range keeps the configuration very minimal. Below you can see that the only things defined under the `interfaces` configuration is the interface-range and the mgmt interface (fxp0). The `interface-range` is configured just like a normal interface. You assign a logical `unit 0` as normal. The only difference is the `member` and `member-range` statements. Use `member` to assign one single port, and `member-range` to assign a group of ports. You can have multiple `member` and `member-range` statements on the same interface-range.

```
admin@SW2> show configuration interfaces 
interface-range IF-RANGE-VL100 {
    member ge-0/0/2;
    member-range ge-0/0/4 to ge-0/0/8;
    unit 0 {
        family ethernet-switching {
            vlan {
                members PROD;
            }
        }
    }
}
fxp0 {
    unit 0 {
        family inet {
            address 10.0.0.15/24;
        }
        family inet6 {
            address 2001:db8::2/64;
        }
    }
}

admin@SW2> 
```

\
Just like a normal interface, the interface-range can be used in protocol config, for example in RSTP. You use the name of the interface-range to refer to it, as if it was a physical interface.

```
set protocols rstp interface IF-RANGE-VL100 edge
```

\
If we look at the `ge` interfaces, we should see that they have "inherited" the logical unit 0 and eth-switch protocol from the interface-range.

```
admin@SW2> show interfaces terse | match "ge-0/0|Interface" 
Interface               Admin Link Proto    Local                 Remote
ge-0/0/0                up    up
ge-0/0/0.16386          up    up  
ge-0/0/1                up    up
ge-0/0/1.16386          up    up  
ge-0/0/2                up    up
ge-0/0/2.0              up    up   eth-switch
ge-0/0/3                up    up
ge-0/0/3.16386          up    up  
ge-0/0/4                up    down
ge-0/0/4.0              up    down eth-switch
ge-0/0/5                up    down
ge-0/0/5.0              up    down eth-switch
ge-0/0/6                up    down
ge-0/0/6.0              up    down eth-switch
ge-0/0/7                up    down
ge-0/0/7.0              up    down eth-switch
ge-0/0/8                up    down
ge-0/0/8.0              up    down eth-switch
```

\
The interfaces are also listed in the `show vlans` output. Remember that the `*` symbol means the port is up. In our lab, `ge-0/0/4` through `ge-0/0/8` are not "wired up."

```
admin@SW2> show vlans 

Routing instance        VLAN name             Tag          Interfaces
default-switch          PROD                  100      
                                                           ge-0/0/2.0*
                                                           ge-0/0/4.0
                                                           ge-0/0/5.0
                                                           ge-0/0/6.0
                                                           ge-0/0/7.0
                                                           ge-0/0/8.0
default-switch          default               1        
```

\
We should see that the ports are also RSTP edge ports.

```
admin@SW2> show spanning-tree interface detail | match "Interface name|Link type" 
Interface name                 : ge-0/0/2
Link type                      : Pt-Pt/EDGE
Interface name                 : ge-0/0/4
Link type                      : Pt-Pt/EDGE
Interface name                 : ge-0/0/5
Link type                      : Pt-Pt/EDGE
Interface name                 : ge-0/0/6
Link type                      : Pt-Pt/EDGE
Interface name                 : ge-0/0/7
Link type                      : Pt-Pt/EDGE
Interface name                 : ge-0/0/8
Link type                      : Pt-Pt/EDGE
```

</details>

### Further Reading

<https://www.juniper.net/documentation/us/en/software/junos/interfaces-fundamentals/topics/task/interfaces-interface-ranges-multi-task.html>

<https://www.reddit.com/r/Juniper/comments/12q056a/configuring_a_range_of_interfaces_on_juniper/>
