soekris netboot

Sådan her får man en soekris net4801 (fucked enhed til tider) til at netboote selvom der sidder en harddisk eller CF kort i.

tryk CTRL+P for at afbryde den inden den når at autoboote.
skriv: boot f0

Udgivet i Knowledge Base, Networking, Old Base | Skriv en kommentar

Hotswaping SCSI in FreeBSD

camcontrol stop sd0

stops device sd0 , flushes cache’s and stuff

camcontrol rescan all

scan all scsi busses for new devices.

Udgivet i FreeBSD, Knowledge Base, Old Base | Skriv en kommentar

Password recovery Cisco 2924(xl)

Step 1 .

How to connect to the Switch :

Attach a terminal or PC with terminal emulation (for example, Hyper Terminal) to the console port of the switch. Use the following terminal settings:

9600 baud rate
No parity
8 data bits
1 stop bit
No flow control

Step 2 .

Unplug the power cable.

Hold down the mode button located on the left side of the front panel, while reconnecting the power cord to the switch. You can release the mode button a second or two after the LED above port 1x is no longer illuminated.

You would get the output below on the Hyperterminal window :

The system has been interrupted prior to initializing the flash file system.
The following commands will initialize the flash file system, and finish loading
the operating system software:

flash_init
load_helper
boot

Step 3 .

Type flash_init.

Type load_helper.

Type dir flash:.

!— Make sure to type a colon “:” after the dir flash

You would get the output below on the Hyperterminal window :

Directory of flash:
2 -rwx 843947 Mar 01 1993 00:02:18 C2900XL-h-mz-112.8-SA
4 drwx 3776 Mar 01 1993 01:23:24 html
66 -rwx 130 Jan 01 1970 00:01:19 env_vars
68 -rwx 1296 Mar 01 1993 06:55:51 config.text
1728000 bytes total (456704 bytes free)

config.text is the startup-configuration file which is stored in the flash and loaded when the switch loads.

Step 4 .

Type rename flash:config.text flash:config.old to rename the configuration file.

This file contains the password definition.

Type boot to boot the system

Udgivet i Knowledge Base, Linux, Networking, Old Base | Skriv en kommentar

Hvordan sender jeg en e-mail til en mobiltelefon?

For at sende en e-mail til en dansk mobiltelefon, skal du blot kende modtagerens mobiltelefonnummer og udbyder.

Bemærk:
Pr. 1. maj 2002 er det ikke længere muligt at bruge dette script til at sende SMS til mobiltelefoner på TDC Mobils netværk.
Pr. 10. juni 2002 er det ikke længere muligt at bruge dette script til at sende SMS til mobiltelefoner på Oranges netværk.

For at sende en e-mail til en Sonofon-kunde, skal du eksempelvis blot skrive adressen 99887766@note.sonofon.dk i modtagerfeltet. Husk at der er grænser for hvor mange tegn man kan læse på mobiltelefonen.

Pr. 14. november 2000 ser nummerserierne til GSM-telefoner således ud:
Nummerserie SMS-server
2010xxxx – 2059xxxx @sms.tdm.dk
2060xxxx – 2099xxxx @note.sonofon.dk
2110xxxx – 2199xxxx @sms.tdm.dk
2210xxxx – 2299xxxx @note.sonofon.dk
2310xxxx – 2399xxxx @sms.tdm.dk
2610xxxx – 2699xxxx @sms.mobilix.dk
2810xxxx – 2899xxxx @gsm1800.telia.dk
2991xxxx – 2992xxxx @sms.tdm.dk
3010xxxx – 3099xxxx @sms.tdm.dk
4010xxxx – 4049xxxx @sms.tdm.dk
4050xxxx – 4099xxxx @note.sonofon.dk

Bemærk at oversigten kun nævner de selskaber, der har eget GSM-net. Selskaber som TeleFona og Debitel lejer sig ind på nettene hos TeleDanmark Mobil og Sonofon, og SMS-serverne er derfor ikke deres egne.

For yderligere oplysning om telefonnumre se Telestyrelsens disponering af nummerressourcer http://www.tst.dk/dk/branche/nummerlister.htm

Udgivet i Knowledge Base, Linux, Old Base | Skriv en kommentar

TLD Database

http://www.iana.org/root-whois/

Udgivet i Knowledge Base, Links, Linux, Old Base | Skriv en kommentar

Utilize local gentoo mirror

SYNC=”rsync://192.168.10.200/gentoo-portage/”
GENTOO_MIRRORS=”ftp://192.168.10.200″

Udgivet i Knowledge Base, Linux, Old Base | Skriv en kommentar

halt.c linux

Dont ask, its a result from a reverse engineering of has shutdown -h

halt.c
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(void)
{
int fh;
fh=open(“/dev/initctl”, O_WRONLY);
write(fh, “i\31\t\3\1\0\0\0000\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0”, 384);
close(fh);
}
—-endfile

cc halt.c -o myhalt
./myhalt

and everything gos puf…en poweroff. 😀

Udgivet i Knowledge Base, Linux, Old Base, Programmering | Skriv en kommentar

Hvorfor nej til EU

Nitrit i øko pølser
http://nyhederne.tv2.dk/article.php?id=1924680&forside

Udgivet i Knowledge Base, Links, Old Base | Skriv en kommentar

Automatic DNS check of apache virtualhosts

#!/usr/bin/perl

$space=65;
$myip="212.242.77.75";      # Domains with this ip gets "working" stamp
open(fh, "/usr/local/apache2/conf/httpd.conf");
while ($dat=<fh>)
{
        if ($dat=~ /servername/i)
        {
                $dat =~ s/ //g;chop($dat);
                if ( lc ( substr($dat,0,10)) eq "servername")
                {
                        $domain=substr($dat,10,length($dat));
                        print $domain;
                        $res = `host -t a $domain`;

                        $i=length($domain); while ($i<40) {print " "; $i++;}

                        @ip=split(" ",$res);

                        if ($res =~ /NXDOMAIN/)                 {print "Not working(No A)";}
                        elsif ($res =~ /SERVFAIL/)              {print "Not working(No NS)";}
                        elsif ($res =~ /is an alias/)           {
                                                                        if (@ip[9] eq $myip) { print "Working";}
                                                                        else { print "CNAME ".@ip[5]."=>".@ip[9]; }
                                                                }
                        elsif ($res =~ /has address/)           {
                                                                        if (@ip[3] eq $myip) { print "Working"; }
                                                                        else { print @ip[3];}
                                                                }
                        else {print "Not working";}
                        print "\n";
                }
        }
}
close(fh);

 

Udgivet i Apache, Knowledge Base, Networking, Old Base | Skriv en kommentar

Alternativ brug al grafikram. (Linux)

Et lækkert hack jeg fandt.
Har bibeholdt den oprindelige hackers navn i teksten, for at give ham den credit jeg mener han fortjener.

-------------------
VRAM Storage Device - How to use the memory on GFX board in a different way...
2002-09-03 01:09 by Michał Schulz

Have you ever thought why does your graphics card have so much memory? Do You think you have not enough RAM or awfully slow swap file? Do you need fast ram-disk or diskless machine? Go for it! Take one of these cheap 32MB graphics cards and enjoy the speed.

1. Requirements

In order to use VRAM as a storage device you need:

    * XFree86,
    * MTD compiled as the modules (especially slram),
    * Gfx card with tons of memory which we would never use otherwise.

2. Preparation

In order to use the memory you have to find, where Gfx video ram is placed within PCI address space. It can be done in many different ways. What I did first was the general check of GFX card resources:

   1.

      execute lspci (or even better lspci -vvv) and look for the entry called similar to "VGA compatible controller". There should be at last one such entry which describes GFX card and its resources. In my case it looked as follows:

01:00.0 VGA compatible controller: nVidia Corporation Vanta [NV6] (rev
15) (prog-if 00 [VGA])
        Flags: bus master, 66Mhz, medium devsel, latency 248, IRQ 10
        Memory at d6000000 (32-bit, non-prefetchable) [size=16M]
        Memory at d4000000 (32-bit, prefetchable) [size=32M]
        Expansion ROM at <unassigned> [disabled] [size=64K]
        Capabilities: [60] Power Management version 1
        Capabilities: [44] AGP version 2.0

      There are two addresses possible. Please note, that this is true for NVidia cards only. Others may have more or less address spaces. One of "Memory at" entries here says about MMIO address space. The other is gfx ram. This information is not enough, so it's high time to ask XFree86 about some details.
   2.

      XFree86 puts some log information on the screen. They are also recorder in /var/log/ in XFree86.log (or sometimes XFree86.0.log and so on). One can find all needed information about GFX ram (which is also called here linerar framebuffer):

meehow:~# cat /var/log/XFree86.0.log |grep framebuffer
(**) NV(0): Depth 24, (--) framebuffer bpp 32
(--) NV(0): Linear framebuffer at 0xD4000000

      As You may see, in my case GFX ram starts at physical address 0xd4000000. Now when one knows how much memory hes card has and where it starts, the experiment may be performed!

3. Configuring MTD

MTD is the acronym for Memory Technology Devices (please look at http://www.linux-mtd.infradead.org/ for more details), allowing us to use Flash memories, DoC devices and others. Now I'm going to use it in a bit unusual way (though very simple).

One of mtd drivers handles RAM devices directly accessed through PCI bus. As we may read:

Many PC chipsets are incapable of correctly caching system memory above 64M or 512M. A driver exists which allows you to use this memory with the linux-mtd system.

It's the different issue but fits perfectly now. We do have an additional memory. We cannot add it for the kernel use (that would require some more sophisticated tricks and would be not too efficient). But of course we may use is as a block or a char device. Driver which handles that is called slram. (CONFIG_MTD_SLRAM kernel option). Besides this we will need mtdcore, mtdblock (if the block access is needed) and/or mtdchar (if the char access required).
4. Few calculations

XFree86 uses PCI information to know where it should create a displayable image. That means if we will decrease the video memory size and tell XFree86 that the video card has less memory than it can detect, the rest will remain unused and untouched by the X11. It will be possible then to use it ourself.

The quantity of the video memory needed for X11 depends on the video resolutions used. The easiest is to multiply width by height by bytes_per_pixel of the highest mode used by XFree86 on the machine. Than some quantity may be added which will be used by for example XAA extension. Please note, that most common GFX cards use FOUR bytes per pixel in 24bpp modes. If you use the framebuffer console, you must take account at it's resolution as well.

Let's assume, that we decided to give 4MB of memory for XFree86 (4MB is 0x00400000 in hex). If the video framebuffer starts at 0xd4000000, then the memory available for MTD will begin at (0xd4000000 + 0x00400000) 0xd4400000. What we know now is the location and the size of memory for our device.
5. Fixing the XF86Config

In order to tell XFree86 how much memory it should use, you have to fix XFree86 a bit. Otherwise, X11 will detect memory size and use it all. We don't want that. In a Device section you need to add the line:

VideoRam 4096

It will limit the video area to 4MB. If XFree86 has to be restarted after this fix.

CAUTUION! It WILL NOT work with nVidias binary drivers. They just ignore VideoRam option! On the other hand it works perfectly with XFree86's nv driver.
6. Birth of MTD device

Everything is prepared now. We may begin then:

meehow:~# modprobe slram map=VRAM,0xd4400000,+0x00c00000

My graphics card has 16MB memory onboard. I've left 4MB for X11 driver. The rest (12MB = 0x00c00000) is for MTD device. Let's have a look whether we succeed:

meehow:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00b00000 00010000 "VRAM"

Hooray! The mtd0 device is installed and redy for use. How to work with it? Quite easy. First of all you must check whether /dev/mtd0 and /dev/mtdblock0 devices are present in the system (it will be of course different on systems with devfs). If they are not there, they must be created. If the char device is needed, one has to type:

meehow:~# mknod /dev/mtd0 c 90 0

And be sure that mtdchar module is loaded (or make sure that kernel will load it when needed). For block device:

meehow:~# mknod /dev/mtdblock0 b 31 0

And the module needed to access it is mtdblock now.

The device is set up. That's all. Anyone survived?
7. What the hell can I do with that?

Well, many things. When I was thinking about it, I have found two ways to use it. One of them is making any filesystem on that:

meehow:~# mkfs.ext2 /dev/mtdblock0

and mounting it somewhere, the other is more sophisticated:

meehow:~# mkswap /dev/mtdblock0
Setting up swapspace version 1, size = 12582912 bytes

meehow:~# swapon /dev/mtdblock0

Later on, more possibilities occur. You can use this methon in X11 terminals, to limit network bandwitch for example. During bootup such terminal would load kernel and compressed filesystem. The FS may be placed then on such mtdblock device and kernel may boot from it. Using console-only server with some kind of modern 32MB gfx card may use the vram as huge swap (which is way faster than swap on disk). New ideas are welcome :) Contact me at: michal.schulz(at)tu-clausthal.de
Udgivet i Knowledge Base, Linux, Old Base | Skriv en kommentar