VLANs and Interfaces
VLANs and Interfaces
You can see a list of your interfaces using the following:
show interfaces terse

Ports labeled eth-switch are regular L2 ports.
Ports labeled inet have an IP assigned to them.
Admin Down - manually disabled
Line Down - nothing plugged in
Interface Types



Configuring Interfaces
The Interface itself: - if the interface we are configuring is physical, this is where we configure physical parameters, This includes duplex settings, link speed, MTU, and so on. This is also where the description goes

Unit: - Most configuration goes within a container called a unit. A unit is a logical interface. The IFL that we spoke about earlier. All logical configuration goes here and all interfaces must have them. Some devices like regular switchboards will only have one unit. Some interfaces like PBP and HDL-C require that the unit number is always zero. In other cases, we can have multiple units per interface. In fact, this is how we create sub interfaces based on VLANs
Family:
Every unit must have at least one family.
Under the family is where the type of addressing goes. Ethernet switching family will contain VLAN information:

Example to configure a loopback address:
configure
set interfaces lo0 unit 100 family inet address 10.10.10.1/24
set interfaces lo0 description "Test Interface"
If the unit was wrong, you can rename using
rename interfaces lo0 unit 100 to unit 0
Settings:

Multiple IP Addresses Compared to Cisco

Troubleshoot an interface
show interfaces ge-0/0/0
Or
show interfaces ge-0/0/0 extensive
which will show errors
To disable an interface
Same as shutdown on Cisco:
set interfaces ge-0/0/5 disable
To turn back up:
delete set interfaces ge-0/0/5 disable
You can also deactivate the config, so you can see it, but JunOS will ignore it:
deactivate interfaces ge-0/0/5
VLAN Configuration
Define VLANs with optional description:
configure
set vlans Test vlan-id 100 description "Test VLAN"
set vlans Admin vlan-id 200 description "Admin VLAN"
set vlans Wireless vlan-id 300
commit
run show vlans:

Configure Layer 2 access or Trunk port under Ethernet switching family:

Trunk:
set interfaces ge-0/1/0 unit 0 family ethernet-switching port-mode trunk
Then add member to the port
set interfaces ge0/1/0 unit 0 family ethernet-switching vlan members Test
Or multiple via
set interfaces ge0/1/0 unit 0 family ethernet-switching vlan members [ Test Admin Wireless ]
Configure Access port with single VLAN:
set interfaces ge-0/0/0 unit 0 family ethernet-switching port-mode access
set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members Test
Copy configuration to other ports using copy command
copy interfaces ge-0/0/0 to ge-0/0/1
Set description on interfaces

Replace pattern
This would help changing IPs on interfaces, or VLAN names:

Create sub interfaces
Enable VLAN tagging on the physical port:
set interfaces ge-0/1/1 vlan-tagging
Set VLAN ID on interface (note that to avoid confusion in the config, they use the VLAN ID for the unit number):
set interfaces ge-0/1/1 unit 10 vlan-id 10
Set IP on subinterface:
set interfaces ge-0/1/1 unit 10 family inet address 10.20.20.20/24
Differences with Cisco

VLAN Interface (SVI) in Cisco world is the same as an IRB in Juniper world.
Older versions of Juniper used vlan interfaces instead of irb.
Voice Ports

Add comments to the configuration
Use the annotate commands to add comments to any part of the configuration.
show interfaces:
