Saltar al contenido

Linux

VNC Server para Linux : Instala un servidor VNC en Linux para acceder remotamente via web.

Vamos a configurar nuestro Ubuntu para poder acceder remotamente al escritorio mediante VNC a través de cualquier navegador.

Instalamos los paquetes necesarios:

sudo aptitude install x11vnc

sudo aptitude install vnc-java

Una vez instalados, ejecutamos en consola lo siguiente (SIN superusuario).

x11vnc -storepasswd

Introducimos la clave que queramos.

Ahora abrimos los puertos 5800 y 5900 en nuestro router o firewall hacia nuestra IP (interna).

Ejecutamos el siguiente comando para levantar el servidor:

x11vnc -forever -usepw -httpdir /usr/share/vnc-java/ -httpport 5800

Si queréis que se inicie al inicio del sistema debéis ir a:

Sistema/Preferencias/Aplicaciones al inicio

Le dais a añadir y en COMANDO ponéis:

x11vnc -forever -usepw -httpdir /usr/share/vnc-java/ -httpport 5800

Ahora para acceder al ordenador basta con poner en el navegador:

http://IP:5800

También podréis acceder con un Host DynDNS

Se puede cambiar el puerto de escucha.

Si tenéis el equipo configurado para arrancarlo remotamente (WOL) deberéis acceder antes por SSH al equipo (Servidor SSH en Ubuntu : Manual para configurar un servidor SSH en Ubuntu y entrar a tu equipo de forma remota con seguridad), loguearse con la cuenta y ejecutar el comando:

x11vnc -forever -usepw -httpdir /usr/share/vnc-java/ -httpport 5800

Para levantar el servidor VNC.

Clone and move virtual machines in VirtualBox

It describes cloning and moving virtual machines in VirtualBox.

I’m a big fan of VirtualBox. The tool enables me to extend a machine beyond its normal capabilities, test operating systems without getting invasive with my host, and kick the tires on various software titles without installing them on my production machine. But sometimes I get a virtual machine up and running and want to copy it (to move it to another machine or to have a second instance to test); when that time comes, I don’t want to completely re-install the operating system and get it to the state I need. In this situation, I clone the virtual machine.When you clone a drive, you make an exact copy of the virtual machine that can be used on either the same host or moved to another VirtualBox host. The process of cloning and moving a virtual machine is now easy in VirtualBox. In fact, there are no more commands for cloning, as the process is built into the GUI. I’ll walk through this process and then move the resulting clone to another machine for use.

What you need

  • VirtualBox installed (the host platform doesn’t matter)
  • A running virtual machine
  • The ability to move the clone from one machine to another (shared drive, external drive, disk, etc.)

Cloning a virtual machine

Step 1: Close the virtual machine

You cannot pause the machine that is going to be cloned and then clone it — the machine must be turned off.

Step 2: Start the cloning process

Select the virtual machine you want to clone in the left pane of the VirtualBox main window. Click the Snapshots tab (Figure A) and then click the small sheep icon.

Figure A

A Ubuntu 12.04 virtual machine with no snapshots taken.

The wizard that opens is a simple two-step process. The first step requires you to give the clone a name; you must give this clone a different name than the source virtual machine. By default, VirtualBox will append “clone” at the end of the name of the source virtual machine. You can keep this, and it should work fine. The second phase of the wizard asks the type of clone you want to create (Figure B). You will want to create a full clone, since our goal is to move this virtual machine to a new host.

Figure B

Read carefully the difference between full and linked clones.

Step 3: Locate and move the clone

You will be looking for a .vdi file. The location of this file will depend upon the host platform. On my Linux host, the file will be found in ~/VirtualBox VMs. Within that directory, you will find sub-directories of all your virtual machines. Within the virtual machine directory in question, you will find the .vdi file of the cloned virtual machines — that is, the file that must be moved to the new host. Copy that file to an external or shared drive and then copy it onto the new host (the location doesn’t matter).

Step 4: Create a new virtual machine

The process of creating the new virtual machine will be the same as if you were creating a standard virtual machine until you get to the Virtual Hard Disk creation screen (Figure C). You will select Use Existing Hard Disk, click the folder icon, navigate to the newly copied .vdi file, select the file in question, and then click Next.

Figure C

I’m almost finished adding my clone to a new host.

Once the new virtual machine is created, that virtual machine should fire up as expected and regardless of platform (I have tested this going from Linux to Linux, Linux to Windows, and Windows to Linux hosts).

Summary

The ability to clone and move virtual machines in VirtualBox as easily as shown above makes this a great tool for anyone who needs to expand their world with virtual machines. Give this a try and see how far you extend the reach of your hosts and guests with VirtualBox.

VirtualBox – Red visible máquina virtual (Servidor único interface)

  • admin 

Al trabajar con Máquinas Virtuales será necesario añadir interfaces de red de varios tipos, según nuestras necesidades:

– Bridged : Comparte el rango de red de la máquina anfitrión (la máquina en la que está instalado virtualbox).

– Host-only (Sólo anfitrión) : Crea una red para compartir solamente con el anfitrión.

– Red Interna :Para comunicarse con otras máquinas virtuales que estén ejecutándose a la vez en la misma máquina y poseer una interfaz de red interna que nos facilitará la conexión con las máquinas virtuales cliente (situadas tambien en la red interna).

 NAT : Crea una interfaz en el rango 10.0.0.0 que crea una conexión NAT (traduce entre una dirección IP y la otra) con la red del anfitrión.


Cuando creas una máquina virtual con VirtualBox, con las opciones de red por defecto, esta  con conexión a cualquier recurso en la red al que tenga acceso la máquina anfitriona (conexión a Internet incluida) y puede compartir archivos con ella si configuramos la opción de “Directorios Compartidos”, pero entre máquina anfitriona y máquina virtual no existe ninguna otra posible conexión. La máquina virtual tampoco es accesible de ninguna forma desde otra máquina de nuestra red local y si abrimos dos máquinas virtuales en la misma máquina anfitriona tampoco pueden verse entre si. Esto puede cambiarse fácilmente para que cualquier máquina virtual que creemos sea totalmente visible, tanto por la máquina anfitriona, como por cualquier otra máquina  (o virtual, en esta u otra máquina anfitriona configurada por este mismo método) como si se tratase verdaderamente de una máquina real conectada de forma  a nuestra red. Nos ponemos a ello.

Partimos de una máquina anfitriona con Debian o una distribución derivada (Ubuntu, Kubuntu, etc.), que ya tiene Virtualbox instalado y cuenta con una única interfaz de red (eth0). Lo primero que tenemos que hacer es instalar el paquete bridge-utils.

pablo@pablo-U-100:~$ sudo apt-get install bridge-utils

Luego editamos la configuración de nuestro interface ethernet (/etc/network/interfaces) y lo dejamos de esta forma:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto br0
iface br0 inet dhcp
bridge_ports eth0 vbox0 vbox1

Las líneas en negritas son las que hemos añadido. En ellas estamos definiendo dos interfaces virtuales (vbox0 y vbox1) que están ligados a nuestro interfaz físico real (eth0) y que tomaran una IP de forma dinámica a través de un servicio DHCP que debemos de tener disponible en nuestra red. Esto no quiere decir que no podamos ponerles direcciones fijas a nuestras máquinas virtuales: Estas tendrán disponible este servicio, si existe, desde su arranque pero luego nosotros podremos configurarlas perfectamente mediante IP’s estáticas sin ningún problema, ya dentro del sistema operativo que hayamos elegido para ellas. Por cierto: hemos creado dos interfaces por que es lo que necesitamos (yo, en concreto, quiero hacer prácticas para los chicos con un windows 2003 server y un windows xp que deben de verse para que el segundo se conecte al dominio definido por el primero) pero, lógicamente, podríamos definir una sóla. O diez 🙂 .

Ahora editamos el archivo de configuración de interfaces de virtualbox (/etc/vbox/interfaces) y añadimos las siguientes líneas:

vbox0 pablo br0
vbox1 pablo br0

En ellas redefinimos los dos nuevos interfaces virtuales que hemos creado (vbox0 y vbox1) y declaramos el usuario de la máquina anfitriona que tiene permiso para usarlos.

Ya casi estamos. Ahora reiniciamos, por este orden, la interfaz de red física de nuesta máquina anfitriona y luego virtualbox:

pablo@pablo-U-100:~$ sudo /etc/init.d/networking restart
* Reconfiguring network interfaces…
(…)
bound to 192.168.1.10 — renewal in 39314 seconds.
[ OK ]

pablo@pablo-U-100:~$ sudo /etc/init.d/virtualbox-ose restart
* Shutting down VirtualBox host networking
* done.
* Starting VirtualBox host networking
* done.

Luego iniciamos Virtualbox y configuramos la red de las máquinas que queremos hacer accesibles de esta forma:

Y con esto ya si que hemos acabado. En el siguiente pantallazo (ampliable si hacéis click en él) podéis ver como mis dos máquinas virtuales se ven perfectamente (la XP tomando su IP mediante DHCP, el 2003 server con IP estática configurada manualmente), la autenticación de dominio entre ellos se ha hecho perfectamente y ambas son visibles también desde la máquina anfitriona.

TCPDump: Capture and Record Specific Protocols / Port

  • admin 

Q. How do I capture specific protocol or port such as 80 ( http ) using TCPDump tool under Linux / UNIX? How do I recording Traffic with TCPDump and find problems later on?

A. TCPDump is a tool for network monitoring and data acquisition. It can save lots of time and can be used for debugging network or server related problems. Tcpdump prints out a description of the contents of packets on a network interface that match the boolean expression.

Monitor all packets on eth1 interface

tcpdump -i eth1

Monitor all traffic on port 80 ( HTTP )

tcpdump -i eth1 ‘port 80’

Monitor all traffic on port 25 ( SMTP )

tcpdump -vv -x -X -s 1500 -i eth1 ‘port 25’

Where,

-vv : More verbose output
-x : When parsing and printing, in addition to printing the headers of each packet, print the data of each packet.
-X : hen parsing and printing, in addition to printing the headers of each packet, print the data of each packet (minus its link level header) in hex and ASCII. This is very handy for analysing new protocols.
-s 1500: Snarf snaplen bytes of data from each packet rather than the default of 68. This is useful to see lots of information.
-i eth1 : Monitor eth1 interface
Capturing traffic information using cronjobs

tcpdump can be used to find out about attacks and other problems. Let us say your webserver facing problem everday at midnight. Enter following command into cron. It will schedule capturing of 30,000 packets and writing raw data to a file called port.80.debug.txt:
@midnight /usr/sbin/tcpdump -n -c 30000 -w /root/port.80.debug.txt

Next day you can log into your box and read the /root/port.80.debug.txt file:
tcpdump -X -vv -r /root/port.80.debug.txt

This simple technique can be used record and debug problems.

Further readings:

man page tcpdump

Programas para averiguar procesos en ejecución y puertos asociados.

  • admin 

Recuerde que algunos de estos pueden requerir que usted los ejecute como root.

Netstat

$ sudo -i

$ netstat -tulpn

netstat

De esta salida se puede ver, es decir, «proceso de vpn IKED»

Proceso se está ejecutando en PID 1189 y utiliza 2 puertos UDP, el puerto 4500 y 500. Ahora podemos comprobar el número de PID 1189 mediante la ejecución de procesos.

$ ls -l /proc/1189/exe

proc

Ahora vamos a filtrar la información de salida del comando netstat usando grep en el puerto 22 utilizado por ssh:

grep

Fuser

Fuser es también fácil de utilizar para alcanzar nuestros objetivos

$ fuser 4500/udp

$ ls -l /proc/1189/exe

El proceso se devuelve el nombre IKED… si usted no sabe este proceso, tan sólo ejecute comando man para la descripción del proceso:

$ man iked

fusor

Task

Este comando es útil para descubrir el directorio de trabajo de un proceso, es decir, IKED o PID 1189

$ ls -l /proc/1189/cwd

$ pwdx 1189

Para descubrir el dueño del proceso, es decir, IKED o PID 1189

$ ps aux | grep 1189

o el uso de medio ambiente

$ cat /proc/1189/environ

gato

ldentifying Open Ports

$ grep port /etc/services

$ grep 2432 /etc/services

servicios

Si está ejecutando un servidor público, obviamente conectado a Internet. Recomiendo encarecidamente que compruebe si hay software de rootkit (s). Rootkit en términos linux ilegal o ilegítimo «raíz» de acceso a su sistema, en cuanto a las ventanas que se llama «administrador» de acceso.

Ir a su centro de Ubuntu instalar un escáner que llena sus necesidades:

centro de Ubuntu

 

Arraigado servidores se utilizan generalmente para SPAM / malware / Proxy o el estilo Dos ataques en otras redes o computadoras. Mantenga un ojo ocasionales en los gráficos de ancho de banda como medida de precaución.