[Samba] Re: Unexpected IP resolution

Dragan Krnic dkrnic at lycos.com
Sat Jun 21 00:56:29 GMT 2003

>> >The result from nmblookup (same result on all 
>> >platform) for a given samba server isn't what I 
>> >expect.
>> But it is exactly what nmblookup expects if you
>> configure your card the way you did!
>Ok then, how do I configure things in such way that 
>nmblookup (and windows machines) will return 
> for ourserver instead of

That's easy, Richard. Just configure your ourserver
as an alias or hostname for a machine with an IP 
addresss of How else?

>Note that gethostbynam() returns

Sure, if you set up your nsswitch.conf to first look 
into files before calling a dns server and your 
/etc/hosts contains a line saying is the 
IP address of ourserver then gethostbynam() will 
return as the IP address of ourserver. 
You could even fool a DNS server if your hat were
black enough. There's nothing contradictory here,
just a simple principle: Garbage in, garbage out.

>I don't put the fault on mnblookup.  Far from that.
>Let's me show you the ethereal output (transcripted) :
>source	      destination  info
> Name query NB OURSERVER<00>
> response NB
>As you can see, the smb service is binded to 
> and it answers in the 

Where do you see any inconsistency? Your client broadcasts to everyone in,
someone may please let him know which IP address goes 
under the WINS name of OURSERVER. A server of yours 
whose eth0 is primarily bound to global IP address of reads the broadcast and passes it over to 
nmbd. nmbd consults browse.dat and wins.tdb and finds 
that OURSERVER was most recently updated as having the
address of This piece of wisdom will be
put on the wire by your said server with address where it's intercepted by ethereal.
End of story.

As you have seen, there's no mistery. The only
question is, why would you want to confuse a perfectly 
functioning samba server in this particular way? I 
don't doubt that you have some lofty motives, but 
perhaps you may go for a compromise solution, which 
isn't exactly how you thought things would work out 
but at least you have happy users being industriously 
served by a fantastic piece of open source software. 

I know what you want, Richard. You want different WINS 
aliases of your samba server to be reported under 
different IP addresses, all of them in the same 
logical subnet. Taking into consideration the present 
state of development of TCP/IP and SMB one way to 
achieve that is for you to rewrite the nmbd.c in such 
a way that it looks up your /etc/hosts instead of 
wins.dat and browse.tdb. I'm afraid that would have 
some very nasty side effects, but hey, what the hell, 
give it a try.

But why would you want that? What's the perceived 
benefit that you expect from forcing a samba server 
with 10 aliases and 10 IP addresses, OK 5 not 10, all 
in the same subnet, to remember exactly which IP 
address should belong to which WINS alias?


Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!

More information about the samba mailing list