VPCS – with new hypervisor function


The Virtual PC Simulator (VPCS) has been a great help to many users of GNS3 and GNS3 WorkBench. (if you are unfamiliar with VPCS, you might like to take this tutorial).

One of the limitations that VPCS has is that it supports a maximum of none Virtual PCs.  You could of course run multiple instances of VPCS, but to do that you would have to invoke each instance with a different set of port numbers and… well it gets messy and easy to make mistakes.

Now Paul Meng has made some more improvements to VPCS, the most significant being the hypervisor function, and in this article I’m going to show you how to use the hypervisor function to overcome the 9 virtual PCs limit more easily.  These enhancements were introduced in version 5.0a2. [Prior to version .05a2, a separate application called simply hv provided the same function as the vpcs -H xxxx command] 

To run vpcs in hypervisor mode, start the program with the -H parameter.

C:\Program Files\GNS3\vpcs>vpcs.exe -H 21000

This starts the vpcs hypervisor, which is now sitting in memory listening on port 21000 – of course you could have used any available TCP port number – I just happened to choose 21000.

But now you have to communicate with the hypervisor to get your VPCS session going.  You do this through a telnet session, and in the telnet session it is eaay to spawn multiple instances of VPCS, each with its own unique set of port numbers – the vpcs hypervisor keeps track of the port numbers for you so you son’t have to worry about it.  In the following session, I use the Windows telnet client to initiate a session to the hypervisor I started earlier, and then spawn two new vpcs sessions. Now these sessions are also going to run as background daemons, so you won’t see anything on the screen, and to interact with these vpcs daemons, you will have initiate more telnets sessions!

Here’s the command to initiate the telnet session to the hyperviosor

C:\Program Files\GNS3\vpcs>telnet 127.0.0.1 21000

When the session opens, you will be greeted with a HV > prompt to show you are in hypervisor mode.  There is not much you can do in hypervisor mode except spawn new vpcs sessions, list them and kill them! Here’s my session where I show the ? help, spawn two new session, then list them.

HV > ?
help | ?              Print help
vpcs [parameters]     Start vpcs with parameters of vpcs
stop id               Stop vpcs process
list                  List vpcs process
disconnect            Exit the telnet session
quit [-f]             Stop vpcs processes and hypervisor
                        -f force quit without prompting
telnet [<ip>] <port> Telnet to <port> at <ip> (def 127.0.0.1)
rlogin [<ip>] <port> Same as telnet

HV > vpcs
100-VPCS started with -p 21001 -s 20000 -c 30000
HV > vpcs
100-VPCS started with -p 21002 -s 20010 -c 30010 -m 10
HV > list
ID      PID     Parameters
1       3636    -p 21001 -s 20000 -c 30000
2       3768    -p 21002 -s 20010 -c 30010 -m 10
100-OK
HV >

Note how easy it was to spawn the two vpcs sessions?  I simply issued the command vpcs twice!  The fact that the parameters were automatically assigned ( the -p 21001 -s 2000  etc) is how the hypervisor function makes this easy for you.  You could have started vpcs twice using exactly the same parameters and got the same result – like this:

C:\> vpcs -p 21001 -s 200000 -c 300000
C:\> vpcs -p 21002 -s 200010 -c 300010 -m 10

and then of course you would have to remember all these parameters and increment them by 10 next time.

But where are the vpcs windows? Where can you enter the commands you wish to execute? The answer to that lies in the -p parameters used above.  The -p parameter starts a vpcs instance in daemon mode, just like the hypervisor.  And just like the hypervisor, you will have to initiate a telnet session to see the vpcs command line.    Note that the port numbers used with the -p parameter above were 21001 and 21002 [Aside: Can you tell where these numbers were derived from?].  So you can now easily start two telnet sessions to get your familiar vpcs command line.  Again I’ll use the Windows telnet clinet, but you could easily use PuTTY or SecureCRT or you favourite telnet client (in fact, you could even telnet to these daemons from another computer if you wanted).

C:\> telnet 127.0.0.1 21001
C:\> telnet 127.0.0.1 21002

And now you have your two vpcs instances giving you a total of 18 virtual PCs to play with. Here’s the output of the show command for the second session.  Note that the MAC addresses used, the LPORT and the RPORT values used are different to those used in the other session.

VPCS[1]> show

NAME   IP/MASK              GATEWAY           MAC                LPORT  RHOST:PORT
VPCS1  0.0.0.0/0            0.0.0.0           00:50:79:66:68:0a  20010  127.0.0.1:30010
       fe80::250:79ff:fe66:680a/64
VPCS2  0.0.0.0/0            0.0.0.0           00:50:79:66:68:0b  20011  127.0.0.1:30011
       fe80::250:79ff:fe66:680b/64
VPCS3  0.0.0.0/0            0.0.0.0           00:50:79:66:68:0c  20012  127.0.0.1:30012
       fe80::250:79ff:fe66:680c/64
VPCS4  0.0.0.0/0            0.0.0.0           00:50:79:66:68:0d  20013  127.0.0.1:30013
       fe80::250:79ff:fe66:680d/64
VPCS5  0.0.0.0/0            0.0.0.0           00:50:79:66:68:0e  20014  127.0.0.1:30014
       fe80::250:79ff:fe66:680e/64
VPCS6  0.0.0.0/0            0.0.0.0           00:50:79:66:68:0f  20015  127.0.0.1:30015
       fe80::250:79ff:fe66:680f/64
VPCS7  0.0.0.0/0            0.0.0.0           00:50:79:66:68:10  20016  127.0.0.1:30016
       fe80::250:79ff:fe66:6810/64
VPCS8  0.0.0.0/0            0.0.0.0           00:50:79:66:68:11  20017  127.0.0.1:30017
       fe80::250:79ff:fe66:6811/64
VPCS9  0.0.0.0/0            0.0.0.0           00:50:79:66:68:12  20018  127.0.0.1:30018
       fe80::250:79ff:fe66:6812/64

Now that you are accessing vpcs in daemon mode, there are a couple of differences to what you may be used to.

Firstly, there is a disconnect command.  This allows you to temporarily leave your vpcs session, but leaves the session running, so the virtual PCs there will still respond to pings etc.  And you can re-enter the session by opening the telnet session again.

VPCS[1]> disconnect 

Connection to host lost.

C:\>telnet 127.0.0.1 21002

How about a single telnet session for BOTH instances?

[2014-09-29 Update: with later versions of VPCS, the hypervisor interface also supports the rlogin command, so you can now telnet to either VPCS instance from within the initial hypervisor session, which you may find a little more simple than the following:]

Now there will be times when having two windows open (one for each telnet session) will be useful – such as if you want two pings going continuously from two different sources. But at other times, it is kind of nice to have it all in one session – all 18 (or 27 or…) virtual PCs that is.

This can be done!

To keep all virtual PCs in one session, open the first session in the normal way – using telnet as before:

C:\>telnet 127.0.0.1 21001

Now from this session, use the rlogin command to access the second session:

VPCS[1]> show

NAME   IP/MASK              GATEWAY           MAC                LPORT  RHOST:PORT
VPCS1  0.0.0.0/0            0.0.0.0           00:50:79:66:68:00  20000  127.0.0.1:30000
       fe80::250:79ff:fe66:6800/64
VPCS2  0.0.0.0/0            0.0.0.0           00:50:79:66:68:01  20001  127.0.0.1:30001
...<Snip>...
VPCS[1]> rlogin 21002
Connect 127.0.0.1:21002, press Ctrl+X to quit

VPCS[1]> show

NAME   IP/MASK              GATEWAY           MAC                LPORT  RHOST:PORT
VPCS1  0.0.0.0/0            0.0.0.0           00:50:79:66:68:0a  20010  127.0.0.1:30010
       fe80::250:79ff:fe66:680a/64
VPCS2  0.0.0.0/0            0.0.0.0           00:50:79:66:68:0b  20011  127.0.0.1:30011
...<Snip>...

As you can see from the two show commands, then second time the show command is issued, it shows that your session is using the incremented MAC addresses and port numbers – unfortunately, the prompt is exactly the same for the second session as the first, so you do need to keep your wits about you and sue the show command often. You can exit the second session using <Ctrl>+x

There are other enhancements to versions 0.5 of vpcs that I will discuss in a future article.

Advertisements

About RedNectar Chris Welsh

Professional IT Instructor. All things TCP/IP, Cisco or VoIP
This entry was posted in Cisco, GNS3, GNS3 WorkBench, vpcs and tagged , . Bookmark the permalink.

2 Responses to VPCS – with new hypervisor function

  1. Kevin says:

    Hello!
    when i type vpcs.exe -h 21000 it shows me a description but i think does not activate the hv and cant telnet to it
    I supposed im doing something horrible wrong please let me know any help

    Regards

Comments are closed.