Philip S Tellis wrote:
> 
> So what happened at the meet yesterday?  How much did you'll accomplish?
> 
> Philip
> 
> ===========
> You will never amount to much.
>                 -- Munich Schoolmaster, to Albert Einstein, age 10
> 
> To subscribe / unsubscribe goto the site www.ilug-bom.org ., click on the mailing 
>list button and fill the appropriate information
> and submit. For any other queries contact the ML maintener

Nagarjuna, Prakash and I were the only ones there.

Nagarjuna was trying to get his IDE Philips 400 series CD writer to work
under Linux when I arrived. The plan was to burn a copy of SuSE for
Sujeeth (?). We gave up after a couple of hours and Sujeeth took home
Nagarjuna's copy.

Nagarjuna and Prakash then moved to diskless booting using Amit's HOWTO
along a plethora of other documents. I wasn't particularly interested,
so after seeing me hang around for a while, Nagarjuna asked me to
implement DNS for *.hbcse.tifr.res.in (he'd been working off /etc/hosts
all along).

The hosts to DNS move operation took a few hours, primarily because I
was avoiding manually converting the hosts file to DNS zone files, and
didn't know any other way.

Writing template zone files was easy. The DNS-Howto was rather helpful.
The problem was with moving from the hosts file format of "IP-address
hostname.domainname hostalias" to DNS's "hostname A IP-address" for
forward resolution, and "IP-octet-4 PTR hostname.domainname" for reverse
mappings.

HBCSE has three subnets: 158.144.4[234].*, meaning that I needed to
create one forward mapping zone, and three reverse mapping zones.

The first job was removing unwanted info from /etc/hosts. This was
accomplished by:

fmt -su /etc/hosts | cut -f1,2 -d" "

The first part removes all extra spaces from hosts, and the second
retrieves the first two fields (I was lucky there were no tabs).

I didn't know about the fmt command before this. I discovered this when
I did a rpm -qf `which cut`, to get textutil, followed by rpm -ql
textutil | grep bin. I also discovered the join command that helped with
swapping fields (cut -f2,1 wouldn't cut it).

Extracting subnets from the new hosts was easy. It only took a grep.

The forward mapping needed fields to be swapped. join -o "1.2 2.1" hosts
hosts did it. I needed to take both fields from the same file, but join
wouldn't take stdin for both files, so I needed to create a physical
file on disk (I hate that). Maybe I should have put a tee just before
join and removed the temp file at the end, so that I could put the whole
thing in one line.

sed s// took care of replacing the space in between with "A" surrounded
by tabs. Getting the tabs in there was a bit painful though. I had to
use this construct: "`echo -e \t`" everywhere, complete with double- and
back-quotes.

The command was two lines in all when fully written, I won't dare type
it here from memory.

Reverse mappings needed removing the first three octets from the IP
address (sed again), replacing the space with \tPTR\t, and putting a
period at the end of the (already) fully qualified domain name (sed
s/.in$/.in./). The $ was necessary to prevent hindi from becoming
".in.i". I only wanted to append a period to tifr.res.in.

At the end, apart from getting HBCSE on DNS, I learnt two new commands.
fmt and join.

I'm sure there was a more efficient way to do this. The syntax for
getting tabs in was particularly ugly.

-- 

Kiran Jonnalagadda
http://lunateks.com

baby.sh: while true; do echo "^G^G^G^G^G"; sed -e 's/food/poop/'; sync;
sync; sleep 15; done

To subscribe / unsubscribe goto the site www.ilug-bom.org ., click on the mailing list 
button and fill the appropriate information 
and submit. For any other queries contact the ML maintener

Reply via email to