I needed to send calls directly to a router but didn't want to mess with production routers.
I had a FreeBSD box running so I decided to install dynamips and dynagen and put a IP2IP image on it.
How to do it:
1. fetch the image that you need from one of your routers (or from cisco's website).
2. install from /usr/ports dynagen and dynamips.
3. check out my config file and adapt to your needs:
[localhost]
[[3745]]
image = c3745......[cut here]
ram = 300
rom = 64
nvram = 300
mmap = true
cnfg = None
confreg = 0x2102
[[ROUTER IP2IP]]
model = 3745
console = 2000
f0/0 = NIO_gen_eth:tap0
then save and do as written below:
kldload if_tap
touch /dev/tap0
ifconfig tap0 up
kldload if_bridge
ifconfig bridge0 create
ifconfig bridge0 addm eth0 addm fxp0
ifconfig bridge0:
bridge0: flags=8843
ether 26:0a:67:8d:3e:3c
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
member: eth0 flags=143
member: fxp0 flags=143
Now I am able to reach the internet from my virtual router.
dynamips -H localhost &
dynagen ip2ip.cfg &
[root@cluster2 /home/dan/simulator]# dynagen ip2ip.cfg
Reading configuration file...
Shutdown in progress...
Shutdown completed.
*** Warning: Starting IP2IP with no idle-pc value
CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb.
C3745 instance 'IP2IP' (id 0):
VM Status : 0
RAM size : 300 Mb
NVRAM size : 300 Kb
IOS image : c3745-adventerprisek9_ivs-mz.124-25.bin
Loading ELF file 'c3745-adventerprisek9_ivs-mz.124-25.bin'...
ELF entry point: 0x80008000
C3745 'IP2IP': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled.
Network successfully loaded
Dynagen management console for Dynamips and Pemuwrapper 0.11.0
Copyright (c) 2005-2007 Greg Anuzelli, contributions Pavel Skovajsa
=>
=>
=>
[2]+ Stopped dynagen ip2ip.cfg
[root@cluster2 /home/dan/simulator]# telnet localhost 2000
Trying localhost...
Connected to localhost.
Escape character is '^]'.
Connected to Dynamips VM "IP2IP" (ID 0, type c3745) - Console port
############################################################################################################## [OK]
If you don't manage to connect to the internet like that, you could as well select the main interface:
f0/0 = NIO_gen_eth:fxp0
You should assign an ip address from the same range to f0/0. Worked for me.