Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Local Host all over the place

Status
Not open for further replies.

mikeo2l

Technical User
Sep 27, 2001
20
IE
Can anyone tell me how to change the default "Localhost" name used by Linux.
Problem I use a Linux Box as my server. Connected to it is a win 2000 box. Software on the win 2000 box uses localhost. When I try to connect the two of them on the same network... 2000 will not allow me to connect to linux because.. The name "localhost" is being used by it in a vertual sence(part of ISS). As I need the IIS my best option seems to be... change the default name in linux?

Any ideas.

Else if you are familar with 2000 and IIS can I change the localhost name in it. Can't find any reference to it.
 
Note Just In:

Searching through other unrelated posts! I found a partial fix. By adding the line "netbios name = myname" I can now see 3 computers in my win 2000 network.

The win2000 box.
A linux box called localhost and
a linux box called "myname".

But so far when I try to access "myname" I get an error... network path not found.. More later! :D
 
Hi,

To get round the 'myname' not found problem you need to make sure the windows box knows where that machine is. The netbiosname resolution process can go through various sources of possible data and usually ends up to querying the same name as a IP host name. So, if your hostname in linux were the same as the netbiosname it would just 'find' it. However, it isn't so you have to give it a way to resolve the name.

The two obvious solutions are either to activate the nmb server provided with samba or to make a manual entry in the 'lmhosts' file on the windows box. Note sure about W2K, but for NT you would edit C:\WINNT\system32\drivers\etc\lmhosts (lmhosts.sam is a sample file) and put something like :

10.0.0.1 myname #PRE

(where 10.0.0.1 would be the actual IP address on the linux box)

To activate nmb do '/etc/rc.d/init.d/nmb start' and, if its redhat, you can set it run automatically with '/sbin/chkconfig --level 345 nmb on'. nmb is basically a linux version of a wins server.

Regards
 
Many thanks for the help ifincham. I seem to have some thing else amiss or perhaps it's not possible?
From the linux box should I be able to see the windows box? or even the linux system folders?

If I use the local networks (browse) option in linx I see nothing.. Could not connect to host.. localhost.

To recap: At one time (may have changes since.. made mods) I could ping both was no problems.
See Linux Box in Network (on windows 2000)
From windows box browse linux default html page and any links on it.

Have read the samba help doc (all of it) and could probably make the correct setting now (allowing for no mention made of win 2000).

Is there no GUI setup tool for network interconnection?
Life would be so simple and I need a simple life! :D

 
Hello,
Every Machine, including windows boxes, have a localhost address pointing to themselves. Localhost refers to the local loopback adapter, NOT an external network interface. Its a fake interface set up for diagnostic purposes.

What are your network settings like in Windows and in Linux? What IP Range are you running on your internal network? Did you configure your network card(ifconfig)?

The hostname file in linux is /etc/hosts
there you will find all host information in the form
<IP Address> <Full Domain Name> <Machine Name>
127.0.0.1 localhost.localdomain localhost

If you want to easily change your machines hostname, open a terminal window and type:
hostname [NEW-HOST-NAME]

And yes, there is a graphical configuration utility.
open a terminal window and type the following:
netconf

Hope this information helps a bit.
-Out0fOrder
 
Hi,

Firstly, for samba itself there is a gui admin tool called swat (samba web admin tool) what runs under a browser. It varies by distribution but, for redhat, you need to install the 'samba-swat' rpm and then do '/sbin/chkconfig swat on' to activate. Thereafter, you access it by and login as root.

To 'browse' windows machines from linux you have to use the tools provided in samba. The actual protocol used is netbios running under tcp for routing purposes (aka 'nbt'). So ordinary ip connectivity is not enough. You can list shares at a win box like this :

smbclient -L //ntbox -n (no password)
or
smbclient -L //ntbox -U userid%password
or
smbclient -L //ntbox -I 10.0.0.1 -U userid%password (specify ip address of server if netbios resolution problem)

See 'man smbclient' for all the options.

To actually connect to a windows share you can use the command 'smbmount' or 'mount' with -t smbfs to indicate that the type of the filesystem is smb. For example :

mount -t smbfs //server/share /mnt/win
or
mount -t smbfs //server/share -o nopwd /mnt/win
or
mount -t smbfs //server/share -o
username=userid%password /mnt/win
or
mount -t smbfs //server/share -o username=userid%password,ip=10.0.0.1 /mnt/win

etc.

Before you mount a filesystem into the linux 'tree' you have to first make a directory equivalent to the mount-point. So, in the above example, as a one-off you'd first create /mnt/win with 'mkdir /mnt/win'. Once you've mounted the windows share all those files will be in the filesystem under the mount point directory. Do a 'ls -l /mnt/win' after mounting and you'll get the idea.

I would also emphasise that for samba connectivity you need the tcp/ip connectivity to be working in the first place but as you can ping both ways this should not be a problem.

Hope this helps
 
You guys seem to know what you're talking about:
I am trying to set up a Mandrake 8.0 box on an NT network, (1 NT 4.0 server and three W98SE machines) with the intention of using the Linux box to take over from the NT one. I can see files on all machines using http://[ipaddress] but not a hope when it comes to Local Network. &quot;Could not connect to host localhost&quot; it tells me.How can this be when gives me SWAT fine??
 
Hi,

'localhost' is invariably defined on all machines (linux/NT/whatever) to equate to 127.0.0.1 which is the IP address of the loopback device. In essence it means the machine itself. You cannot use 'localhost' sensibly to access another machine because of this. If you do its the same as doing and you won't get a response unless you have a web server running on port 80 (default). Your windows boxes may well have IIS / PWS running in which case you'd get some kind of response. On linux you'll get nothing unless you install Apache. Swat works because the swat server is listening on port 901.

I'm not sure you're on the right track at all if you want to share files. You need to use samba as described above or ftp, depending on what exactly you want to do.

Hope this helps..
 
ActiveThistle

you are confusing apache and swat(samba config) which are two different applications that happen to talk http.

for browsing regular web pages apache is the application that responds (usually on port 80) with http protocols.

for browsing files samba is the application that responds to the netbios protocols (usually port 110 and others).
samba's configuration program called swat just happens to talk http as well so you can access it with your web browser, and usually this is on port 901.

In ANY case, either application must resolv a name to an address in order to open the session. Localhost always resolves to 127.0.0.1 and is not routable thru your network.
there are various methods of resolving name to ip address depending on the application used.

my2cents
stan
 
Tks for your 2c Stan.
I such a Linux newbie its just not funny:)

Can you point me roughly inthe direction i need to go...

My NT server is called &quot;SERVER&quot; the NT domain name &quot;MYDOMAIN&quot;.
One Windows PC is called &quot;MYPC&quot; and the linux box is called &quot;LINUX&quot;.

I just want to share files between the three of them. Security is not much of an issue. I can always go into that later.

I can manage to run SWAT - but I'm not too sure about the settings. Coupled with that I'm totaly mystified by the Linux configurators - they all seem to operate at cross purposes. Linuxconf/Drak etc etc .

Thanks ever so much for your help.

Active s-)
 
To share files from the linux box:
here is an example smb.conf file

[global]
workgroup = MYDOMAIN
netbios name = LINUX
server string = Linux File Server
security = share
socket options = TCP_NODELAY SO_RCVBUF=8192 \ SO_SNDBUF=8192
dns proxy = no
#============================ Share Definitions
[printers]
comment = All Printers
path = /var/spool/samba
browseable = yes
public = yes
guest ok = yes
writable = no
printable = yes

[publicwideopenshare]
path = /usr/public
browseable = yes
public = yes
guest ok = yes
writable = yes

#============================= end of smb.conf

To mount a share on the linux box use
smbmount \\\\server\\sharename /mnt/sharemountpoint

if you don't have smbmount see

have fun
 
How about this one: I'm trying to get Samba running in debian on my firewall/fileserver system (yeah, yeah, I know it's not the best setup). eth0 is the network card hooked up to my cablemodem and eth1 is hooked up to the local network (as 192.168.1.1). For some reason, none of my windows boxes can browse to the server. hostname is &quot;jeeves&quot;, and I set &quot;hostname = jeeves&quot; in samba.conf. Also added &quot;interfaces = eth1&quot;. Tried running samba as both daemons or from inetd -- Neither way helps. In both cases, SWAT shows smbd and nmbd as &quot;not running&quot; even though they show up in a ps aux. am I missing any info or can anybody figure out what I'm doing wrong?
 
Hi,

Firstly, the IP connectivity would have to work, e.g. you can ping both ways. Assuming that is the case then you have to have 'browseable=yes' in each of the share definitions within smb.conf - for example :

[data]
path = /home/samba/data
browseable = yes
guest ok = yes
writable = yes

Also, if you set the workgroup as different from the other win boxes then samba should be set up as domain master & local master :

[global]
workgroup = SAMBA
domain master = yes
local master = yes
preferred master = yes

(note that the above is just an extract of smb.conf - configuring thru swat is easiest)

What do you get from the following command (should be list of shares on server) ?

smbclient -U% -L localhost

Hope this helps


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top