lost and found ( for me ? )

Showing posts with label dynamips. Show all posts
Showing posts with label dynamips. Show all posts

Linux Mint 12 : How to install dynamips and gns3 ( Cisco Router Emulator )


Here’s an explanation of how to install dynamips and gns3 on Linux Mint 12.

# uname -ri
3.0.0-15-generic x86_64

# tail -1 /etc/lsb-release
DISTRIB_DESCRIPTION="Linux Mint 12 Lisa"


[ install dynamips and gns3 ]

dynamips is Cisco Router emulator and gns3 is GUI tool for dynamips.
# apt-get install -y dynamips gns3


[ initial setup ]

start gns3
$ gns3 &


do step1 ( configure working directory ) and then step2 ( load IOS )


step1 ( click OK. default settings )


step2

select the IOS image you want to run.
I used c3640-jk9s-mz.124-13a.bin.


click “Save”

drag and drop “Router c3600” icon like this.




start c3600

configure Idle PC

By default , the dynamips process uses around 100% CPU consumption.
# top -b -n 1 | grep dynamips
25472 hattori   20   0  363m 185m  65m S   99  1.5   3:17.27 dynamips


To reduce CPU consumption

select Router icon , right-click , Idle PC



Dynampis will calculate an appropriate Idle PC values.


Click “Apply”

After configuring Idle PC values.
# top -b -n 1 | grep dynamips
25472 hattori   20   0  363m 185m  65m S    8  1.5   6:57.80 dynamips

CPU consumption is 8%.

Configuration file is stored under .gns/ directory. ( gns3.ini file )
# head -5 /home/hattori/.gns3/gns3.ini
[GNS3]
version=1795
lang=en
project_startup=true
relative_paths=true


Ubuntu 10.10 Server : How to run Cisco IOS 15.1 on dynamips (GNS3)

Here’s how to fly an ISO 15.1 on dynamips.

# tail -1 /etc/lsb-release
DISTRIB_DESCRIPTION="Ubuntu 10.10"

# uname -r
2.6.35-28-server

# dynamips --version
Cisco Router Simulation Platform (version 0.2.8-RC2-amd64)

# gns3 --version
gns3 0.7

[ prepare an IOS for Cisco 7206VXR ]

I used c7200-adventerprisek9-mz.151-4.M.bin

plz note that not c7200p images! In my testing , these images don’t seem to boot.

[ configure GNS3 to fly IOS 15.1 ]

select c7200-adventerprisek9-mz.151-4.M.bin as a boot ISO image


If you haven’t installed dynamips , just tyep
# apt-get install gns3 dynamips


General:

Midplane is vxr and NPE is npe-400.


Memories n’ disks setting is default.




add a module on slot1

[ fly R1(c7200) via GNS3 ]

calculate n’ set IDLEPC value.


IOS 15.1 is running



# cat .gns3/gns3.ini
[GUIState]
Geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\x98\0\0\x1\x92\0\0\x3\xb5\0\0\x3\x9b\0\0\0\x98\0\0\x1\x92\0\0\x3\xb5\0\0\x3\x9b\0\0\0\0\0\0)
State=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x3\0\0\0\0\0\0\x1\0\0\0\x1\xb3\xfc\x2\0\0\0\x2\xfb\0\0\0(\0\x64\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\0_\0N\0o\0\x64\0\x65\0T\0y\0p\0\x65\0s\x1\0\0\0\x41\0\0\x1\xb3\0\0\0g\0\xff\xff\xff\xfb\0\0\0&\0\x64\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\0_\0U\0n\0\x64\0o\0V\0i\0\x65\0w\0\0\0\0\0\xff\xff\xff\xff\0\0\0g\0\xff\xff\xff\0\0\0\x1\0\0\x1\0\0\0\x1\xb3\xfc\x2\0\0\0\x1\xfb\0\0\0$\0\x64\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\0_\0T\0o\0p\0o\0S\0u\0m\x1\0\0\0\x41\0\0\x1\xb3\0\0\0l\0\xff\xff\xff\0\0\0\x3\0\0\x1\x12\0\0\0\xd9\xfc\x1\0\0\0\x1\xfb\0\0\0$\0\x64\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\0_\0\x43\0o\0n\0s\0o\0l\0\x65\x1\0\0\x1\x6\0\0\x1\x12\0\0\0O\0\a\xff\xff\0\0\x1\x12\0\0\0\xd4\0\0\0\x1\0\0\0\x2\0\0\0\x1\0\0\0\x2\xfc\0\0\0\x1\0\0\0\x2\0\0\0\x3\0\0\0\x1e\0t\0o\0o\0l\0\x42\0\x61\0r\0_\0G\0\x65\0n\0\x65\0r\0\x61\0l\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\"\0t\0o\0o\0l\0\x42\0\x61\0r\0_\0\x45\0m\0u\0l\0\x61\0t\0i\0o\0n\x1\0\0\x1\\\xff\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x1e\0t\0o\0o\0l\0\x42\0\x61\0r\0_\0\x64\0r\0\x61\0w\0i\0n\0g\x1\0\0\x2L\xff\xff\xff\xff\0\0\0\0\0\0\0\0)

[GNS3]
version=1792
lang=en
project_startup=true
relative_paths=true
slow_start=0
console=
use_shell=true
gui_show_status_points=true
gui_use_manual_connection=false
gui_draw_selected_rectangle=false
project_directory=/home/hattori/.gns3
ios_directory=/home/hattori/.gns3
scene_width=2000
scene_height=1000

[Dynamips]
hypervisor_path=/usr/bin/dynamips
hypervisor_port=7200
hypervisor_baseUDP=10000
hypervisor_baseConsole=2000
hypervisor_working_directory=/tmp
clean_working_directory=true
dynamips_ghosting=true
dynamips_sparsemem=false
dynamips_mmap=true
hypervisor_memory_usage_limit=512
hypervisor_udp_incrementation=100
hypervisor_manager_import=true
hypervisor_manager_binding=localhost

[Qemu]
qemuwrapper_path=
qemuwrapper_working_directory=
qemu_path=qemu
qemu_img_path=qemu-img
external_hosts=localhost:10525
enable_QemuManager=true
qemu_manager_import=true
qemu_manager_binding=localhost
qemuwrapper_port=10525
qemuwrapper_baseUDP=20000
qemuwrapper_baseConsole=3000
default_pix_image=
default_pix_memory=128
default_pix_nic=e1000
default_pix_options=-nographic
default_pix_kqemu=false
default_pix_key="0x00000000,0x00000000,0x00000000,0x00000000"
default_pix_serial=0x12345678
default_junos_image=
default_junos_memory=96
default_junos_nic=e1000
default_junos_options=
default_junos_kqemu=false
default_junos_kvm=false
default_asa_memory=256
default_asa_nic=e1000
default_asa_options="-hdachs 980,16,32"
default_asa_kqemu=false
default_asa_kvm=false
default_asa_kernel=
default_asa_initrd=
default_asa_kernel_cmdline="auto console=ttyS0,9600 bigphysarea=16384 ide1=noprobe"
default_ids_image1=
default_ids_image2=
default_ids_memory=512
default_ids_nic=e1000
default_ids_options="-smbios type=1,product='IDS-4215'"
default_ids_kqemu=false
default_ids_kvm=false

[Capture]
working_directory=.
capture_reader_cmd=/usr/bin/wireshark %c
auto_start_cmd=true

[IOS.images]
15\filename=/home/hattori/c7200-adventerprisek9-mz.151-4.M.bin
15\chassis=7200
15\platform=c7200
15\hypervisors=
15\default_ram=256
15\idlepc=0x638617b4
15\default=true

# pwd
/home/hattori/.gns3/test/test_working

# ls
c7200-adventerprisek9-mz.151-4.M.bin-localhost.ghost
c7200_R1_bootflash
c7200_R1_disk0
c7200_R1_lock
c7200_R1_log.txt
c7200_R1_nvram
c7200_R1_rommon_vars
c7200_ghost-c7200-adventerprisek9-mz.151-4.M.bin-localhost.ghost_bootflash
c7200_ghost-c7200-adventerprisek9-mz.151-4.M.bin-localhost.ghost_disk0
c7200_ghost-c7200-adventerprisek9-mz.151-4.M.bin-localhost.ghost_log.txt
c7200_ghost-c7200-adventerprisek9-mz.151-4.M.bin-localhost.ghost_nvram

Dynamips : PPPoE : 固定IP NAT なしの設定例

PC A : 10.0.0.200 ( Gateway 10.0.0.254 )
R0 ( PPPoE Client ) : 0/1 10.0.0.254 , 0/0 unnumbered
R1 ( PPPoE Server ) : 0/0 10.0.0.1 , 0/1 20.0.0.254
PC B : 20.0.0.200 ( Gateway 20.0.0.254 )

フレッツ固定IP の設定を想定。NATしない構成。
R0 ( PPPoE Client ) の WAN 側に IP はふらない。
R0 の LAN側 e0/1 に割り当てられたグローバルIPのどれかをアサイン。
PC A にも割り当てられたグローバルIPのどれかをアサイン。

フレッツ固定IP を契約したときにもらう情報、IPアドレス、ユーザ名、パスワードの情報でR0 (PPPoE Client )の設定ができるか確認するのが目的。
PPPoE が確率できて、PC A (10.0.0.200) の IP で PC B (20.0.0.200) と通信できることを確認した。


[ config ]

- R0 ( PPPoE Client )

R0#show running-config
Building configuration...

Current configuration : 1058 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R0
!
boot-start-marker
boot-end-marker
!
enable password hello
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Ethernet0/0
no ip address
half-duplex
pppoe enable group global
pppoe-client dial-pool-number 1
!
interface Ethernet0/1
ip address 10.0.0.254 255.255.255.0
ip tcp adjust-mss 1414
half-duplex
!
interface Ethernet0/2
no ip address
shutdown
half-duplex
!
interface Ethernet0/3
no ip address
shutdown
half-duplex
!
interface Dialer1
ip unnumbered Ethernet0/1
ip mtu 1454
encapsulation ppp
dialer pool 1
dialer-group 1
ppp authentication chap callin
ppp chap hostname cisco
ppp chap password 0 cisco
!
ip http server
no ip http secure-server
ip route 0.0.0.0 0.0.0.0 Dialer1
!
!
!
dialer-list 1 protocol ip permit
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0
password hello
login
line vty 1 4
login
!
!
end

R0#

- R1 ( PPPoE Server )

R1#show running-config
Building configuration...

Current configuration : 1052 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
enable password hello
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
vpdn enable
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
username cisco password 0 cisco
!
!
!
!
!
!
bba-group pppoe global
virtual-template 1
!
bba-group pppoe test
virtual-template 1
!
!
interface Ethernet0/0
no ip address
half-duplex
pppoe enable group test
!
interface Ethernet0/1
ip address 20.0.0.254 255.255.255.0
half-duplex
!
interface Ethernet0/2
no ip address
shutdown
half-duplex
!
interface Ethernet0/3
no ip address
shutdown
half-duplex
!
interface Virtual-Template1
mtu 1454
ip address 10.0.0.1 255.255.255.0
peer default ip address pool test1
ppp authentication chap
!
ip local pool test1 10.0.0.200 10.0.0.254
ip http server
no ip http secure-server
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0
password hello
login
line vty 1 4
login
!
!
end

R1#

[ logs ]

R0 ( PPPoE Client )

R0#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
   D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
   N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
   E1 - OSPF external type 1, E2 - OSPF external type 2
   i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
   ia - IS-IS inter area, * - candidate default, U - per-user static route
   o - ODR, P - periodic downloaded static route

Gateway of last resort is 0.0.0.0 to network 0.0.0.0

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C    10.0.0.0/24 is directly connected, Ethernet0/1
C    10.0.0.1/32 is directly connected, Dialer1
S*   0.0.0.0/0 is directly connected, Dialer1

R1 ( PPPoE Server )

R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
   D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
   N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
   E1 - OSPF external type 1, E2 - OSPF external type 2
   i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
   ia - IS-IS inter area, * - candidate default, U - per-user static route
   o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

20.0.0.0/24 is subnetted, 1 subnets
C    20.0.0.0 is directly connected, Ethernet0/1
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C    10.0.0.0/24 is directly connected, Virtual-Access2.1
C    10.0.0.254/32 is directly connected, Virtual-Access2.1

[ PC A から PC B に HTTP アクセス ]

PC A のリアルIP でアクセスできた。

PC A# wget 20.0.0.200
--2010-09-17 14:49:49--  http://20.0.0.200/
20.0.0.200:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 13 [text/html]
`index.html.1' に保存中

100%[================================================>] 13       --.-K/s 時間 0s

2010-09-17 14:49:49 (2.01 MB/s) - `index.html.1' へ保存完了 [13/13]

- PC B でキャプチャしたデータ ( PC A のリアルIP でアクセスがきている )

PC A : 10.0.0.200
PC B : 20.0.0.200

PC B # tshark -i eth0 port 80
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
 0.000000   10.0.0.200 -> 20.0.0.200   TCP 48466 > http [SYN] Seq=0 Win=5840 Len=0 MSS=1414 TSV=2167766 TSER=0 WS=4
 0.000006   20.0.0.200 -> 10.0.0.200   TCP http > 48466 [SYN, ACK] Seq=0 Ack=1 Win=5792 Len=0 MSS=1460 TSV=3499115 TSER=2167766 WS=4
 0.010895   10.0.0.200 -> 20.0.0.200   TCP 48466 > http [ACK] Seq=1 Ack=1 Win=5840 Len=0 TSV=2167808 TSER=3499115
 0.010904   10.0.0.200 -> 20.0.0.200   HTTP GET / HTTP/1.0
 0.010919   20.0.0.200 -> 10.0.0.200   TCP http > 48466 [ACK] Seq=1 Ack=116 Win=5792 Len=0 TSV=3499125 TSER=2167808
 0.011749   20.0.0.200 -> 10.0.0.200   HTTP HTTP/1.1 200 OK  (text/html)
 0.011968   20.0.0.200 -> 10.0.0.200   TCP http > 48466 [FIN, ACK] Seq=275 Ack=116 Win=5792 Len=0 TSV=3499126 TSER=2167808
 0.022500   10.0.0.200 -> 20.0.0.200   TCP 48466 > http [ACK] Seq=116 Ack=275 Win=6912 Len=0 TSV=2167818 TSER=3499126
 0.022516   10.0.0.200 -> 20.0.0.200   TCP 48466 > http [FIN, ACK] Seq=116 Ack=276 Win=6912 Len=0 TSV=2167818 TSER=3499126
 0.022523   20.0.0.200 -> 10.0.0.200   TCP http > 48466 [ACK] Seq=276 Ack=117 Win=5792 Len=0 TSV=3499137 TSER=2167818