20120620

GNU/Linux: Renombrar interfaz de red - GNU/Linux: Rename network interface

Hoy he clonado una máquina con VMWare para montar un cluster, y resulta que en la máquina resultante las interfaces tenían los nombres eth2 y eth3. Para poder aprovechar en lo posible la configuración de la máquina origen de la clonación, he procedido a cambiar los nombres de las interfaces con el siguiente comando:
ip link set dev nombre_actual name nuevo_nombre

Así, en mi caso sería:
ip link set dev eth2 name eth0
ip link set dev eth3 name eth1

Si lo que queremos es que los cambios se mantengan después de reiniciar el sistema, sólo debemos editar el siguiente fichero de configuración:
/etc/udev/rules.d/70-persistent-net.rules

Donde únicamente podemos cambiar el valor de la etiqueta NAME según indica un cometnario en el mismo fichero.
A que mola!!


Today I cloned a machine using VMWare to set up a cluster and at the destination machine had eth2 and eth3 as network interfaces name instead of eth0 and eth1. As I want to use the source machine configuration as much as possible I have changed the interfaces name with the following command:
ip link set dev current_name name new_name

So in this case I have typed:
ip link set dev eth2 name eth0
ip link set dev eth3 name eth1

If we want to make these changes permanent after a reboot, we have to edit the following config file:
/etc/udev/rules.d/70-persistent-net.rules

where we can only change the NAME key as is warned in the file.
Cool!!

PS. I know, I know. My English is not good enought but, the more you help me, the more I learn.

20120522

Vi: dividir la pantalla - Vi: split the window

Si vosotros sois también de esos chalaos que disfrutáis con el uso de Vi seguro este tip os será de utilidad. Si queremos dividir la pantalla de edición para editar otro archivo, o situarnos en dos puntos distintos del mismo archivo, sólo tenemos que teclear en modo comando lo siguiente:
:split

Con esto conseguiremos dividir la pantalla horizontalmente. Si lo que queremos es dividirla en vertical, teclearemos:
:vsplit

Complejo, eh!
Podemos ejecutar estas órdenes, combinándolas, tantas veces como queramos (no se si tiene límite) dividiendo una y otra vez la pantalla.

Si queremos abrir otro archivo, añadimos la ruta de este:
:split file_path
:vsplit file_path

O si lo que queremos es dividirla creando un archivo nuevo, añadiremos una n:
:split n
:vsplit n

Siempre y cuando no exista un fichero de nombre n en nuestro directorio de trabajo.
Para navegar entre las diferentes divisiones creadas, podemos utilizar:
CTRL+W W para pasar de una sección a otra hacia adelante.
CTRL+W tecla de dirección para pasar al siguiente marco en esa dirección. Podemos usar tanto las flechas como hjkl

También podemos redimensionar cada sección pulsando:
n CRTL+W + que hará crecer la sección en n líneas
n CRTL+W - que reducirá la sección en n líneas

Para cerrar cada una de ellas, como siempre :q :qw :x, etc.
Y esto es sólo el principio. Que lo disfrutéis.
:qw


If you are on of those geeks who enjoy typing and text editing with Vi I'm sure you'll find the following tip as useful as me.
You can split the the editor window typing the following while you're in command mode:
:split

To split it vertically, just type:
:vsplit

As easy as that! And we can repeat this command as many times as we like.

We can open other file on a new window typing:
:split file_path
:vsplit file_path

To create a new empty window:
:split n
:vsplit n

If there is a file called n on the working dvimirectory the previous command will open it instead of a new one :p
To navigate between the diferent divisions, we could type:
CTRL+W W to go forward to the next division
CTRL+W arroy key or khjkl to switch between windows on any direction.

We can algo change the window size typing:
n CRTL+W + qwhich will make the window grow n lines
n CRTL+W - which will srink the window n lines

And finally to close them,  :q :qw :x, etc.
This is just a piece of everything we can do with Vi. Enjoy it.
:qw

PS. I know, I know. My English is not good enought but, the more you help me, the more I learn.