Wednesday, August 19, 2009

NAT mode and port forwarding

I am runnig Debian as guest in my VirtualBox in Windows and i want to ssh to Debian.

How ?

run debian in NAT mode and do port forwarding

go to C:\Program Files\Sun\xVM VirtualBox and run


VBoxManage setextradata "debian 5 Lenny" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage setextradata "debian 5 Lenny" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
VBoxManage setextradata "debian 5 Lenny" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 22

restart your guest

run the below to see what u have done:
VBoxManage getextradata "debian 5 Lenny" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol"
VBoxManage getextradata "debian 5 Lenny" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort"
VBoxManage getextradata "debian 5 Lenny" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort"

The info is actually stored in C:\Users\who am i\.VirtualBox\Machines\debian 5 Lenny\debian 5 Lenny.xml

here is part of the xml file:



name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" value="22"/>

name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" value="22"/>




debian 5 Lenny is the name of your guest, it is case sensitive.


from the Help:

The above example assumes a PCNet virtual network card; if you have configured the guest to use the Intel PRO/1000, replace

"pcnet" with "e1000" in the above commands. Similarly, if you want to configure a different interface instance replace the /0/

with the appropriate index. pcnet and e1000 are counted separately in this respect, and counting starts at 0 for both types.

The name guestssh is an arbitrary one chosen for this particular forwarding configuration. With that configuration in place, all

TCP connections to port 2222 on the host will be forwarded to port 22 on the guest. Protocol can be either of TCP or UDP (these

are case insensitive). To remove a mapping again, use the same commands, but leaving out the values (in this case TCP, 22 and

2222).

It is not possible to configure incoming NAT connections while the VM is running. However you can change the settings for a VM

which is currently saved (or powered off at a snapshot).


remember u need to restart your guest...


from windows: ssh to 127.0.0.1:22

Monday, August 17, 2009

hacking cisco network

Polyphemus - Polyphemus is an SNMP-based explorer and visualizer of OSPF networks

http://www.dia.uniroma3.it/~compunet/www/view/tool.php?id=polyphemus

using aptitude on Debian 5 (Lenny)

To me, using Linux is always difficult, having get used to FreeBSD...

I just don't undertstand why all those man pages could not be written with more examples...

anyway, i installed Debian 5 and wanted to install IPRAS.

aptitude could not find the package, but a search on google shows that the package exists..

http://packages.debian.org/lenny/irpas

This page advise adding "deb http://ftp.de.debian.org/debian lenny main non-free
" to /etc/apt/sources.list

but I think they miss out something.

This is what I added in my /etc/apt/sources.list :

deb http://ftp.de.debian.org/debian lenny main non-free
deb-src http://ftp.de.debian.org/debian lenny main non-free

I run "aptitude install ipras" and again it complained package not found

more googling for aptitude tutorial and found this

http://algebraicthunk.net/~dburrows/projects/aptitude/doc/en/ch01s01s05.html

so i must run aptitude and type u to do an update.

after the update, "aptitude install ipras" runs and ipras was installed!!!