Archive | November, 2006

Ubuntu Networking on VMWare

22 Nov

1. Open the .vmx file and find the ‘ethernet0.generatedAddress’ line – this gives the MAC for the NIC
2. Turn the image on and edit /etc/iftab, entering the correct MAC address
3. Stop the image, in the ‘VMware Server Console’ select Host->Virtual Network Settings->Host Virtual Network Mapping. Select a real NIC for the VMnet0.
4. Turn image on, turn networking on: “sudo /etc/init.d/networking start”


Comparing two files

21 Nov

If you have two files and you want to select lines that exist in one file but not the other, use:

grep -Fxvf fileA fileB

Where fileB contains the superset of fileA

(the -v inverts the search, the -f makes it get search patterns from the file)

Diagnosing slow machines.

21 Nov

Check Top for high load and high IO.

If high iowait times, try running “iostat -c 1”, to see what the %iowait times are (should be <25??)

If you see high IOWait, can use the "fuser -vm /dev/sda1" to see what processes are using files on a filesystem.

Can use "mpstat -P ALL" for a summary of processor stats.

Do a "ps -el | grep ' D '" – these are processors waiting for IO.

vmstat – useful for looking at vm statistics

If network is slow, try mii-tool to check how fast your card is running



8 Nov

I found this old howto i wrote somewhere, thought i’d add it.

[if re-installing, you’ll need to delete /etc/site.key]

$> cd /etc/tripwire
$> ./ // will install

$> /usr/sbin/twadmin –create-polfile twpol.txt // will create a
policy files

[you can edit the twpol.txt policy file now, or wait until after the
next step
so you can see what is wrong with it]

$> /usr/sbin/tripwire –init // initialise the
policy file – this
// will show any
errors etc

[you should probably delete the twpol.txt file now – you can always
recreate it from
the encoded db as long as you know your password]

If the twpol.txt file does not exist, recreate it:

$> /usr/sbin/twadmin –print-polfile > /etc/tripwire/twpol.txt //
create readable policy file from encoded db

now edit twpol.txt to your liking

then create new database:

$> /usr/sbin/twadmin –create-polfile -S site.key /etc/tripwire/twpol.txt

then delete the old encoded db:

$> rm /var/lib/tripwire/imvs$.twd

recreate the encoded database from the new twpol.txt file

$> /usr/sbin/tripwire –init // recreate
encoded db

(To make sure changes took effect, run tripwire again –
/usr/sbin/tripwire –check)

Run tripwire

$> /usr/sbin/tripwire –check

UPGRADE POLICY (Required if tripwire caught anything)
If changes have been found, you can update your policy db in two ways:

$> /usr/sbin/tripwire –update –twrfile /var/lib/tripwire

or you can run a check interactively

$> /usr/sbin/tripwire –check –interactive

Awk – printing previous line

8 Nov

Print a previous line of a match
awk '/findme/{print pNR, p0}{pNR=NR;p0=$0}'