Computing.Net > Forums > Solaris > setting up my sparc5 as dns client

setting up my sparc5 as dns client

Reply to Message Icon

Original Message
Name: blummy
Date: November 15, 2002 at 05:48:48 Pacific
Subject: setting up my sparc5 as dns client
OS: Solaris8
CPU/Ram: ?
Comment:

Following a previous attempt to get Internet connection from my sparc through my XP PC I have now got an ADSL router set-up. My sparc is connected to this and I am able to ping IP addresses out in the www, however I am unable to ping www.xyz.com etc. it returns unknown host. I am trying to find out how to set my sparc up so that it behaves as a DNS client. If anyone can advise me I'd be most grateful. There is obviously a list of numerous files (resolv.conf/defaultrouter/hosts etc.) which I have to modify or create but i dont know what they all are. Regards Blummy


Report Offensive Message For Removal

Response Number 1
Name: TechMark
Date: November 15, 2002 at 08:33:39 Pacific
Subject: setting up my sparc5 as dns client
Reply: (edit)

Hi!

/etc/defaultrouter should contain the ip-adress of your default gateway, that would proably be the adress of your adsl-router.

/etc/resolv.conf should contain the keyword "nameserver" (exclude the quotes)followed by the ip-address of your primary DNS.

Now you have to tell the system to query the DNS if it doesnīt find the hostname in the /etc/hosts file. To do this, simply open the file /etc/nsswitch.conf in a texteditor and find the row beginning with the keyword host (or hosts), then simply add the keyword dns at the end of that row and then save and exit.

You only need to care about the /etc/hosts file if you want to make any local hostname to ip-address mappings.

Tip!
Thereīs one little problem with Solaris working as a dhcp-client and that is that Solaris expects to get itīs systemname (hostname) from the dhcp-server. Of course almost no dhcp-servers do this and Solaris will therefor default to the hostname "unknown" instead of using the name given to the system during the installation.

You can check the hostname set to your system by entering the command:
uname -n

The hostname given to your system during the installation is found in the file /etc/nodename, this is the name that should be set to the system but due to "bad" programming in two of the startup scripts this is not done when using dhcp.

If your systems hostname is set to "unknown" you need to do some small changes in the startup scripts.
First make backupcopies of the two scripts:
cp /etc/rcS.d/S30network.sh /etc/rcS.d/s30network.sh
cp /etc/rc2.d/S72inetsvc /etc/rc2.d/s72inetsvc

Now open the S30network.sh script in a texteditor and search for word "unknown", you find the correct row near the end of the file.
Find the following code-sequence:
if [ -z "$hostname" ]; then
hostname="unknown"
fi

and change the row hostname="unknown" to
hostname="`shcat /etc/nodename 2>/dev/null`"
make sure you get the brackets in the right direction. When done save and exit.

Then do the same thing to the other file, S72inetsvc, and reboot the system.
Now when your system comes up everything should be working and you should have the correct hostname set to the system and in the /etc/hosts file.

Feel free to mail me if you have any questions.

Free Solaris documentation in online and pdf-format see:
http://docs.sun.com

//TechMark


Report Offensive Follow Up For Removal

Response Number 2
Name: blummy
Date: November 16, 2002 at 14:32:57 Pacific
Subject: setting up my sparc5 as dns client
Reply: (edit)

Mark, it all sounded so feasible! I followed your comprehensive instructions to the letter and now I am really in the s**t, my sparc boots (with a few error messages), I log on, CDE starts as normal, I select ANYTHING and get nothing but a completely blank screen (except for the mouse pointer). I cannot do or see anything. I am very worried, the last time I sought advice on a PC problem so rather nice fellow embedded a virus on my PC which resulted in me losing just about everything, I have a rathe bad feeling about this too. If it was a genuine mistake then okay, however, if this was anything else then it is extremely disapointing. Blummy


Report Offensive Follow Up For Removal

Response Number 3
Name: TechMark
Date: November 18, 2002 at 08:56:11 Pacific
Subject: setting up my sparc5 as dns client
Reply: (edit)

Hi,
sad too hear that you got further trouble, that was not my intent.
Now, I donīt have your machine infront of me (which would simpliefy things *S*) however I think the problem lies in the /etc/hosts file.
Solaris CDE and Xterm (xserver that is) uses the information in the local hosts file to determine the address of the your machine when launching new windows.

First letīs fix the blank screen problem, when you get to the login-screen click the "options" button and choose "command line login". This is so we can bypass the mailfunctioning xserver, next you should perform two simple checks.
First:
Give the command "uname -n" to see the actual hostsname set to the system.

Secondly:
Give the command "cat /etc/hosts" to list the hosts file.
Now find the row with the comment "# added by dhcp" and see if the hostname on this row is the same as the actual hostname set to your system. If not, this is the most proable cause of your problem.
To change this, open the file in the "vi" texteditor. Now this is not the simpliest texteditor to use if your a newbie but it will get the job done in.

If you are used to work in vi then simply change the hostname on the dhcp-row to the actual hostname set on your system then save and exit (you need to do a "forced" save because the hosts-file is writeprotected).

If youīre not familiar with the vi-texteditor then here follows a step by step guide.

First open the hosts-file in vi using the command:
vi /etc/hosts

Now use the arrow-keys to get to the hostname on the "added by dhcp" row and put the cursor on the first character of the hostsname. Press the x-key and you will delete the character under the cursor, do this until you have removed the hostname.
Then press the i-key (switching the editor from command-mode to insert-mode) and type the hostname currently set to your system then press the ESC-key (your now back in command-mode).
To save the changes first type a colon (switching to input-commands) then type w! and press Enter to do a "forced" save. To exit vi first type a colon (:) and then the letter q and press enter.
You should now be back on the normal solaris commandline.
To be on the safe side type "cat /etc/hosts" (exclude the quotes) to list the file and see that the changes have been saved.

Now exit command-line by typing the command exit, press enter then wait few seconds and the graphical loginscreen should appear again. Login and now hopefully the windows-system will work again, remember this was just a temporarly solution to get the graphics online again.

Now to fix the real problem:
Itīs my misstake and I do appology to any inconvenience, the real problem is in the change of the script /etc/rc2.d/S72inetsvc.
What happends is that the command "shcat" doesnīt work when you have entered runlevel 2.
The correct change in the script should be:
hostname="`/usr/bin/cat /etc/nodename 2>/dev/null`"
instead of:
hostname="`shcat /etc/nodename 2>/dev/null`"

And do make sure the "`" is in the right direction, because in scripting ` is not interpreted the same way as ī or '.

A copy of this have been sent to your mail with the addition of my icq-number.

//TechMark


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: setting up my sparc5 as dns client

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software