How to test local reverse dns lookups from your name server

I was having issues with reverse dns not working on one of the nameservers I admin and couldn’t figure out how to test it without changing the reverse dns delegation at my ISP, which I had implemented as a temporary fix to our issues (Hey take over our Reverse DNS, here are the records, quick, I can’t send any mail!!)

It took a while to find it, but this is how you can query your local DNS server for reverse response… write a nice nagios script around it and save yourself some embarrassment when the bosses ask why every email is bouncing saying invalid server. :)

host -t ptr 4.3.2.1.in-addr.arpa ns.yournameserver.com

Comments

Quick test of TCP between firewalls with Netcat

So sometimes I’m on a box and need to test if a port is cleared on a firewall.. i may not yet have apache installed but I want to test if port 80 is open, or I may want to act as a server to grab a request..

simple with Netcat.

nc -l -p 8080

will open a listen on port 8080 and after the first connect, exit and go back to shell… useful for testing

Comments

Quickly create files of a specific size for tests

Sometimes I’ve had to create files to test transfer speeds between points.. sure you could transfer that 650 meg iso image of freebsd, or you could create a “blank” file..

dd if=/dev/zero of=linux.ex2 bs=1024 count=131072

creates 128mb blank file

dd if=/dev/random of=linux.ex2 bs=1024 count=131072

creates 128mb file with random characters in it

for example.. play around with the count numbers in bytes and your set.

Comments

Freebsd ports tree… and updating it

I admit I’m a lazy person, so i love using the freebsd ports tree for software installs.. but when you don’t update it suddenly your left stuck without a source code file to install…

i’ve done updates using:

portsnap fetch update

give it a shot.

Comments

Netmask Table

255.255.255.255       11111111.11111111.11111111.11111111    /32          Host (single address)
	
255.255.255.254       11111111.11111111.11111111.11111110    /31          Unusable
255.255.255.252       11111111.11111111.11111111.11111100    /30            4 IPs with   2 Usable
255.255.255.248       11111111.11111111.11111111.11111000    /29            8 IPs with   6 Usable
255.255.255.240       11111111.11111111.11111111.11110000    /28           16 IPs with  14 Usable
255.255.255.224       11111111.11111111.11111111.11100000    /27           32 IPs with  30 Usable
255.255.255.192       11111111.11111111.11111111.11000000    /26           64 IPs with  62 Usable
255.255.255.128       11111111.11111111.11111111.10000000    /25          128 IPs with 126 Usable
255.255.255.0         11111111.11111111.11111111.00000000    /24         256 IPs with  254 Usable 
                                                                                *”Class C”*
	
255.255.254.0         11111111.11111111.11111110.00000000    /23         
255.255.252.0         11111111.11111111.11111100.00000000    /22         
255.255.248.0         11111111.11111111.11111000.00000000    /21         
255.255.240.0         11111111.11111111.11110000.00000000    /20         
255.255.224.0         11111111.11111111.11100000.00000000    /19         
255.255.192.0         11111111.11111111.11000000.00000000    /18         
255.255.128.0         11111111.11111111.10000000.00000000    /17         
255.255.0.0           11111111.11111111.00000000.00000000    /16         
                                                                                *”Class B”*            
	
255.254.0.0           11111111.11111110.00000000.00000000    /15         
255.252.0.0           11111111.11111100.00000000.00000000    /14         
255.248.0.0           11111111.11111000.00000000.00000000    /13         
255.240.0.0           11111111.11110000.00000000.00000000    /12         
255.224.0.0           11111111.11100000.00000000.00000000    /11         
255.192.0.0           11111111.11000000.00000000.00000000    /10         
255.128.0.0           11111111.10000000.00000000.00000000    /9          
255.0.0.0             11111111.00000000.00000000.00000000    /8       
                                                                                *”Class A”*    
	
254.0.0.0             11111110.00000000.00000000.00000000    /7         
252.0.0.0             11111100.00000000.00000000.00000000    /6         
248.0.0.0             11111000.00000000.00000000.00000000    /5         
240.0.0.0             11110000.00000000.00000000.00000000    /4         
224.0.0.0             11100000.00000000.00000000.00000000    /3         
192.0.0.0             11000000.00000000.00000000.00000000    /2         
128.0.0.0             10000000.00000000.00000000.00000000    /1         
0.0.0.0               00000000.00000000.00000000.00000000    /0    
                                                                                *IP space*
	
*Note:* The first and last IP of a series are *NOT* usable and the first  
usable IP is normally set up for the router.
The 1st IP is the network address. The last IP is the broadcast address.
=====================================================================

Comments

Simple overwriting of files in current working directory

When I do server configurations for large numbers of domain names, I like keeping files organized specifically by their domain name, and then I have a sample file that I build off of.

Often times I want to create new configuration files from an existing directory of all of those domain names (for example, if I needed zone records for each one)

for x in `ls`; do cat /directory1/filename >> /directory2/new/$x; done

what it does is for every line in ls (of the current directory) it outputs a file into /directory2/new/(every line in LS)

It’s a great timesaver… and can be used in a bunch of different ways

for x in `ls`; do touch $x; done
update every file in the directory to current time, great for organizing your config directories when you have a known working config

for x in `cat list`; do rm -rf $x; done
cat a file and delete each file in list

the list goes on…

Comments

« Previous entries · Next entries »