« Posts tagged Linux

Asus eeebox as squid proxy

Yesterday I'ts arrived the Asus EeeBox model b202 black edition

My goal is to use this compact and very very silent appliance as a linux proxy; so I've to discard all preinstalled system and install a fresh Debian lenny.

First of all you have to choose the installation type and you have 3 way:

1- Usb Pendrive

2- Usb cdrom

3- PXE network

The first I've tried (usb pendrive) fails to boot, I don't know why but after some try I can't boot from USB pendrive; but for me is not a problem; I've also an Asus USB CD/DVDrw so I've tried to use the Debian Lenny net install cd.

Unfortunately debian Lenny installer don't recognize correctly the network card Realtek r8169, and the nework won't work...

Thinking....

Solution: use an USB netowork adapter...

Searching on my desk...

I've found a  Sitecom LN-029 that work perfectly on linux, so the installation now can start.

Install Debian without any task, so deselect "standard system" and "Desktop".

After rebooting system you can install squid and ssh so:
apt-get update && apt-get install squid squidGuard ssh

That's all, now configure squid and squidguard to fit your needs.

Backup virtual machines with Vmware consolidated Backup

To backup entire virtual machine while are running, you have to use the VBC provided by vmware.
this is a commandline tool that speaks with your VirtualCenter and tell it to create a Snapshot of a virtual machine, then detach it and copy the vmdk files to a location.

Take a look here http://www.vmware.com/products/vi/consolidated_backup.html to understand how it work.

the sintax of the command is like this:

vcbmounter.exe -m nbd -h yourvitualcenter.yourdomain -u username -p password -a name:VMname -t fullvm -r pathwheretosave

With "-m nbd" you can backup your Vm through an ethernet instead of a FibreChannel SAN connection.

Batching an ftp session under linux

A very useful script to transfer a file in FTP without interaction.
You can schedule in crontab to trasfer everything you want to a server. simply adjust parameter and voilà...
To GET a file instead of PUT simply change the line

  1.  
  2. put $FILE
  3.  

to

  1.  
  2. get $FILE
  3.  

This is the code..

  1.  
  2. #!/bin/sh
  3. HOST=your.ftp.server
  4. USER=username
  5. PASS=password
  6. FILE=file.to.transfer
  7. ftp -n<<eof
  8. open $HOST
  9. quote user $USER
  10. quote pass $PASS
  11. put $FILE
  12. bye
  13. EOF
  14.  

Phisical 2 Virtual of RedHat 9.0 kernel 2.4 smp

I've made this on a RedHat 8.0 machine... maybe you can find this useful.

This phisical machine is an IBM X series 235 with a RAID 5 server raid controller running  RedHat linux 8.0 kernel 2.4.20-8smp.

I've used the Vmware converter standalone on  my Debian Squeeze laptop to "hot import" this machine.

Unfortunately this tool can't syncrhonize data between phisical and new virtual machine, so before start the migration I had to stop Lotus Domino server to have all databases updated on the virtual machine.

The migration was completed succesfully, and I've powered on my virtual machine but the first problem is here:

A terrible message appear instead of Grub boot menu:

"Cannot load Operating System"

Thinking about.....

Ok, grub is not installed in the MBR; so I've attached a RedHat enterprise linux iso to the VM cdrom,  rebooted into a linux rescue mode; chrooted to the installation and installed grub with:

me@linuxbox#grub-install /dev/sda

then I ran kudzu daemon to remove all old devices configuration (2 broadcom network adapter) and to add new (buslogic SCSI adapter).

Next I've to change hostname and IP address; and install Vmware tools;
don't forget or skip this step, or you'll have a 10 Mbps Nic and you can receive this message in console:

eth0: RUNT packet!

CiscoBK

This is a shell script that I've wrote in order to backup my cisco devices configuration and to keep my backup update.

Features:

  • Automatically copy configuration via tftp.
  • Compare previous configurations with new downloaded with "diff" command.
  • Send email alert if configuration change and attach to alert new and old configurations.
  • Always keep a backup copy.

Configuration:

Uncompress the archive in a place like /opt/ciscobk
Take a look to ciscobk.sh in order to correct paths according to your configuration
Open etc/ciscobk/ciscobk.conf and put ip addresses of your Cisco device
Open etc/ciscobk.mail and type here mail addresses that'll receive mail alert

HowTo configure Cisco device:

First of all I'm assuming that you know what you're doing...I'm not responsible if you destroy your running config then "wr"...
Ok, we're ready, go in enable mode and simply type

myrouter# conf t
myrouter# tftp-server nvram:startup-config
myrouter# wr

Now your Cisco device is ready to serve his configuration to anyone; I recommend to use ACL's to prevent somebody hack your router...

[dm]1[/dm]