Archive for the “Networking” Category

Oh dear oh dear …

It would appear this morning easynet is have some major issues reporting a major network outage on their status page: http://support.uk.easynet.net/support_status.aspx

Looks to me like a piece of downed routing equipment, for me at least any traffic routing via 67.17.198.202 black holes and the connection dies horribly.

Some bad routing setup there …

67.17.198.202 is listed as being in Georgia Atlanta (33.7271 -84.5785) (source: http://www.maxmind.com/app/locate_ip).

When trying to access some .co.uk domains on known UK geo IP’s, I am getting routed via a dead US link …. nice …

Well, I wouldn’t want a boring easy friday now would I?

Tags: ,

Comments 4 Comments »

This is something I find myself having to do, more and more lately due to this VoIP roll out.

From windows (xp)

Start > run > cmd

Once the command window is open ping the IP address of the device (this forces your system to do an ARP request and store the device information in the cache, don’t ask me why but microsoft decided it was a good idea not to lookup the information if it isn’t allready in the cache!)

NOTE: Even if the device blocks ICMP, this should still work, run ettercap on your windows network to see just how many times you will see an ARP request along the lines of “WHO HAS xxx.xxx.xxx.xxx”.

Now to get the MAC address type

1
arp -a xxx.xxx.xxx.xxx

Where xxx.xxx.xxx.xxx is the IP address of the device you just pinged.

1
2
3
4
5
C:\Documents and Settings\buzz>arp  -a 10.99.1.10

Interface: XXX.XXX.XXX.XXX --- 0x3
  Internet Address      Physical Address      Type
  XXX.XXX.XXX.XXX            AA-BB-CC-DD-EE-FF     dynamic

Please note this only works for a device on the same IP range.

If you run two ranges, i.e.

192.168.1.XXX

and

192.168.2.XXX

You will need to make the ARP request from a device bound to that range (servers are especially usefull here).

Tags:

Comments 1 Comment »

To test a POP3 connection using telnet open a command window or shell terminal and type the following

1
telnet smtp.domain.com 25

Where smtp.domain.com is the FQDN (Fully Qualified Domain Name) or IP address of the server you wish to test.

25 also assumes default SMTP configuration.

You will be greeted with something similar to:

1
2
Escape character is '^]'.
220 smtp.domain.com

Now you need to enter the HELO command, followed by an idenfication of the server you ar esending from.

1
2
HELO buzz.domain.com
250 smtp.domain.com

Anything other than “250″ indicates a problem.

You can now proceed with the test email transaction.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
MAIL FROM: buzz@buzz.domain.com
250 Ok
RCPT TO: buzz@smtp.domain.com
250 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
This is where the data goes, you finish the input by placeing a dot (.) on a single line.


.
250 Ok: queued as D9FA03705C9
QUIT
221 Bye
Connection closed by foreign host.
Tags: ,

Comments No Comments »

To test a POP3 connection using telnet open a command window or shell terminal and type the following

1
telnet pop.domain.com 110

Where pop.domain.com is the FQDN (Fully Qualified Domain Name) or IP address of the server you wish to test.

110 also assumes default pop3 configuration.

You will be greeted with somthing similar to:

1
2
3
Connected to localhost.
Escape character is '^]'.
+OK dovecot ready.

Now you need to authenticate

1
2
3
4
USER buzz
+OK
PASS thisismypassnorealyitis...honest
+OK Logged in.

Once logged in you can now make use of the following commands

STAT This command will respond as follows (colour added)

1
2
STAT
+OK <span style="color: #3333ff;">12</span> <span style="color: #009900;">3571942</span>

This indicates there are 12 emails in the mail box with a total size of 3571942 bytes.

LIST This command will list a line for each message with its number and size in bytes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
+OK 12 messages:
1 1209
2 307
3 32715
4 218
5 15937
6 3469
7 98724
8 54356
9 1128
10 560
11 1150309
12 2213010
.

RETR 11 This is the retrive command, in this case this will display the contents of email 11

DELE 11 This is the delete command, in this case this will mark email 11 for deletion (will not delete it).

RSET This is the reset command, this will clear any delete flags you have set.

QUIT This command will logout of the current account, any emails marked for deletion will now be deleted.

Tags: ,

Comments No Comments »

Some VoiP devices require the use of 802.1Q, encapsulation protocol, to set this up you are going to have to do this using telnet, and on a per port basis.

If you don’t know how to start a telnet session with your Cisco device, then I suggest you stop reading now, and defer this task to someone who does, no offense but getting this wrong can screw up your network.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
User Access Verification

Password:
3560>enable
Password:
3560#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
3560(config)#int GigabitEthernet0/1
3560(config-if)#switchport trunk encapsulation dot1q
3560(config-if)#switchport mode trunk
3560(config-if)#^Z
3560#wr mem
Building configuration...
[OK]

All you need to know is above, simple rinse and repeat for the other ports you wish to use 802.1Q, of course you can forgo the CTRL+Z followed my wr mem if you have multiple ports to do, just make sure you do CTRL+Z folowed by a “wr mem” otherwise your changes will only effect the current running configuration, if the device is restarted for whatever reason changes will be lost.

Tags: , , , ,

Comments No Comments »

So I thought maybe it’s time for an update.

The project is moving, albeit slowly, and I realy do not like the current PHP implementation, I want to move towards a C++ version, and I will do so as soon as I figure out how to do CLI “update/refresh” …

i.e. See how W GET works with the progress bar and kbps all in text, I have NO idea how that works.

I am also looking at adding RRDTOOL support.

Anyway here’s the current sample output:

1
[buzz@server01 .sysadmin]$ ./dbstat.php summary

1
----- mySQL dbStat v1.1 Summary Report-----

1
10 Databases checked

1
exampledb1: 13 tables (0 VIEWS 13 INNODB 0 MYISAM) 0.77MB DATA 0.64MB INDEX

1
exampledb2: 15 tables (0 VIEWS 14 INNODB 1 MYISAM) 0.22MB DATA 0.19MB INDEX

1
exampledb3: 62 tables (0 VIEWS 0 INNODB 62 MYISAM) 0.45MB DATA 0.5MB INDEX

1
exampledb4: 3 tables (0 VIEWS 0 INNODB 3 MYISAM) 0.02MB DATA 0.01MB INDEX

1
exampledb5: 4 tables (0 VIEWS 0 INNODB 4 MYISAM) 0.02MB DATA 0.01MB INDEX

1
exampledb6: 4 tables (0 VIEWS 0 INNODB 4 MYISAM) 39.81MB DATA 22.22MB INDEX

1
exampledb7: 3 tables (0 VIEWS 0 INNODB 3 MYISAM) 0.04MB DATA 0.01MB INDEX

1
exampledb9: 599 tables (8 VIEWS 1 INNODB 590 MYISAM) 8702.79MB DATA 4559.42MB INDEX

1
exampledb10: 22 tables (0 VIEWS 21 INNODB 1 MYISAM) 6.66MB DATA 2.26MB INDEX

Detail:

1
----- START mySQL dbStat v1.1 Detail Report: exampledb9 -----
1
exampledb9: 599 tables (8 VIEWS 1 INNODB 590 MYISAM) 8893.7MB DATA 4583.54MB INDEX
1
--- Table Index Ratio Report index:data (457 Tables) ---
1
exampledb9.table1: 315.0769:1
1
exampledb9.table2: 315.0769:1
1
exampledb9.table3: 157.5385:1
1
exampledb9.table4: 146.2857:1
1
exampledb9.table5: 128.0000:1

… (I’ve truncated this very long list)

1
--- Table Fragmentation Report (2 Tables) ---
1
exampledb9.atable: 0.6067
1
exampledb9.atable: 0.1285
1
--- Table Low Size Report (47 Tables) ---
1
exampledb9.atable: 0 bytes
1
exampledb9.atable: 0 bytes
1
exampledb9.atable: 0 bytes
1
exampledb9.atable: 0 bytes
1
exampledb9.atable: 0 bytes

… (Truncated again)

1
--- Table Detail Report (591 Tables) ---
1
SCHEMA.TABLENAME: ENGINE: ROWS: TOTAL SIZE (MB): DATA SIZE (MB): DATA PERCENTAGE OF TOTAL (%): INDEX SIZE (MB): INDEX PERCENTAGE OF TOTAL (%): LAST UPDATE TIME
1
exampledb9.a_table: MyISAM: 28906414: 3272.43531003: 3031.82567548: 92.6474: 204.63809450: 7.3526: 2008-05-22 11:59:42

.. (truncated)

1
----- END mySQL dbStat v1.1 Detail Report: exampledb9 -----
Tags: , ,

Comments No Comments »

Just a quick blog about this …

Ever had the problem of having to assign a DHCP reservation with no mac address resolving software on your laptop? (NOOB! haha)

Well … you have software built in if you are using windows XP anyway …

1
Start > run > cmd

“arp -a” (without quotes)

this will list your current local interfaces and thier MAC addresses.

“arp -a xxx.xxx.xxx.xxx” (without quotes) Where xxx.xxx.xxx.xxx is the target IP address on your LAN, this will resolve the MAC address for that interface.

Nice quick and simple.

Enjoy!

UPDATE: If you get an error “NO Arp entries found” when doing this, just ping the IP address first, assuming you get a response you _should_ be able to use arp to lookup the mac address!

Tags: , ,

Comments 1 Comment »

I was reminded today on MSN that I had in fact written (albeit a long time ago) a class for querying the A2S protocol using PHP sockets.

So I have decided to release the source code for this under the MIT licence.

Bear in mind this was written when the Source SDK was leaked, so it is for PHP 4 (Which reaches “end of life” 08/08/2008 ). And I havent re-tested wheter it works in a LONG long long … etc time.

However With the exception of the addition of RCON functionality (which should of been put in originally Valve!), the A2S protocol has not changed

Anyway check the attached files, the licence is included at the top of the file.

PHP 4 A2S class (Valve Server Query)

Digg this

Tags: , , ,

Comments No Comments »

So I find myself needing to tweak my Nagios installation a little bit, in this case I found the need for “out of hours” SMS alerts.

Nagios doesn’t cater for this natively, rather it does however allow you to create your own custom commands, this allows you to specify a script to be executed.

Now I am going to assume you are already quite familiar with Nagios , so here is the command definition from my installation.


# ‘alert-by-sms’ command definition
define command{
command_name alert-by-sms
command_line /etc/nagios/alert-by-sms.php “** $NOTIFICATIONTYPE$ alert – $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **”
}

As you can see all this command definition realy does is execute a php script, bear in mind that

“/path/to/php /path/to/script ”

as the command_line does not seem to work, so just add “#!/path/to/php -q” to the top of the php script (before the opening <?PHP tag). and CHMOD +X the file.

The php script used here takes $argv[1] and passes it into a function specific to the SMS api I use, the phone number and API definitions are hard coded ito the script.
You don’t really need me to upload my script, and if you do then you shouldn’t be attempting this …

Basically Nagios will execute the script, as defined at command_line, the script can do anything you choose.

Now to implement the command so it is actually used, I am pretty sure this entry in “timeperiods.cfg” is the default but just incase here it is.

# ‘nonworkhours’ timeperiod definition
define timeperiod{
timeperiod_name nonworkhours
alias Non-Work Hours
sunday 00:00-24:00
monday 00:00-09:00,17:00-24:00
tuesday 00:00-09:00,17:00-24:00
wednesday 00:00-09:00,17:00-24:00
thursday 00:00-09:00,17:00-24:00
friday 00:00-09:00,17:00-24:00
saturday 00:00-24:00
}

This is what I use for the “out of hours” definition, now to implement the SMS alerting, for this I have simply created a new contact definition in “contacts.cfg”, granted this means there are now two contact definitions for myself.

define contact{
contact_name out_of_hours
alias Out Of Hours Mobile

service_notification_period nonworkhours
host_notification_period nonworkhours
service_notification_options c,u,r,f
host_notification_options d,u,r
service_notification_commands alert-by-sms
host_notification_commands alert-by-sms
email HIDDEN EMAIL

}

This can be further customized depending on your setup, in this case the contact is me and I want to receive alerts for all servers & services, so I just add the contact “out_of_hours” into the admins contact group.

define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagios-admin,out_of_hours
}

So there you have it, you now have the ground work to potentially make Nagios fire you alerts anyway you like, you could go as far as having it call you via attached modem, if you _realy_ want, but when you want your servers talking to you via phone call is the day you need to switch to decaff, and head out to the pub once in a while.

Now just “nagios -v /path/to/nagios.cfg” to do a quick sanity check and make sure there are no errors (if you have any go back and fix them and run nagios -v again!), if all is ok /etc/init.d/nagios restart (or equivalent for your distribution).

As always if you run into problems drop me a comment :-)

Tags: , , , , , , , , , ,

Comments 4 Comments »

Creative Commons License