Jump to content

Samba, hostname and IP


Guest fat_larry
 Share

Recommended Posts

Guest fat_larry

In Windows my PC is accessible from all parts of my University network under the name AZRAEL, so I can go to any networked PC and type http://AZRAEL to get my default Apache page, or type AZRAEL in the Start menu Run box to access my shares.

 

However, in linux with Samba I have got this working only in some parts of the network. for example, for a particular part of the network where many users will wish to connect they can only do so by using my full IP address!!

 

They can also only Ping me using my IP address, not my hostname, whereas for other parts of the university the hostname is ok.

 

Any help / guidance would be appreciated!

Link to comment
Share on other sites

Dude... check your DNS server. The dns server is not resolving the hostnames properly. That's my guess. Somewhere there is an issue in the configuration somewhere. Check your settings. The fact that windows can do it but linux can't also confuses me. Maybe the linux box that you are trying to access AZRAEL from is not set up properly, but my guess is you DNS server has a problem.

Link to comment
Share on other sites

Guest fat_larry

every single windows box on the network can resolve hostnames. my box can't because of something in the setup, Samba i guess. is there anything i should check straight away?

Link to comment
Share on other sites

Okay, go and look in your /etc/ dir. There should be a file in there called hosts. In that file you can enter the name of your server as well as the ip address at which it can be found.

 

Mine looks like this

127.0.0.1    localhost.localdomain    localhost

192.168.65.101    broken-theory.tuksfm.co.za    broken-theory

192.168.65.102    skratch.tuksfm.co.za    skratch

 

Basically what you are doing is telling your linux box which hostname belongs to which ip. Ideally you should be running a DNS server.

A DNS server automatically enters in all of this information if I'm not mistaken. ie, when you request a hostname/domainname your NDS server will tell you at which ip that hostname can be found.

 

It worked for me, I don't see why it won't work for you. But let me know.....!!

Link to comment
Share on other sites

Guest fat_larry

The hosts file is fine, but do i really need to be running my own DNS server on my machine?!

 

the only problem is that i can't ping my friend, e.g. RATTY using

 

ping RATTY

 

but i can ping him by using:

 

ping 144.124.50.23

 

and vice-versa, it's very annoying for other users to have to type my IP to be able to connect. there must be a simple solution!!

Link to comment
Share on other sites

If RATTY is in the hosts file you will be able to ping him by typing

ping RATTY

 

If RATTY is not in the hosts file, the only way you will be able to ping him his

ping 144.124.50.23

 

I know this for a fact because I tested it.

In theory there should be a way sothat the hosts file updates automatically, ie DNS server, but don't ask me how...!!

Link to comment
Share on other sites

Guest fat_larry

Yeah, that works, but is there not a way i can get hostnames resolved automatically as in Windows?

 

The most annoying thing is that people can't get to ME by my hostname, but by IP only.

 

If this is normal i'm happy to let it be, but if there's a solution i'd really like to know!

Link to comment
Share on other sites

In Windows my PC is accessible from all parts of my University network under the name AZRAEL, so I can go to any networked PC and type http://AZRAEL to get my default Apache page, or type AZRAEL in the Start menu Run box to access my shares.

 

However, in linux with Samba I have got this working only in some parts of the network.  for example, for a particular part of the network where many users will wish to connect they can only do so by using my full IP address!!

 

They can also only Ping me using my IP address, not my hostname, whereas for other parts of the university the hostname is ok.

 

Any help / guidance would be appreciated!

 

You need to setup WINS, so your machine registers itself in WINS, so the windows clients can find it. Find out the IP of the WINS server on your network, and set 'wins server = (ip address)' (without the brackets of cuorse) in your /etc/samba/smb.conf (if you haven't mangled it yet, there will be an example).

 

If you want to do things like ping windows machine names, and you have already configured WINS as above, just install 'nss_wins'.

Link to comment
Share on other sites

Question: I LAN quite often with buddy's and stuff where there is no wins server. Does this mean that I should run one when I LAN sothat my system can resolve hostnames. And then does that mean that everybody else should run their own wins server too, because that way no matter where they LAN they can have hostnames resolved because they too are running a wins server. Otherwise each time they go to another LAN, they have to change the wins server ip......???

Link to comment
Share on other sites

Guest fat_larry

I added what i thought was the university WINS server and and installed nss_wins but still no luck.

 

to be honest i've probably got the WINS server wrong as it was a semi-guess based on what IS give out publicly about thier hardware.

 

thanks anyway.

Link to comment
Share on other sites

Question: I LAN quite often with buddy's and stuff where there is no wins server. Does this mean that I should run one when I LAN sothat my system can resolve hostnames. And then does that mean that everybody else should run their own wins server too, because that way no matter where they LAN they can have hostnames resolved because they too are running a wins server. Otherwise each time they go to another LAN, they have to change the wins server ip......???

 

No, in an ideal world, one person would setup a DHCP server wih Dynamic DNS, and you wouldn't need WINS. This might work in practice if there are no win9x machines.

 

But if you are going to setup WINS, only setup one WINS server, and you can have it broadcast by DHCP to the windows machines (unfortunately not to the linux machines).

 

A combination of WINS and DDNS may be good enough

 

(Stellenbosch)

Link to comment
Share on other sites

Ideally what I want to be able to do is go to any LAN and without editing my /etc/hosts file be able to resolve hostnames immediatly... Is that possible...? without running DHCP WINS and whatever all those other services are... Basically Can I set my box up to automatically get the hostnames from all the ip's on the local network ....?

Link to comment
Share on other sites

Ideally what I want to be able to do is go to any LAN and without editing my /etc/hosts file be able to resolve hostnames immediatly... Is that possible...? without running DHCP WINS and whatever all those other services are... Basically Can I set my box up to automatically get the hostnames from all the ip's on the local network ....?

 

Actually, it seems nss_wins should be able to work without a WINS server setup, you just need to install it and it should be able to find any server you can find using

 

$ nmblookup servername

 

It looks like it's working here (I have a complex network setup, two firewalls / masquerades, one behind the other, this is on one of them, so the test is with a local netbios alias, but it should work on a real network, it doesn't quite work to another machine in my setup ...)

 

Just to show DNS isn't setup and I haven't entered it in /etc/hosts, and that nmblookup does find it:

[bgmilne@bgmilne bgmilne]$ host test2

Host test2 not found: 3(NXDOMAIN)

[bgmilne@bgmilne bgmilne]$ grep test2 /etc/hosts

[bgmilne@bgmilne bgmilne]$ nmblookup test2

querying test2 on 192.168.0.255

192.168.0.216 test2<00>

 

 

With nss_wins setup:

[bgmilne@bgmilne bgmilne]$ grep wins /etc/nsswitch.conf

hosts: files nisplus nis dns wins

[bgmilne@bgmilne bgmilne]$ ping -c1 test2

PING test2 (192.168.0.216) from 192.168.0.216 : 56(84) bytes of data.

64 bytes from 192.168.0.216: icmp_seq=1 ttl=64 time=0.143 ms

 

--- test2 ping statistics ---

1 packets transmitted, 1 received, 0% loss, time 0ms

rtt min/avg/max/mdev = 0.143/0.143/0.143/0.000 ms

 

 

Same, but without nss_wins setup:

[bgmilne@bgmilne bgmilne]$ grep wins /etc/nsswitch.conf

[bgmilne@bgmilne bgmilne]$ ping -c1 test2

ping: unknown host test2

 

Note that installation of the nss_wins package should add a wins entry to the hosts line of /etc/nsswitch.conf, so it should all work if you just do this:

 

# service smb start

(if you didn't have samba running)

# urpmi nss_wins

(if you didn't have it installed, if you did, but had no wins entry, just 'urpme nss_wins' first).

 

Of course, dynamic dns and WINS would be cooler ....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...