lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Setting the netif hostname without using DHCP


From: Karthik Vadambacheri Manian
Subject: Re: [lwip-users] Setting the netif hostname without using DHCP
Date: Wed, 7 Jul 2010 13:59:22 -0400

Thanks a lot David & Simon for your insights.
Actually I cant use David's proposal because actually I would like to
ping between two kittens(Light Weight Kernels), which does not have
all the utilities as a traditional linux.
So I am thinking of using DHCP. By using DHCP I could register my
hostname and could ping from another VM. I need to set
LWIP_NETIF_HOSTNAME to achieve this.

Thanks,
Karthik


On Tue, Jul 6, 2010 at 7:30 PM, David Empson <address@hidden> wrote:
> Simon Goldschmidt <address@hidden> wrote:
>>
>>  Karthik Vadambacheri Manian wrote:
>>>
>>> Basically I want to ping from a unix box not a windows box. I tried
>>> setting NETBIOS_LWIP_NAME but as you said it works for windows only.
>>> So without using DHCP in LWIP is there a way to set the hostname which
>>> I can ping from another m/c?
>>
>> The question isn't if there is a way in lwIP to set a hostname, the
>> question is how can you make your unix box know the name. And as far as I
>> know, the only portable way under unixes is DNS. You could configure your
>> local network's DNS server to translate names into addresses, but that's
>> not what you want, I guess. BTW, using DHCP for that also only works if
>> the DHCP- and DNS-server work together and are allowed (by the admin) to
>> take hostnames suggested by clients.
>>
>> Another method would be mDNS, but that's not available yet for lwIP
>> (although there's a task for that on savannah, already) and you need
>> special software for unix, too.
>
> If SAMBA is installed on the unix machine, you can use the 'nmblookup'
> command to look up a NetBIOS name.
>
> I don't know if later versions are any better, but the one I have (supplied
> with Mac OS X 10.6, Samba version 3.0.28a-apple) doesn't have any options to
> tidy up its output in a way which allows it to be easily used in conjunction
> with
> other commands, so you need to do some postprocessing with other tools.
>
> Its normal output looks like this, if it finds the name on the first
> available network interface:
>
> % nmblookup foo
> querying name on 192.168.0.255
> 192.168.0.17 foo<00>
>
> If it can't find the name, it does this:
>
> % nmblookup foo
> querying name on 192.168.0.255
> querying name on 172.16.191.255
> name_query failed to find name foo
>
>
> If you assume the name lookup will be successful, this trick can be used to
> extract the IP address:
>
> % nmblookup foo | tail -1 | sed 's/ .*//'
> 192.168.0.17
>
> (tail -1 gets the last line, and sed with that argument strips off
> everything on the line
> beginning with the first space.)
>
> If the name is not found, it returns
>
> % nmblookup bar | tail -1 | sed 's/ .*//'
> name_query
>
> I'm sure a more seasoned unix shell scripter can turn this into an alias
> with a parameter, or come up with a tidier way to extract the first "word"
> from the last line of the output of nmblookup.
>
> You can combine the command with another one by using backticks:
>
> % ping `nmblookup foo | tail -1 | sed 's/ .*//'`
> PING 192.168.0.17 (192.168.0.17): 56 data bytes
> 64 bytes from 192.168.0.17: icmp_seq=0 ttl=128 time=0.528 ms
> 64 bytes from 192.168.0.17: icmp_seq=1 ttl=128 time=0.598 ms
> 64 bytes from 192.168.0.17: icmp_seq=2 ttl=128 time=0.572 ms
> ^C
> --- 192.168.0.17 ping statistics ---
> 3 packets transmitted, 3 packets received, 0.0% packet loss
> round-trip min/avg/max/stddev = 0.528/0.566/0.598/0.029 ms
>
> (A failed lookup will attempt to ping 'name_query', which isn't likely to
> achieve much.)
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]