This article describes how to configure VLAN translation by using Enhanced Layer 2 Software Support (ELS) on Junos OS.
Example Topology
+---------+ Trunk-all +---------+ Trunk-all +----------+
| |ge-0/0/1 | | ge-0/0/0 | |
| SW-A +-----------------+ EX4300 +-----------------+ SW-B |
| | ge-0/0/1 | | ge-0/0/0| |
+---------+ +---------+ +----------+
Vlan.10 --> 10.0.0.1/24 ge-0/0/0.10 --> 10.0.0.2/24
Vlan.20 --> 20.0.0.1/24 ge-0/0/0.220 --> 20.0.0.2/24
- If SW-A pings SW-B on vlan10, the ping works without any translation.
- If SW-A pings SW-B on vlan20, then vlan20's traffic will be translated to vlan220 by EX4300.
- The return traffic from SW-B on vlan220 will be translated back to vlan20 while egressing to SW-A by EX4300.
Example Configuration
Switch-A
{master:0}[edit]
root@SW-A# run show configuration vlans
V10 {
vlan-id 10;
l3-interface vlan.10;
}
V20 {
vlan-id 20;
l3-interface vlan.20;
}
root@SW-A# run show configuration interfaces
ge-0/0/1 {
unit 0 {
family ethernet-switching {
port-mode trunk;
vlan {
members all;
}
}
}
}
vlan {
unit 10 {
family inet {
address 10.0.0.1/24;
}
}
unit 20 {
family inet {
address 20.0.0.1/24;
}
}
}
EX4300
root# run show configuration vlans
V10 {
vlan-id 10;
}
V220 {
vlan-id 220;
}
root# run show configuration interfaces
ge-0/0/0 {
unit 0 {
family ethernet-switching {
interface-mode trunk;
vlan {
members all;
}
}
}
}
ge-0/0/1 {
flexible-vlan-tagging;
unit 0 {
family ethernet-switching {
interface-mode trunk;
vlan {
members [ 10 220 ];
}
vlan-rewrite {
translate 20 220;
}
}
}
}
irb {
unit 10 {
family inet {
address 10.0.0.5/24;
}
}
unit 220 {
family inet {
address 20.0.0.5/24;
}
}
}
Switch-B
root@SW-B# run show configuration interfaces
ge-0/0/0 {
vlan-tagging;
unit 10 {
vlan-id 10;
family inet {
address 10.0.0.2/24;
}
}
unit 220 {
vlan-id 220;
family inet {
address 20.0.0.2/24;
}
}
}
Results
From Switch-A
root@SW-A# run ping 10.0.0.2
PING 10.0.0.2 (10.0.0.2): 56 data bytes
64 bytes from 10.0.0.2: icmp_seq=0 ttl=64 time=3.886 ms
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=3.239 ms
64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=3.266 ms
64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=3.104 ms
^C
--- 10.0.0.2 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max/stddev = 3.104/3.374/3.886/0.302 ms
root@SW-A# run ping 20.0.0.2
PING 20.0.0.2 (20.0.0.2): 56 data bytes
64 bytes from 20.0.0.2: icmp_seq=0 ttl=64 time=4.044 ms
64 bytes from 20.0.0.2: icmp_seq=1 ttl=64 time=3.614 ms
64 bytes from 20.0.0.2: icmp_seq=2 ttl=64 time=3.256 ms
64 bytes from 20.0.0.2: icmp_seq=3 ttl=64 time=3.918 ms
^C
--- 20.0.0.2 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max/stddev = 3.256/3.708/4.044/0.304 ms
From Switch-B
root@SW-B# run ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1): 56 data bytes
64 bytes from 10.0.0.1: icmp_seq=0 ttl=64 time=3.895 ms
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=3.147 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=4.050 ms
64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=4.092 ms
^C
--- 10.0.0.1 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max/stddev = 3.147/3.796/4.092/0.382 ms
root@SW-B# run ping 20.0.0.1
PING 20.0.0.1 (20.0.0.1): 56 data bytes
64 bytes from 20.0.0.1: icmp_seq=0 ttl=64 time=3.878 ms
64 bytes from 20.0.0.1: icmp_seq=1 ttl=64 time=29.827 ms
64 bytes from 20.0.0.1: icmp_seq=2 ttl=64 time=2.829 ms
64 bytes from 20.0.0.1: icmp_seq=3 ttl=64 time=4.449 ms
^C
--- 20.0.0.1 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.829/10.246/29.827/11.320 ms
{master:0}[edit]
2020-08-25: Article reviewed for accuracy; no changes required; article valid and relevant