We have a Juniper EX4200 which is connected via ge-0/0/0 trunk port to the providers router. We got our own vlan(id 250) and there are two public subnets routed on this vlan. Currently all our serves are in the same vlan (the providers vlan), now we want to to route one of these subnets we got from our provider in a new vlan(300) for an extra server.

Now my question is how can I route one subnet from vlan 250 into the new vlan 300 without loosing ip addresses ? A small example config would be nice or at least a possible way to do it.

So just in case a small summary:

Provider --> Vlan250 --> Juniper EX4200 (ge-0/0/0, trunk)

two public subnets:

xx.xx.xx.xx/25 yy.yy.yy.yy/27

Juniper EX4200:

Vlan250: (providers vlan) xx.xx.xx.xx/25 yy.yy.yy.yy/27 ge-0/0/0 - ge-0/0/10

Vlan300: (our own vlan) ge-0/0/11 - ge-0/0/20

now we want to route the /27 from providers vlan to our new vlan 300

Thank you very much !

  • You don't route by VLAN but by IP subnet - you might need to move one of the subnets to the new VLAN. Otherwise, you'd need to provide a new subnet and NAT in between.
    – Zac67
    Jul 24, 2023 at 6:52

1 Answer 1

# Enter configuration mode

# Create Vlan300 and assign an IP address to the interface
set vlans Vlan300 vlan-id 300
set interfaces vlan unit 300 family inet address zz.zz.zz.zz/27

# Configure the trunk interface ge-0/0/0
set interfaces ge-0/0/0 unit 0 family ethernet-switching port-mode trunk
set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members [ Vlan250 Vlan300 ]

# Enable IP routing and configure the default route
set routing-options static route next-hop aa.aa.aa.aa

# Configure the routing between Vlan250 and Vlan300
set routing-instances VRF_Vlan250 instance-type virtual-router
set routing-instances VRF_Vlan250 interface vlan.250
set routing-instances VRF_Vlan250 routing-options static route xx.xx.xx.xx/25 next-hop yy.yy.yy.yy

# Finally, assign the VRF to the Vlan interfaces
set interfaces vlan unit 250 family inet filter input VRF_Vlan250
set interfaces vlan unit 300 family inet filter input VRF_Vlan250

# Exit configuration mode
commit and-quit

Copy and paste this script into the Juniper EX4200's command-line interface in configuration mode (operational mode is denoted by > and configuration mode by #). After pasting the script, the configuration will be applied, and you should have the routing between Vlan250 and Vlan300 set up as desired.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.