DNS device name

Is it possible to set a dns device name to the mountaineer ethernet board?

I mean the NetBIOS name.

@ miugemelo - Check this codeshare:

http://www.tinyclr.com/codeshare/entry/245

1 Like

Thank you, I will try it out.

This doesn’t seem to work with the mountaineer mainboard. Is there another way to set the name?

This was your reference. You can’t use it as is. You have to change it for you board.

I’m using the following to initiate my ethernet:



NetBios MyNetBios = new NetBios("Mountaineer");
while (ethernetForMountaineerEth.NetworkSettings.IPAddress == "0.0.0.0")
{
   WriteLogAndDisplay("Awaiting IP Address", true);
   Thread.Sleep(3000);
 }


In the NetBios class I’ve changed the line


Array.Copy(NetworkInterface.IPAddress, 0, outBuf, 58, 4);

to


NetworkInterface netIf = NetworkInterface.GetAllNetworkInterfaces()[0];
 Array.Copy(netIf.IPAddress.Split('.'), 0, outBuf, 58, 4);

but i never get to that line, because


NameQuery == MyNetBiosName.ToUpper()

is never true.

What could be the problem?

Ok yor’re right

i think it must be like this:


...
NetworkInterface netIf = NetworkInterface.GetAllNetworkInterfaces()[0];
byte[] bytes = ConvertToByteArray(netIf.IPAddress.Split('.'));
Array.Copy(bytes, 0, outBuf, 58, 4);
...

private byte[] ConvertToByteArray(string[] stringArray)
        {
            byte[] byteArray = new byte[stringArray.Length];
            for (int i = 0; i < stringArray.Length; i++)
            {
                byteArray[i] = Convert.ToByte(stringArray[i]);
            }
            return byteArray;
        }

Or do i need to convert the string numbers to int first and then to byte?

Sorry, my english isn’t that good.

What do you exactly mean by “you ping your device from the same network segment with no router between?”?

We have a windows server 2012 acting as dhcp server.

I would like to see the netbios name in the leases list of the dhcp server.

My Mountaineer board is using dhcp to get the ip address.

I’ve tried the code from the following thread:

http://www.tinyclr.com/forum/topic?id=2472&page=1

I can ping my mountaineer with the setted name now, but the name isn’t updated in the dns and dhcp.

Thank you Andre for clarifying this.

So i need to wait for netmf to be updated with this :frowning:

Yes, there are probably not that many other people worrying about this. MAC addresses are perfectly acceptable device identifiers in most cases.

Yes, the mac address would be enough to identify the device, but it’s difficult to remember. We will have 25 Mountaineers connected to one network and it would be nice, if we can identify them by name in the dhcp server.