I’ve had a few questions on my post over here. How can we effectively connect a CSR to an existing dynamips topology, as well as how to break it out to the real world. The initial goal is to create this topology:
I don’t have an ESX v5 server to play around with, so I’ll be doing all of this under vmware fusion on my Macbook Pro. I’ll show you how to install the CSR first. How to modify a dynamips .net file running on the same laptop to connect to the CSR. And finally how to break that out to a switch where I can connect all manner of real devices. The configuration of vmware player/fusion/workstation and ESX vsphere are going to be very similar
Install the CSR1000v
You need to download the CSR from Cisco’s website. Go to Cisco – Support – Download – Routers – Cloud Routers – CSR1000V
This is a free download. You just need a Cisco account.
In ESX you can install – install from OVF. With vmware fusion installed all I need to do is doubleclick the download from Cisco. That will open up an import dialogue:
Let it import
The first time you run the VM, it’ll fully install. You don’t have to do anything except let it run through its install. Once it reboots your router will start up:
Configure vmware player networking
I’ve installed Ubuntu server 64bit in the meantime and installed dynamaips. What we want to do now is ensure certain virtual interfaces are connected to different virtual switches. Ubuntu/CSR will consider these to be real interfaces.
The CSR comes with three interfaces by default. I’ve mapped two of these to separate internal switched networks.
NOTE – vmware player/esx/workstation makes this very easy. Vmware Fusion doesn’t give you the option to create multiple virtual networks. I’ll add a section at the end of this post to show how to do this.
For dynamips I’ve also got two interfaces. Each mapped to the same networks respectively as the CSR above.
Configure dynamips .net file
The goal now is to map interface. I want to map the two virtual interface (which linux considers real) to a virtual ethernet switch within dynamips. I’ll also connect R1 and R2 directly to each other in dynamips:
autostart = False [127.0.0.1:7200] workingdir = /home/darreno/dynamips/working [] image = /home/darreno/dynamips/ios/c7200-advipservicesk9-mz.122-33.SRE7.bin ram = 256 idlepc = 0x6278f1a4 ghostios = True [[ROUTER R1]] model = 7200 console = 2001 f0/0 = s1 1 f1/0 = R2 f1/0 [[ROUTER R2]] model = 7200 console = 2002 f0/0 = s1 2 [[ETHSW s1]] 1 = access 2 2 = access 3 3 = access 2 NIO_linux_eth:eth1 4 = access 3 NIO_linux_eth:eth2
There is a virtual switch internal to dynamips called ETHSW S1. I’ve mapped R1 interface fa0/0 to port 1 of this switch. Switch port 1 is mapped to vlan 2 untagged. Port 3 of this dynamips switch is also in vlan 2 which connects to what linux considers eth0. eth0 is connected to vmnet2 which we created earlier. This is the virtual network within vmware. The same has been done for R2 and port 4, just that those are in vlan 3 connected to the vmnet3 network inside vmware. It’s a bit confusing at first as we are dealing with multiple levels of virtualisation here, but once you wrap your head around it it’s not so difficult.
I’ve configured the network as above. I’ve configured a loopback interface on all routers and they are all running OSPF. Let’s check CDP and OSPF:
IOS-XE#sh cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, D - Remote, C - CVTA, M - Two-port Mac Relay Device ID Local Intrfce Holdtme Capability Platform Port ID R2 Gig 2 121 R 7206VXR Fas 0/0 R1 Gig 1 171 R 7206VXR Fas 0/0 IOS-XE#sh ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 18.104.22.168 1 FULL/DR 00:00:39 10.1.1.50 GigabitEthernet2 22.214.171.124 1 FULL/DR 00:00:34 10.0.0.50 GigabitEthernet1
R1#sh cdp nei Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone Device ID Local Intrfce Holdtme Capability Platform Port ID R2 Fas 1/0 157 R 7206VXR Fas 1/0 IOS-XE Fas 0/0 136 R I CSR1000V Gig 1 R1# R1#sh ip ospf nei Neighbor ID Pri State Dead Time Address Interface 126.96.36.199 1 FULL/BDR 00:00:33 192.168.1.2 FastEthernet1/0 188.8.131.52 1 FULL/BDR 00:00:39 10.0.0.1 FastEthernet0/0
2#sh cdp nei Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone Device ID Local Intrfce Holdtme Capability Platform Port ID R1 Fas 1/0 125 R 7206VXR Fas 1/0 IOS-XE Fas 0/0 178 R I CSR1000V Gig 2 R2# R2#sh ip ospf nei Neighbor ID Pri State Dead Time Address Interface 184.108.40.206 1 FULL/DR 00:00:32 192.168.1.1 FastEthernet1/0 220.127.116.11 1 FULL/BDR 00:00:34 10.1.1.1 FastEthernet0/0
Connect to the real world
I’m not going to show this as it’s very simple. It’s nearly identical to the config above. All you need to do is map a vmnet to a physical interface. You can also map a vmnet to a physical tagged interface. This means on a single physical interface you can have multiple vmnets mapped. From there you can connect it to a switch where you cn use vlans to connect to other kit.
Footnote – Adding more vmnets in Vmware Fusion
I got these instructions from here: http://www.virtual-hike.com/how-to-create-additional-vmnets-in-vmware-fusion/
The following all needs to be done through the cli. I’m using Fusion 5 so you may need to adjust for different versions. You first need to install your VMs as above. Once that is done, open a terminal and navigate to /Library/Preferences/VMware Fusion
Darrens-MacBook-Pro:/ darrenoconnor$ cd /Library/Preferences/VMware\ Fusion/
Copy the vnmet1 folder to vmnet2
Darrens-MacBook-Pro:VMware Fusion darrenoconnor$ sudo cp -R vmnet1 vmnet2 Password:
Navigate to the new folder and edit dhcpd.conf:
arrens-MacBook-Pro:VMware Fusion darrenoconnor$ cd vmnet2 Darrens-MacBook-Pro:vmnet3 darrenoconnor$ sudo vi dhcpd.conf
In that file you should adjust the subnet address, MAC address, and vmnet name. Save and exit.
Edit the network file:
Darrens-MacBook-Pro:vmnet3 darrenoconnor$ sudo vi ../networking
Add the following with the subnets you used above. We don’t actually need DHCP so you can switch it off:
answer VNET_2_DHCP no answer VNET_2_HOSTONLY_NETMASK 255.255.255.0 answer VNET_2_HOSTONLY_SUBNET x.x.x.x answer VNET_2_VIRTUAL_ADAPTER yes
That’s the second vmnet now created. Now we need to modify our previous VM’s to connect to that new vmnet. Once again this needs to be done via the command line.
Navigate to your VM:
Darrens-MacBook-Pro:vmnet3 darrenoconnor$ cd ~/Documents/Virtual\ Machines.localized/
Go into the folder for each of your VMs you want to add to the vmnet. Open the .vmx file and add it to the vmnet added earlier.
Go down to ethernet2 and change it like so:
ethernet2.present = "TRUE" ethernet2.connectionType = "custom" ethernet2.vnet = "vmnet2" ethernet2.virtualDev = "e1000" ethernet2.wakeOnPcktRcv = "FALSE" ethernet2.addressType = "generated"
Do that for all the needed VMs and away you go. You can add more vmnets as needed