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

TCP/IP stack and DNS problem

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







TCP/IP stack and DNS problem
PostPosted: Sun Dec 03, 2006 3:01 am     Reply with quote

Hello
I used the Microchip TCP stack converted by CCS on my own hardware and everything works ok.
I can use it as web server without any problem.
However In my application I need to use DNS feature.
It seems that there's no dedicated function to resolve hostname into IP address so I tryed to convert the DNS example supplied by CCS in order to use the Microchip stack.
But it doesn't work. In detail I have a timeout problem from the remote server.
I know there're several thing involved that can go wrong. At high level even my LAN gateway address (if I use the same I defined on Windows it doesn't even reply its MAC address, so i use the server DNS IP as gateway...)

In breaf, is there any already tested code that I can use, at least to avoid lower level problem ?

Thanks.
Daniele
Daniele
Guest







PostPosted: Mon Dec 04, 2006 3:55 pm     Reply with quote

I partially solved the problem.
I used the DNS library supplied by Microchip and I can resolve hostname into their IP address.
However I still have the problem to obtain MAC address of my gateway.
It's a Cisco router/firewall. Is there something I had to know about accessing these kind of devices ?

Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Dec 04, 2006 4:02 pm     Reply with quote

If it's attached to a Windows machine, just type: ipconfig /all

http://support.microsoft.com/kb/314850
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Mon Dec 04, 2006 4:47 pm     Reply with quote

Daniele wrote:
I partially solved the problem.
I used the DNS library supplied by Microchip and I can resolve hostname into their IP address.
However I still have the problem to obtain MAC address of my gateway.
It's a Cisco router/firewall. Is there something I had to know about accessing these kind of devices ?

Thanks.


If you are running DHCP then IP address of the router and the subnet mask for the network segment are passed to the PIC. You must then use ARP to resolve the gateways IP address to a MAC address. You must already have this ARP process in your code or you would not have been able to resolve the DNS server's IP address to the associated MAC address.

If you do not have DHCP then you have to configure the default gateways's IP address as well as the subnet mask. ARP is then used to resolve the IP to MAC address mapping.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Mon Dec 04, 2006 8:01 pm     Reply with quote

Well to receive an IP address via DCHP you'll have to create a DHCP discover message (it uses UDP packets.) You then collect the offers ( in a simple system chances are there is only one) send a request to a chosen DHCP then you'll bind to an IP and a gateway IP for the permitted lease time.
The offers from the DCHP's will have their MAC addresses as wrappers to the UDP packets
Of course you can always just use a fixed IP and a known gateway IP
Guest








PostPosted: Tue Dec 05, 2006 12:42 am     Reply with quote

Thanks for the reply.
Actually I already use fixed IP for PIC, DNS server and gateway.

The problem is obtaining from the gateway (a Cisco router) its MAC address in order to connect to internet (from PIC to Internet).

No problem if I ask the MAC of other Intranet machines but the gateway seems protected against this kind of request.
I know that the ARP proxy that can be disabled (but i don't beleive so), I'm waiting for the technician and see the set-up.

I still have to try to manually insert the gateway MAC address into the code and see what happen.

Thanks
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Dec 05, 2006 2:22 am     Reply with quote

Anonymous wrote:
Thanks for the reply.
Actually I already use fixed IP for PIC, DNS server and gateway.

The problem is obtaining from the gateway (a Cisco router) its MAC address in order to connect to internet (from PIC to Internet).

No problem if I ask the MAC of other Intranet machines but the gateway seems protected against this kind of request.


Routers (gateways) MUST respond to ARP requests. If they did not, then it would not be possible for them to route packets.

Quote:
I know that the ARP proxy that can be disabled (but i don't beleive so), I'm waiting for the technician and see the set-up.


Proxy ARP is a different function. Proxy ARP is where the router will respnd to ARP requests for addresses other than its own address when it knows this other address is reachable via one of its interfaces.

Quote:

I still have to try to manually insert the gateway MAC address into the code and see what happen.


You have a different problem. Most likely a subnet mask error.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Daniele
Guest







PostPosted: Tue Dec 05, 2006 5:28 am     Reply with quote

Thanks Andrew.

Actually I'm a bit confused. I tried inserting manually the router MAC address and it works. I just follow the Microchip DNS sample and i had back the page.

It could be possible to have some wrong setup but still working ?

Thanks,
Daniele
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Dec 05, 2006 5:37 am     Reply with quote

The MCHP stack is pretty crude. If you call ARP Resolve manually with the GW IP address it will populate the ARP cache for you.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Daniele
Guest







PostPosted: Wed Dec 06, 2006 6:59 am     Reply with quote

Found the mistake.

The bit 0 of the first byte of MAC address specifies also if the sending frame is UNICAST or MULTICAST.
It seems that my (or every ?) router/gateway doesn't accept MULTICAST frame on ARP request.

I just change the default MAC address 01-02-03-04-05-06 into 00-02.... and everything works.

Sorry for my explanation, I have still to understand what this really means.

Thanks.
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