Virtual PC Simulator

The VPCS can simulate up to 9 PCs. You can ping/traceroute them, or ping/traceroute the other hosts/routers from the virtual PCs when you study the Cisco routers in the Dynamips. VPCS is not the traditional PC, it is just a program running on the Linux or Windows, and only few network commands can be used in it. But VPCS can give you a big hand when you study the Cisco devices in the Dynamips. VPCS can replace the routers or VMware boxes which are used as PCs in the Dynamips network.

Try VPCS, it can save your CPU/Memory. It is very small.

Now, VPCS can be run in udp or ether mode. In the udp mode, VPCS sends or receives the packets via udp. In the ether mode, via /dev/tap, not support on the Windows.

Download

The stable version 0.8a, download from sourceforge, has been tested under FreeBSD/Linux/OSX/Windows, changelog. And special thanks to Chris Welsh for his suggestions and help.

The Simplified Chinese user guide, download from sourceforge.

The source code was released under BSD license, download from sourceforge. The source tarball was signed by my GPG key E90A5CF0, run gpg –verify to verify:

 $ gpg --verify vpcs-0.8-src.tbz.asc
 gpg: Signature made 10/04/15 17:02:10 using RSA key ID E90A5CF0
 gpg: Good signature from "mirnshi <[email protected]>"



Usage

OPTIONS:
  -h             print this help then exit
  -v             print version information then exit

  -R             disable relay function
  -i num         number of vpc instances to start (default is 9)
  -p port        run as a daemon listening on the tcp port
  -m num         start byte of ether address, default from 0
  [-r] FILENAME  load and execute script file FILENAME

  -e             tap mode, using /dev/tapx by default (linux only)
  [-u]           udp mode, default

udp mode options:
  -s port        local udp base port, default from 20000
  -c port        remote udp base port (dynamips udp port), default from 30000
  -t ip          remote host IP, default 127.0.0.1

tap mode options:
  -d device      device name, works only when -i is set to 1

hypervisor mode option:
  -H port        run as the hypervisor listening on the tcp port

  If no FILENAME specified, vpcs will read and execute the file named
  startup.vpc if it exists in the current directory.
 VPCS[1]> ?
?                        Print help
! COMMAND [ARG ...]      Invoke an OS COMMAND with optional ARG(s)
digit                    Switch to the VPCdigit. digit range 1 to 9
arp [digit|all]          Shortcut for: show arp. Show arp table
clear ARG                Clear IPv4/IPv6, arp/neighbor cache, command history
dhcp [OPTION]            Shortcut for: ip dhcp. Get IPv4 address via DHCP
disconnect               Exit the telnet session (daemon mode)
echo TEXT                Display TEXT in output. See also  set echo ?
help                     Print help
history                  Shortcut for: show history. List the command history
ip ARG ... [OPTION]      Configure the current VPC's IP settings. See ip ?
load [FILENAME]          Load the configuration/script from the file FILENAME
ping HOST [OPTION ...]   Ping HOST with ICMP (default) or TCP/UDP. See ping ?
quit                     Quit program
relay ARG ...            Configure packet relay between UDP ports. See relay ?
rlogin [ip] port         Telnet to port on host at ip (relative to host PC)
save [FILENAME]          Save the configuration to the file FILENAME
set ARG ...              Set VPC name and other options. Try set ?
show [ARG ...]           Print the information of VPCs (default). See show ?
sleep [seconds] [TEXT]   Print TEXT and pause running script for seconds
trace HOST [OPTION ...]  Print the path packets take to network HOST
version                  Shortcut for: show version
 VPCS[1]> sh
 
 NAME   IP/CIDR              GATEWAY           MAC                LPORT  RPORT
 VPCS1  192.168.1.2/24       192.168.1.1       00:50:79:66:68:00  20000  30000
        fe80::2050:79ff:fe66:6800/64
 VPCS2  0.0.0.0/0            0.0.0.0           00:50:79:66:68:01  20001  30001
        fe80::2050:79ff:fe66:6801/64
        2001:1::2050:79ff:fe66:6801/64 eui-64
 VPCS3  192.168.11.2/24      192.168.11.1      00:50:79:66:68:02  20002  30002
        fe80::2050:79ff:fe66:6802/64
        2001:11::2/64 eui-64
 VPCS4  192.168.12.2/24      192.168.12.1      00:50:79:66:68:03  20003  30003
        fe80::2050:79ff:fe66:6803/64
        2001:12::2050:79ff:fe66:6803/64 eui-64
 VPCS5  192.168.3.5/24       0.0.0.0           00:50:79:66:68:04  20004  30004
        fe80::2050:79ff:fe66:6804/64
 VPCS6  192.168.3.6/24       0.0.0.0           00:50:79:66:68:05  20005  30005
        fe80::2050:79ff:fe66:6805/64
 VPCS7  192.168.4.7/24       0.0.0.0           00:50:79:66:68:06  20006  30006
        fe80::2050:79ff:fe66:6806/64
 VPCS8  192.168.4.8/24       192.168.4.1       00:50:79:66:68:07  20007  30007
        fe80::2050:79ff:fe66:6807/64
 VPCS9  192.168.4.9/24       192.168.4.1       00:50:79:66:68:08  20008  30008
        fe80::2050:79ff:fe66:6808/64
 VPCS[9]> p
 
 ping address [options], Ping the network host, Ctrl+C to stop the command
     -1           ICMP mode, default
     -2           UDP mode
     -3           TCP mode
     -c count     packet count
     -l size      data size
     -T ttl       set TTL, default 64
     -p port      source and destination port
     -f flag      tcp head flag, |C|E|U|A|P|R|S|F|
                            bits |7 6 5 4 3 2 1 0|
     -s winsize   tcp window size
     -t           send packet until interrupt by Ctrl+C
     -i ms        wait 'ms' milliseconds between sending each packet
     -w ms        wait 'ms' milliseconds to receive the response
 VPCS[9]> i
 
 ip address [gateway] CIDR, Set the PC's ip, gateway's ip and network mask.
     dhcp                    Configure host/gateway address using DHCP, only ipv4
     auto                    Stateless address autoconfiguration, only ipv6
                             PC will try to get the ipv6 address from the router at startup
     address [gateway] CIDR  set the PC's ip, gateway's ip and network mask
                             Default IPv4 CIDR is 24, IPv6 is 64. In the ether mode,
                             the ip of the tapx is the maximum host ID of the subnet.
 
                             'ip 10.1.1.70 10.1.1.65 26', set the host ip to 10.1.1.70,
                             the gateway ip to 10.1.1.65, the netmask to 255.255.255.192,
                             the tapx ip to 10.1.1.126 in the ether mode.

If in the ether mode, please run it before the dynamips loads/starts the ios.

When VPCS started, it listens the ports from 20000 to 20008 and wait the dymamips to connet, and send the packets to the ports from 30000 to 30008 which should be listened by the Dynamips.

VPCS looks for the file named 'startup.vpc' in the current directory, and execute the commands in it if you are not set the startup file from the command line. All the commands in the startup file are the internal command of the VPCS. The line started with '#' or '!' will be discarded.

 # The startup file of VPCS
 # 
 # pc1, ipv4 & ipv6
 1
 ip 172.16.1.1 172.16.1.10 24
 ip 2001:1::10 64
 # pc2, using dhcp
 2
 dhcp
 # pc3, ipv4
 3
 ip 172.16.3.3 172.16.3.10 24
 # pc4, ipv4 & ipv6
 4
 ip 192.168.4.4 192.168.4.10 24
 ip 2001:4::10 64
 # switch to PC1
 1

.net file (ether mode), please refer to dynagen for details.

 # VLAN lab
 ghostios = True
 sparsemem = True
 [localhost]
  [[ROUTER sw]]
      model = 2621
      image = /ios.run/c2600-ipbase-mz.123-8.T.bin
      ram = 128
      slot1 = NM-16ESW
      f1/0 = r1 f0/1
      f1/1 = NIO_linux_eth:tap0
      f1/2 = NIO_linux_eth:tap1
  [[router r1]]
      model = 2621
      image = /ios.run/c2600-i-mz.123-6c.bin
      ram = 32
      slot1 = NM-1FE-TX
      f0/0 = NIO_linux_eth:tap2

.bat (udp mode)

  dynamips-wxp.exe -i R1 -T 2000 -P 2600 -r 64 -c 0x2142 -p 1:NM-16ESW 
                  -s 1:0:udp:30000:127.0.0.1:20000 
                  -s 1:1:udp:30001:127.0.0.1:20001 
                  -s 1:2:udp:30002:127.0.0.1:20002    ..\ios.run\c2600-te.bin

Dynamips loads ios with NM-16ESW module in slot 1, and listens 30000 to 30002. NM-16ESW is 16 port switch module (from f1/0 to f1/15). '-s 1:0:udp:30000:127.0.0.1:20000' means:

  1. this is port 0
  2. dynamips (or ios) sends the packets from port 30000 to port 20000 which listens by VPCS (PC1).
  3. VPCS (PC1) sends the packets from port 20000 to dynamips.

It is easy to transform the topology through relay command. For example:

relay add 0.0.0.0:7010 0.0.0.0:7100
relay add 0.0.0.0:7020 0.0.0.0:7220
relay add 0.0.0.0:7030 0.0.0.0:7310
relay add 0.0.0.0:7110 0.0.0.0:7210

The topology

will be transformed to

.net file (udp mode)

 # VLAN lab
 ghostios = True
 sparsemem = True
 [localhost]
  [[ROUTER sw]]
      model = 2621
      image = /ios.run/c2600-ipbase-mz.123-8.T.bin
      ram = 128
      slot1 = NM-16ESW
      f1/0 = r1 f0/1
      f1/1 = NIO_udp:30000:127.0.0.1:20000
      f1/2 = NIO_udp:30001:127.0.0.1:20001
      idlepc = 0x805785a0
  [[router r1]]
      model = 2621
      image = /ios.run/c2600-i-mz.123-6c.bin
      ram = 32
      slot1 = NM-1FE-TX
      f0/0 = NIO_udp:30002:127.0.0.1:20002
      idlepc = 0x804f4044 

Note

vpcs.exe is windows program, only udp mode.
Under linux or OSX, maybe you need chmod +x vpcs.
vpcs.osx is OS X program, only udp mode.