On a Juniper EX series how can I set the L3 IP range, but specify a gateway that is upstream?

VLAN - Subnet - Gateway
10 - -
20 - -

If I do the config like this then I get the Juniper Management website on the gateway IPs instead of my upstream gateway.

interfaces {
    vlan {
        unit 10 {
            family inet {
        unit 20 {
            family inet {
vlans {
    admin-vlan {
        vlan-id 10;
        l3-interface vlan.10;
    user-vlan {
        vlan-id 20;
        l3-interface vlan.20;
  • Can you clarify what is upstream gateway? Commented Nov 17, 2018 at 8:24
  • You want to configure default gateway? I don't understand what you want to achieve Commented Nov 17, 2018 at 12:03
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer.
    – Ron Maupin
    Commented Dec 25, 2018 at 9:58

2 Answers 2


How is your upstream gateway configured? Router-on-a-stick (i.e dot1q) or via separate interfaces for its .10.1 and .20.1 interfaces?

This will determine how you configure your EX switchports.

If it's the former then you will need a trunk port carrying both L2 vlans and plug the upstream gateway into that. If it's the latter then you will need two separate access ports once for Vlan 10 and the other for Vlan 20 and connect the respective upstream gateway interfaces.

This is how I'm interpreting your question and envisaging your topology:

[upstream gw](dot1q 10,20) <----> (dot1q 10,20) juniper ex switch


upstream gw <-----> (10) juniper ex switch (20) <-----> (20) juniper ex switch

There should be no need to configure IP addresses for the VLANs on the ex switch if you just need them to pass the VLAN traffic @ L2.

  • It is router-on-a-stick, 1 trunk line with all VLANs. I must set an L3 interface if I want to be able to access the EX management interface on the router.
    – BAR
    Commented Nov 17, 2018 at 20:25
  • You need to be clearer about what you are trying to achieve.
    – moogzy
    Commented Nov 18, 2018 at 11:50
  • If it's just for mgmt then defining any address from an available vlan for it's L3 interface will be fine. In theory you only need one management address for the switch if the upstream gateway is acting as default gateway for all the vlans(i.e via router-on-a-stick). As long as that management address is routable then you will be able to reach it regardless of what vlan you're on, assuming no ACLs are blocking access from outside the owning vlan. FWIW: As a best practice your management IP for the switch should be on a separate vlan from the data vlans.
    – moogzy
    Commented Nov 18, 2018 at 11:57
  • Ok, so what would the config be for that to work? The relevant config sections would be fine, or commands if you prefer.
    – BAR
    Commented Nov 19, 2018 at 22:24

So based on the comments of APA's post, I think what you're trying to ask is "how can I configure an IP on my switch to manage it, while still passing traffic through at L2 to a default gateway"

The simplest way based on your config would be to remove the IP from the user-vlan, and then assign a different address to your admin-vlan:

delete vlans user-vlan l3-interface vlan.20
delete interfaces vlan unit 20
rename interfaces vlan unit 10 family inet address to

Then on the interface that connects to your router-on-a-stick, simply:

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 user-vlan
set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members admin-vlan

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.