Thursday, December 2, 2010

Fix Missing eth0 When Cloning Ubuntu VMware Virtual Machines

I've found this site: http://www.orzeszek.org/blog/2010/07/25/fix-missing-eth0-when-cloning-ubuntu-vmware-virtual-machines/ that explains how to resolve this issue:

Fix Missing eth0 When Cloning Ubuntu VMware Virtual Machines
by Chris on 25 July 2010

I ran into an annoyance trying to clone some Ubuntu LAMP virtual machines that I was using for website development. Every time I cloned the virtual machine, eth0 would go missing, and ifconfig would show only the loopback device, lo.

It turns out that when you clone a VMware virtual machine, the cloned virtual machine’s network interface gets a new MAC address (which, of course, it must to work on the same LAN). But Ubuntu, and many other Linux distributions, cache the old MAC address in a configuration file.

In Ubuntu, the file is /etc/udev/rules.d/70-persistent-net.rules. After cloning, it will contain a reference to the old network interface as eth0.

The easiest way to fix this problem is to simply delete the file. Ubuntu will regenerate it properly the next time it boots up.

sudo rm /etc/udev/rules.d/70-persistent-net.rules

After deleting the file, you need to reboot. After rebooting, ifconfig should show eth0 and everything should just work.

If you’re feeling less adventurous, you can rename the file to *.old so that you can restore it if something doesn’t work:

sudo mv /etc/udev/rule.d/70-persistent-net.rules /etc/udev/rule.d/70-persistent-net.rules.old

You can also edit the file to remove the old reference to eth0, and rename the new eth1 reference to eth0. But deleting the file and rebooting seems more convenient.

The relevant filename is slightly different in other Linux distributions. For example, in Debian, the filename is /etc/udev/rules.d/z25_persistent-net.rules.

P.D.: (03-08-2011) - In Suse 9 you must delete the file /etc/sysconfig/network/ifcfg-eth-id-xx:xx:xx:xx:xx:xx where xx:xx:xx:xx:xx:xx is the old MAC address.

Sunday, November 21, 2010

How can my bash script output Unicode?

Finally I found how to print Unicode characters from a bash script: http://forums.debian.net/viewtopic.php?f=10&t=45394

Here is the code from 'hedgie' that works for me:

for dec in {9472..9599} ; do
    hex=`echo "ibase=10; obase=16; $dec" | bc`
    /usr/bin/printf \\u$hex
done

Tuesday, November 16, 2010

VMware ESX 3 – use lwp-download to grab files

If you need to download an iso file from a ESX 3.x console, you can use the command lwp-download.

First http port must be opened at firewall level:
esxcfg-firewall -o 80,tcp,out,http

Then you can get a file with the command:
lwp-download <url> [<localfilename>]

And finally you should close http port at firewall level:
esxcfg-firewall -c 80,tcp,out,http

VMware ESX 4 – use cURL to grab files

I've found this information by Eric Gray at http://www.vcritical.com/2009/05/vmware-esx-4-use-curl-to-grab-files/

I need to quickly download an ISO image to my new VMware ESX 4 box and discovered that the cURL utility is now included — pretty handy.

If you have not used cURL, it is similar to wget. However, with no parameters cURL will spew the download to standard out — definitely not what you want in the case of an ISO image. Therefore, the -O option — capital O — can be used to save the downloaded file, preserving the filename. If you happen to be behind a proxy server, don’t forget to set the http_proxy environment variable — standard Linux procedure.
[root@cl-168 Storage1]# export http_proxy=http://proxy:3128
[root@cl-168 Storage1]# curl -O http://mirros.easynews.com/linux/ubuntu-releases/hardy/ubuntu-8.04.2-server-amd64.iso
Also you can connect using ftp protocol as follows:

curl -O ftp://myftpsite.com/filename --user myname:mypassword 

Friday, November 5, 2010

Random times in a batch file

You can use random times in a batch file using something like that:

echo randomize >C:\TMP\random.vbs
echo wscript.sleep Int(Rnd * 100000) >>C:\TMP\random.vbs
cscript C:\TMP\random.vbs
dir

Here is a more elaborated example (only for the vbs script):

TopWait=8       'Max. time to wait in hours
randomize
myrand = rnd()
Wait=Int(myrand * 3600 * TopWait)  'Time to wait in seconds

Hours=Wait \ 3600
Minutes=(Wait - (Hours*3600)) \ 60
Seconds=Wait - (Hours*3600) - (Minutes*60)

WScript.Echo "Waiting: " & Wait & " seconds => " & Hours & ":" & Minutes & ":" & Seconds
wscript.sleep Wait * 1000    'Must be in miliseconds
WScript.Echo "Done: " & Wait & " seconds sleeping"

REFERENCES

WScript.Sleep
Suspend the execution of the current script for the specified number of milliseconds.

Syntax
WScript.Sleep lngTime

Arguments:
lngTime is the delay in milliseconds

Example
WScript.Sleep(5000)
WScript.Echo("5 seconds have passed.")

Rnd
Return a random number

Syntax
Rnd[(seed)]

Key
seed A seed value of 0 will return the most recent random number
A seed value > 0 will return the next random number(default)
A seed value < 0 will return the same number

Example
myrand = rnd()
WScript.Echo myrand

Thursday, November 4, 2010

Unattended access to Netscreen devices from vb script


I've found this post at experts-exchange: http://www.experts-exchange.com/Software/Internet_Email/File_Sharing/SSH_Telnet/Q_22920318.html

Here is a VBScript that should do what you are looking for. Just remember your credentials are in plain text in the script, set your permissions accordiningly:

set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "C:\putty HOSTNAME -l LOGIN -pw PASSWORD"      ' put putty in C:\
WScript.Sleep 2000
WshShell.AppActivate "HOSTNAME - PuTTY"      'insert correct hostname
WshShell.SendKeys "command"             'insert dns refresh command
WScript.Sleep 100
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "exit"
WScript.Sleep 100
WshShell.SendKeys "{ENTER}"
You will need to put putty in you C:\ directory or give it an absolute path

Good Luck

Darkstriker69

Google Public DNS

Google has two free DNS servers at 8.8.8.8 and 8.8.4.4 IPs.
http://code.google.com/intl/es-ES/speed/public-dns/

Error connecting to 127.0.0.2 in XP SP2

Symptoms

With Windows XP SP2 some applications which connect to the loop back address range may not function as expected.

Cause
Windows XP SP2 prevents connections to the loop back address range for any address other than 127.0.0.1.

Resolution
Microsoft support has an update available which addresses this issue and is available for downloading at: KB884020

The fix contains the following file info:
13-Aug-2004 22:50 5.1.2600.2505 359,040 Tcpip.sys

This update helps resolve an issue on computers running Windows XP Service Pack 2. Programs that connect to IP addresses in the loopback address range may not work as expected and you may receive an error message indicating you cannot establish a connection. After you install this item, you may have to restart your computer.

Wednesday, November 3, 2010

Cannot Run Executable File Over Network Share On Windows Server

If you have installed the Internet Enhanced Security Configuration you cannot run any executable file from a network share.

To uninstall it you can go to http://www.visualwin.com/IE-enhanced-security/ and follow the instructions to uninstall Internet Explorer Enhanced Security Configuration for non-admin users, reboot, and viola!

Friday, October 29, 2010

Windows 2003 synchronize with a NTP Server

This info is based on  http://etherealmind.com/ios-configure-windows-2003-xp-use-ntp-server-sync-time-clock-router/

Stop the Windows Time Service using the CLI.
net stop w32time

You must configure your NTP Servers:
w32tm /config /manualpeerlist:"hora.rediris.es,europe.pool.ntp.org",0x8 /syncfromflags:MANUAL
The peer list must be enclosed
Use the 0×8 flag to force W32time to send normal client requests instead of symmetric active mode packets.

Restart the Windows Time Service and then force a sync.
net start w32time
w32tm /resync

Wednesday, October 27, 2010

Save Netscreen config file from CLI

I've found this deimark's post in experts-exchange that explains how to save the Netscreen's firewall configuration from CLI.

From the webui you can save a copy of the config hen you view it. I would suggest using tftp to do this.

ie set up a tftp server and enter the following commands:

get config > tftp <ip address of tftp server> config-file.txt

Similar to what you would do for backing up and upgrading the screenos image.

Namely to back up:
save config from flash to tftp <ip address of tftp server> <filename>

To upgrade your system:
save config from tftp to flash <ip address of tftp server> <filename> to flash
reset

Junos Router Emulator

I've found this blog: http://blog.okellynet.com/?p=67

There you can find tips for download a Junos Router Emulator for Juniper routers in a VMware virtual machine.

Tuesday, October 19, 2010

Installing VMwareTools on Ubuntu

Here you can find how to install VMware tools in Ubuntu: https://help.ubuntu.com/community/VMware/Tools


# install kernel modules
sudo apt-get install --no-install-recommends open-vm-dkms
# EITHER: install tools for an xorg install
#apt-get install open-vm-tools
# OR: a headless install
sudo apt-get install --no-install-recommends open-vm-tools

Installing LAMP on Ubuntu 10.04 & MySQL Backup

Hay un artículo muy bueno aquí: http://tuxtweaks.com/2010/04/installing-lamp-on-ubuntu-10-04-lucid-lynx/ que explica como instalar LAMP (linux, Apache, MySQL, PHP) en un Ubuntu 10.04

Aquí hay un artículo que explica cómo hacer un backup de MySQL
http://www.webcheatsheet.com/SQL/mysql_backup_restore.php

Y aquí otro:
http://www.desarrolloweb.com/articulos/1202.php

Y en este blog de Gabriel Soltz hay un script para automatizar el backup de MySQL: http://knox-it.blogspot.com/2010/05/bash-backup-mysql-con-compresion-para.html

Monday, October 18, 2010

Modifying the All Users profile in Vista or Windows Server 2008

Después de volverme loco buscando la carpeta Menú de inicio para todos los usuarios en un w2008 he encontrado la solución aquí: http://blogs.technet.com/b/peterfi/archive/2008/02/24/modifying-the-all-users-profile-in-vista-or-windows-server-2008.aspx

En resumen, ahora la carpeta está aquí: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

Para acceder a la carpeta que contiene el menú de inicio para el usuario administrador tienes que ir a C:\Users\Administrador\AppData\Roaming\Microsoft\Windows\Start Menu

Para acceder a la barra Quick Lunch hay que ir a: C:\Users\Administrador\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

Friday, October 15, 2010

Convert your Windows Server 2008 to a Workstation!

I've found this web: http://www.win2008workstation.com/
On it there is a lot of usefull information to tweak a Windows Server 2008 and use it as a workstation.

There's no ftp client in VMware esx 4.1

VMware has removed ftp client tool in esx 4.1, so if you have shell scripts using ftp commands they will fail.
This applies to upgrades too, so if you have esx 4.0

Thursday, July 1, 2010

¿Cuántas pulgadas tiene que tener mi pantalla nueva?


Si ahora tengo un monitor de 17" de los de antes (relación de aspecto 4:3) y me quiero comprar uno nuevo y panorámico (relación de aspecto 16:9), ¿cuántas pulgadas tiene que tener para que sea por lo menos igual de alto?, ¿y si tengo uno de 19"?

Tuesday, May 18, 2010

Running a x64 virtual machine in vSphere


the Problem
Recently I've tried to install a virtualized W2008 (x64) R2 Server on an esx vSphere. Then I got the following error:



Windows failed to start. A recent hardware or software change might be the cause. To fix the problem:

1. Insert your Windows installation disc and restart your computer.
2. Choose your language settings, and then click "Next."
3. Click "Repair your computer."

If you do not have this disc, contact your system administrator or computer manufacturer for assistance.

File: \windows\system32\boot\winload.exe

Status: 0xc000035a

Info:    Attempting to load a 64-bit application, however this CPU is not compatible with 64-bit mode.



The vSphere server is running on a core 2 Quad server, and VSphere asks for a x64 server at installation, so what is happening?


the Solution
You need to check if your processor has VT-x capability enabled. This option should be in your motherboard's BIOS. You must enable it and then power cycle the server, if you only reboot your system you will lost hours googling like me, asking why your BIOS seems to be VT-x capable but it doesn't.
Of course, you should upgrade your motherboard's BIOS as many old versions have the capability but it's not BIOS implemented.
There is a good guide at vmware communities: http://communities.vmware.com/docs/DOC-8978 by jmmattson and also an .iso that you can boot to check if your server has VT-x enabled and thus you'll be able to install x64 virtual machines on your vSphere.