CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Set hostname for 5V Ethernet board

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
gkiesel



Joined: 22 May 2009
Posts: 8

View user's profile Send private message

Set hostname for 5V Ethernet board
PostPosted: Mon Aug 06, 2012 8:45 am     Reply with quote

How do I set my own hostname using the tcpip library supplied for the 5V ethernet board? The board is working fine, I can do fixed IP or DHCP without any problem. I just want the router to report the name of my box in its known client list, and I can't seem to figure out how to set the name of my dev board.
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Aug 06, 2012 9:24 am     Reply with quote

You need a DNS server. (can be run on any host you have now. Typically on Unix/Linux though. See www.isc.org)

This is something most small SOHO routers/firewalls lack (even though they do DHCP which is really 1/2 of the equation for having happy networks).

How most Windows clients do it without DNS is a shim in WINS that allows for hostname lookups from WINS as a backup to DNS... further confusing the issue of DNS for networks with all/mostly Windows.
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
gkiesel



Joined: 22 May 2009
Posts: 8

View user's profile Send private message

PostPosted: Mon Aug 06, 2012 9:30 am     Reply with quote

After a better round of Googling, I found a reference that suggests defining MY_DEFAULT_HOST_NAME might work. Unfortunately, I can't test this until tonight... hopefully, whatever issue you're referring to with the DNS server won't be an issue.
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Aug 06, 2012 12:50 pm     Reply with quote

What on the pic is using the host name?

Just because a host knows its name doesn't mean any other PC on the network does. (unless you're running the netbios name service on the PIC **AND** you have an all windows network OR a network with Linux servers running Samba (or a Mac network with something similar))

i.e. if you're setting the name on the PIC... and then you want to connect to that name from your PC.... where does the name->IPaddr resolution come from?

Perhaps a better question from me would be, "why do you think you need DNS? What are the problems you're experiencing now?"

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
gkiesel



Joined: 22 May 2009
Posts: 8

View user's profile Send private message

PostPosted: Mon Aug 06, 2012 7:10 pm     Reply with quote

That's a fair question. I want to see the name of the device in the router's client list. When I look at the DHCP list on my router through the web interface, I have a lot of different pieces of test equipment and computers. I want to know which IP address corresponds to a specific device (and potentially avoid having to know the IP address for my device).
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Aug 06, 2012 7:20 pm     Reply with quote

Ahhh...

Ok --- and there you see the trouble with DNS (in not having it).

What one needs to remember is that a computer doesn't care about host *names*. It only cares about host IP's addresses.

In a situation like that, what happens is something like this:

The routing table doesn't have any hostname information whatsoever. It keeps information in it's numeric form.

Only when the program that lists that table back to you needs to display a host name at your request does it bother to get hostnames. (i.e. netstat -na will show addresses while taking out the 'n' flag will tell netstat to try and get hostnames for those addresses.)

And how does it do that? Well, correctly, it should ask the DNS server (where ever that is). If there isn't one.. well, there you go.

If it's a SOHO router and it thinks DNS is out on the internet someplace, ask yourself, "would my ISP's DNS server know about my hosts inside my firewall boundary?" By default, most likely not.

So now it's up to DNS internally in your network.

In a Unix/Windows/Mac host, there's usually a "hosts file" which is local to that system only that might help you out. But don't always depend on it. The next step is to run a legit DNS server. Then you can do anything you want *AND* make it available to every host on the network.
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Aug 06, 2012 7:27 pm     Reply with quote

Oh,

and additionally, DNS has a facility for dynamic updates. The DHCP client can support this (and not all do or sometimes it's not desirable) or the DHCP server can support this (most SOHO routers do not have a DHCP server with this capability).

So if you decide to put in a DNS server, you may as well run DHCP on it as well.

Again, www.isc.org is the industry standard DHCP/DNS Daemons that support this.

Typically, most Linux/Unix distro's use ISC's DHCP.

You could do it with Windows, but their DHCP and DNS servers have had RFC standards issues in the past (probably on purpose knowing MS) so I naturally avoid them.

I've been using Linux/Unix for so long, I have several servers in my network running any combination of DHCP/DNS/HTTP/SMTP/POP/IMAP/SMB, Zoneminder, MythTV and so on...

It's easy to get spoiled. :D
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
gkiesel



Joined: 22 May 2009
Posts: 8

View user's profile Send private message

PostPosted: Mon Aug 06, 2012 7:36 pm     Reply with quote

What I really need to know is where in the code to set the host name for my Ethernet dev kit. My router reports the name of other computers. I should think my board should be able to do the same. In Microship's implementation, you set MY_DEFAULT_HOST_NAME, but this doesn't seem to be in the one CCS provides.

I actually am fairly familiar with TCP/IP in general. I just have a question about how to set a specific variable in the CCS provided dev kit. I recognize that routing to host names might not work, but sometimes IP address change with DHCP, so tracking down who is who would be helpful. By default, I get no name for the host name for the Pic board.

I know that you are trying to be helpful, and I am not really disagreeing with anything you are saying. But you seem to be trying to debug an issue I'm not having, and you are not really addressing the actual question.

If you know that the Pic cannot report its host name, or you know how to set the host name, I'd appreciate your help.

Thanks,
Greg
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Aug 06, 2012 7:52 pm     Reply with quote

Sorry - didn't mean to stray way off topic.

The last time I looked at the CCS TCPIP Stack, it was based on MCHP's v3.75 stack implementation.

As of the library from 2011-12-05, the version is 5.36.4 - CCS has been way behind for a long long time.

I just scanned my entire CCS based IP library and MY_DEFAULT_HOST_NAME does not exist.

So unless you switch to MCHP's stack (where it is available, but not sure if used for anything other than NetBIOS)

I don't think you're going to be successful with CCS's archaic conversion.

Sorry I can't be of more help,

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
gkiesel



Joined: 22 May 2009
Posts: 8

View user's profile Send private message

PostPosted: Mon Aug 06, 2012 8:00 pm     Reply with quote

I really do appreciate your desire to be helpful. These are things that could trip up a person. But I have to ask, is straying off topic a sign of being dazed and confused? Smile I kid, I kid...

Sadly, I came to the same conclusion... I am debating getting the Pic to send an email which will report its IP address, and set up some filters to update a table list. I could technically use this to update our DNS server that's on our production side (poor developer is just stuck with a router). Unfortunately, that is probably easier than upgrading my library in the short term.
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Aug 06, 2012 8:06 pm     Reply with quote

I feel your pain.

For a long time CCS has talked about changing the compiler to be more MCHP library friendly.

But... in the meantime, you might want to consider downloading the free MCHP libraries (to see what you've been missing) and you can even download C18 for free as well.

It's definitely a task learning the differences (you really appreciate the core of CCS once you see how things work in C18), but once you do, you can do some pretty wild stuff and the support is current and on-going.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group