A young Michael Caine doing Juniper labs.

A young Michael Caine enjoying Juniper labs.

Let’s say you have a Juniper EX switch that you want to connect to your new virtual lab. Maybe you’re training for the JNCIP-ENT. Maybe you need to verify reachability to a production network over an IPsec VPN tunnel. How do you connect your virtual Juniper lab to the world?

Start by listing all the available local interfaces (requires a VirtualBox setup):

$ VBoxManage list bridgedifs | grep ^Name
Name: en1: Wi-Fi (AirPort)
Name: en0: Ethernet
Name: en2: Thunderbolt 1
Name: p2p0
Name: bridge0

Select an interface from that list, then modify your Vagrantfile to connect vsrx1 to the outside world:

  config.vm.define "vsrx1" do |vsrx1|
    vsrx1.vm.host_name = "vsrx1"
    vsrx1.vm.network "private_network",
                     ip: "10.99.12.1",
                     virtualbox__intnet: "1-2"
    vsrx1.vm.network "private_network",
                     ip: "10.99.31.1",
                     virtualbox__intnet: "1-3"
    vsrx1.vm.network "public_network",
                     bridge: "en1: Wi-Fi (AirPort)"
  end

We have now bridged a physical interface, in this case my Macbook Wi-Fi interface, to vsrx1’s interface ge-0/0/3.0:

$ vagrant ssh vsrx1
--- JUNOS 12.1X47-D15.4 built 2014-11-12 02:13:59 UTC
[email protected]% cli
[email protected]> show configuration interfaces ge-0/0/3
unit 0 {
    family inet {
        dhcp;
    }
}
[email protected]> show interfaces terse ge-0/0/3.0
Interface               Admin Link Proto    Local                 Remote
ge-0/0/3.0              up    up   inet     10.24.5.207/24
[email protected]> ping 8.8.8.8 count 3
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=44 time=35.096 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=44 time=23.366 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=44 time=36.630 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 23.366/31.697/36.630/5.924 ms
[email protected]>

Your lab can now reach The Internet through vsrx1 ⚡️🌍

Get in touch if you are looking for automation and Juniper consulting services.



Sharing is caring:
Share on FacebookTweet about this on TwitterShare on LinkedInShare on Google+Share on RedditShare on TumblrPrint this pageEmail this to someone