Link to home
Start Free TrialLog in
Avatar of rigsby
rigsby

asked on

DNS host-name resolution

Slightly odd one this ......

iIs it possible to configure DNS resolution to return a non-fully qualified host-name????

For example if I enter the following ....

         host <name>

on a unix box, I currently get ...

         <name>.<domain> a.b.c.d

This is fine but I need to just get .....

         <name>  a.b.c.d   (no domain)

Is it possible to achieve this by DNS configuration or do I need to setup some script filtering etc ?????

Many thanks for any help !!!
Avatar of garisoain
garisoain

No, you need a little script filtering. It's not hard though. My version of host requires the following:

#!/bin/bash

echo -n $1
echo -n " "
host $1 | awk 'END {print $4}'


Save the above in your path somewhere, chmod to make it executable, and then

<name of script> <hostname>

If it doesn't work, post the output of your host command here so I can modify the script.

Vijay
ASKER CERTIFIED SOLUTION
Avatar of vsamtani
vsamtani

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
=( that's what I was trying to post... =/ ... bad look today.

I use:
#!/bin/sh
# script.sh - usage: "script.sh <name>"
IPADDR = `host $1 | awk ' {print $2}'`
echo $1 $IPADDR

gets the same result.

=)
-garisoain
Avatar of rigsby

ASKER

Your help is very much appreciated !!!