[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 
>10.10.10.10 for ourserver instead of 10.10.10.12.

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

>Note that gethostbynam() returns 10.10.10.10.

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 10.10.10.10 is the 
IP address of ourserver then gethostbynam() will 
return 10.10.10.10 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
>10.10.10.111 10.10.10.255 Name query NB OURSERVER<00>
>10.10.10.2   10.10.10.111 response NB 10.10.10.12
>
>As you can see, the smb service is binded to 
>10.10.10.2:137 and it answers 10.10.10.12 in the 
>message.

Where do you see any inconsistency? Your client 
10.10.10.111 broadcasts to everyone in 10.10.10.0/24,
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 
10.10.10.2 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 10.10.10.12. This piece of wisdom will be
put on the wire by your said server with address
10.10.10.2 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?

Cheers
Dragan


____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005



More information about the samba mailing list