Cisco 1760 DHCP Server (Untested)

conf t
service dhcp
ip dhcp pool 192.168.1.0/24
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
dns-server 192.168.1.5 192.168.1.6
exit
ip dhcp excluded-address 192.168.1.1 192.168.1.199
ip dhcp excluded-address 192.168.1.241 192.168.1.255
^Z

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

IOS Firewall

http://articles.techrepublic.com.com/5100-1035-1040244.html

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

Setting up NAT on Cisco 1760

Using 1011 out of 29688 bytes
!
! Last configuration change at 17:30:36 UTC Fri Feb 24 2006
! NVRAM config last updated at 17:32:38 UTC Fri Feb 24 2006
!
version 12.2
service config
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname bgw.sk.mcn.dk
!
logging queue-limit 100
!
ip subnet-zero
!
bridge irb
!
interface ATM0/0
no ip address
shutdown
no atm ilmi-keepalive
dsl equipment-type CPE
dsl operating-mode GSHDSL symmetric annex A
dsl linerate AUTO
!
interface FastEthernet0/0
ip address 192.168.123.1 255.255.255.0
ip nat inside
no ip mroute-cache
speed auto
!
interface Ethernet1/0
ip address dhcp
ip nat outside
half-duplex
!
ip classless
ip route 0.0.0.0 0.0.0.0 192.168.1.1
no ip http server
no ip http secure-server
!
access-list 1 permit 192.0.0.0 0.255.255.255
!
bridge 1 protocol ieee
bridge 1 route ip
!
line con 0
line aux 0
line vty 0 4
!
no scheduler allocate
end

bgw.sk.mcn.dk#

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

MCN Net V 1.0

vlan database
vlan 2 name SKNET
vlan 21 name MCN-DMZ
vlan 22 name MCN
exit
conf t
in fa0/1
switchport mode trunk
switchport trunk encapsulation dot1q
switchport trunk allowed vlan all
exit
in fa0/2
switchport mode trunk
switchport trunk encapsulation dot1q
switchport trunk allowed vlan all
exit
in fa0/3
switchport mode access
switchport access vlan 22
exit
in fa0/4
switchport mode access
switchport access vlan 22
exit
in fa0/5
switchport mode access
switchport access vlan 22
exit
in fa0/6
switchport mode access
switchport access vlan 22
exit
in fa0/7
switchport mode access
switchport access vlan 22
exit
in fa0/8
switchport mode access
switchport access vlan 22
exit
in fa0/9
switchport mode access
switchport access vlan 22
exit
in fa0/10
switchport mode access
switchport access vlan 22
exit
in fa0/11
switchport mode access
switchport access vlan 22
exit
in fa0/12
switchport mode access
switchport access vlan 22
exit
in fa0/13
switchport mode access
switchport access vlan 22
exit
in fa0/14
switchport mode access
switchport access vlan 22
exit
in fa0/15
switchport mode access
switchport access vlan 22
exit
in fa0/16
switchport mode access
switchport access vlan 22
exit
in fa0/17
switchport mode access
switchport access vlan 2
exit
in fa0/18
switchport mode access
switchport access vlan 2
exit
in fa0/19
switchport mode access
switchport access vlan 2
exit
in fa0/20
switchport mode access
switchport access vlan 2
exit
in fa0/21
switchport mode access
switchport access vlan 2
exit
in fa0/22
switchport mode access
switchport access vlan 2
exit
in fa0/23
switchport mode access
switchport access vlan 2
exit
in fa0/24
switchport mode access
switchport access vlan 2
exit
exit

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

Recovering a partition table or masterblock after weird crashes

If your boss accidently overwrites the first few megabytes of you harddrive, both the partition table, and the superblock, all is lost. Or is it?

Boot the machine in any way you can, and if it’s not already there, get the tool called ‘testdisk’.

Debian / Ubuntu:
# apt-get install testdisk
Gentoo:
# emerge -av testdisk

testdisk can scan the disk for partition boundaries, so if you can remember some of the layout, it’s proably possible to restore the partition table.
Also it can scan the partitions for possible ext2 superblock backups, and restore them, if the main superblock has gone AWOL.

Just a hint 😉

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

APC UPS Deamon for Linux

how to install APC UPS CS500 on linux

Install APCUPS Deamon:
Debian:
# apt-get install apcupsd
Gentoo:
emerge -av apcupsd

Edit /etc/apcupsd/apcupsd.conf:

1: If running on USB, set UPSTYPE to usb (default is apcsmart)
2: If running on USB, set DEVICE to noting, if RS-232, set the serial device in stead.
3: If running a slave deamon, connecting to another host, which has the connection to the UPS, set DEVICE to net and DEVICE to hostname:port (default port is 3551)
4: If running a master deamon, which other hosts need to connect to, change NISIP to 0.0.0.0 or appropriate subnet address.

Edit /etc/default/apcupsd, set ISCONFIGURED=yes

Plug in the UPS Cable.

Fire up the deamon:
# /etc/init.d/apcupsd start

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

ASN.1 to Java conversion

Extract the keys you need from details in JMibBrowser, only Name, Parent and Number.

Use the following Find and replace in Visual Studio:

Find:
(.*Name:b*\::b*){:i}\n(.*Parent:b*\::b*){:i}\n(.*Number:b*\::b*){:z}

Replace:
public static final String \1 = \2 + “.\3”;

more to come…

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

HT-TXQ120 Region unlock

Jeg aner ikke hvor længe dette virker, om det skal gøres hvergang du vil se en film eller om afspilleren husker det. Jeg ved det gjorde sådan at jeg kunne se mine Region 1 startrek DVD’er.

Fjern DVD’en så maskinen er tom

Tryk: Enter
Efterfulgt af flg. talkombination hurtigt efter hinanden: 8,4,2,6,9
Afslut med: Enter

nu kan du sætte en hvilken somhelst regions cd i og afspille den(har dog kun verificeret dette med region 1 cd’er)

Udgivet i Knowledge Base, Old Base | Skriv en kommentar

Nagios module: check MD Arrays

#!/usr/bin/perl -w
# vim:ts=4
#
# Check RAID status. Look for any known types
# of RAID configurations, and check them all.
# Return CRITICAL if in a DEGRADED state, since
# if the whole array has failed you’ll have already noticed it!
# Return UNKNOWN if there are no RAID configs that can be found.
#
# S Shipway, university of auckland

use strict;
use Getopt::Long;
use vars qw($opt_v $opt_d $opt_h $opt_W $opt_S);
my(%ERRORS) = ( OK=>0, WARNING=>1, CRITICAL=>2, UNKNOWN=>3, WARN=>1, CRIT=>2 );
my($message, $status);
my(@ignore);
#####################################################################
sub print_usage () {
print “Usage: check_raid [list of devices to ignore]\n”;
print ” check_raid -v\n”;
print ” check_raid -h\n”;
}

sub print_help () {
print “check_raid, Revision: 0.1 \n”;
print “Copyright (c) 2004 S Shipway
This plugin reports the current server’s RAID status
“;
print_usage();
}

#####################################################################
# return true if parameter is not in ignore list
sub valid($) {
my($v) = $_[0];
$v = lc $v;
foreach ( @ignore ) { return 0 if((lc $_) eq $v); }
return 1;
}
#####################################################################
sub check_metastat {
my($l,$s,$d,$sd);

open METASTAT,”/usr/sbin/metastat |” or return;
while( $l = <METASTAT> ) {
chomp $l;
if($l =~ /^(\S+):/) { $d = $1; $sd = ”; next; }
if($l =~ /Submirror \d+:\s+(\S+)/) { $sd = $1; next; }
if($l =~ /State: (\S.+)/) { $s = $1;
if($sd and valid($sd) and valid($d)) {
if($s =~ /Okay/i) {
# no worries…
} elsif($s =~ /Resync/i) {
$status = $ERRORS{WARNING} if(!$status);
} else {
$status = $ERRORS{ERROR};
}
$message .= “$d:$sd:$s “;
}
}
}
close METASTAT;
}
sub check_megaide {
my($f,$l);
my($s,$n);
my($CMD);

foreach $f ( glob(‘/proc/megaide/*/status’) ) {
if( -r $f ) { $CMD = “<$f”; }
else { $CMD = “sudo cat $f |”; }
open MEGAIDE,$CMD or next;
while( $l = <MEGAIDE> ) {
if( $l =~ /Status\s*:\s*(\S+).*Logical Drive.*:\s*(\d+)/i ) {
($s,$n)=($1,$2);
next if(!valid($n));
if($s ne ‘ONLINE’) {
$status = $ERRORS{CRITICAL};
$message .= “Megaide:$n:$s “;
} else {
$message .= “Megaide:$n:$s “;
}
last;
}
}
close MEGAIDE;
}
}
sub check_mdstat {
my($l);
my($s,$n,$f);

open MDSTAT,”</proc/mdstat” or return;
while( $l = <MDSTAT> ) {
if( $l =~ /^(\S+)\s+:/ ) { $n = $1; $f = ”; next; }
if( $l =~ /(\S+)\[\d+\]\(F\)/ ) { $f = $1; next; }
if( $l =~ /\s*.*\[([U_]+)\]/ ) {
$s = $1;
next if(!valid($n));
if($s =~ /_/ ) {
$status = $ERRORS{CRITICAL};
$message .= “md:$n:$f:$s “;
} else {
$message .= “md:$n:$s “;
}
}
}
close MDSTAT;
}
sub check_lsraid {
my($l);
my($s,$n,$f);

open LSRAID,”/sbin/lsraid -A -p |” or return;
while( $l = <LSRAID> ) {
chomp $l;
if( $l =~ /\/dev\/(\S+) \S+ (\S+)/ ) {
($n,$s) = ($1,$2);
next if(!valid($n));
if($s =~ /good|online/ ) { # no worries
} elsif($s =~ /sync/ ) {
$status = $ERRORS{WARNING} if(!$status);
} else { $status = $ERRORS{CRITICAL}; }
$message .= “md:$n:$s “;
}
}
close MDSTAT;
}
sub check_vg {
my(@vg, $vg);
my($l,@f);
my($s,$n,$f);

open LSVG,”/usr/sbin/lsvg |” or return;
while( $l = <LSVG> ) { chomp $l; push @vg, $l; }
close LSVG;
foreach $vg ( @vg ) {
next if(!valid($vg)); # skip entire VG
open LSVG,”/usr/sbin/lsvg -l $vg |” or return;
while( $l = <LSVG> ) {
@f = split ” “,$l;
($n,$s) = ($f[0],$f[5]);
next if(!valid($n) or !$s);
next if( $f[3] eq $f[2] ); # not a mirrored LV
if( $s =~ /open\/(\S+)/i ) {
$s = $1;
if( $s ne ‘syncd’ ) { $status = $ERRORS{CRITICAL}; }
$message .= “lvm:$n:$s “;
}
}
close LSVG;
}
}
sub check_ips {
my($l,@f);
my($s,$n,$c);
my($CMD);

$CMD = “/usr/local/bin/ipssend getconfig 1 LD”;
$CMD = “sudo $CMD” if( $> );

open IPS,”$CMD |” or return;
while( $l = <IPS> ) {
chomp $l;
if( $l =~ /drive number (\d+)/i ) { $n = $1; next; }
next if(!valid($n));
if( $l =~ /Status .*: (\S+)\s+(\S+)/ ) {
($s,$c) = ($1,$2);
if( $c =~ /SYN/i ) { # resynching
$status = $ERRORS{WARNING} if(!$status);
} elsif( $c !~ /OKY/i ) { # not OK
$status = $ERRORS{CRITICAL};
}
$message .= “ips:$n:$s “;
}
}
close IPS;
}
sub sudoers {
my($f);

$f = ‘/usr/local/etc/sudoers’;
$f = ‘/etc/sudoers’ if(! -f $f );
if(! -f “$f” ) { print “Unable to find sudoers file.\n”; return; }
if(! -w “$f” ) { print “Unable to write to sudoers file.\n”; return; }

print “Updating file $f\n”;
open SUDOERS, “>>$f”;
print SUDOERS “ALL ALL=(root) NOPASSWD:/usr/local/bin/ipssend getconfig 1 LD\n” if( -f “/usr/local/bin/ipssend” );
print SUDOERS “ALL ALL=(root) NOPASSWD:/bin/cat /proc/megaide/0/status\n” if( -d “/proc/megaide/0” );
print SUDOERS “ALL ALL=(root) NOPASSWD:/bin/cat /proc/megaide/1/status\n” if( -d “/proc/megaide/1” );

close SUDOERS;
print “sudoers file updated.\n”;
}
#####################################################################
$ENV{‘BASH_ENV’}=”;
$ENV{‘ENV’}=”;

Getopt::Long::Configure(‘bundling’);
GetOptions
(“v” => \$opt_v, “version” => \$opt_v,
“h” => \$opt_h, “help” => \$opt_h,
“d” => \$opt_d, “debug” => \$opt_d,
“S” => \$opt_S, “sudoers” => \$opt_S,
“W” => \$opt_W, “warnonly” => \$opt_W );

if($opt_S) {
sudoers;
exit 0;
}

@ignore = @ARGV if(@ARGV);

if ($opt_v) {
print “check_raid Revision: 0.1\n” ;
exit $ERRORS{‘OK’};
}
if ($opt_h) {print_help(); exit $ERRORS{‘OK’};}
if($opt_W) {
$ERRORS{CRITICAL} = $ERRORS{WARNING};
}

$status = $ERRORS{OK}; $message = ”;

check_megaide if( -d “/proc/megaide” ); # Linux, hardware RAID
check_mdstat if( -f “/proc/mdstat” ); # Linux, software RAID
check_lsraid if( -x “/sbin/lsraid” ); # Linux, software RAID
check_metastat if( -x “/usr/sbin/metastat” ); # Solaris, software RAID
check_vg if( -x “/usr/sbin/lsvg” ); # AIX LVM
check_ips if( -x “/usr/local/bin/ipssend” ); # Serveraid

if( $message ) {
if( $status == $ERRORS{OK} ) {
print “OK: “;
} elsif( $status == $ERRORS{WARNING} ) {
print “WARNING: “;
} elsif( $status == $ERRORS{CRITICAL} ) {
print “CRITICAL: “;
}
print “$message\n”;
} else {
print “No RAID configuration found.\n”;
}
exit $status;

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

Gmail and Hotmail consider mails as spam, solution here.

Tags: Sender-ID, SPF, DKIM, DK

DKIM / DK:
This only applies if using a combination of Postfix and Amavisd-new.
http://www.ijs.si/software/amavisd/amavisd-new-docs.html#dkim

Sender-ID / SPF:
http://www.openspf.org/
http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/default.aspx
http://www.microsoft.com/senderid

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