View previous topic :: View next topic |
Author |
Message |
Daniele Guest
|
TCP/IP stack and DNS problem |
Posted: Sun Dec 03, 2006 3:01 am |
|
|
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
|
|
Posted: Mon Dec 04, 2006 3:55 pm |
|
|
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
|
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Mon Dec 04, 2006 4:47 pm |
|
|
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
|
|
Posted: Mon Dec 04, 2006 8:01 pm |
|
|
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
|
|
Posted: Tue Dec 05, 2006 12:42 am |
|
|
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
|
|
Posted: Tue Dec 05, 2006 2:22 am |
|
|
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
|
|
Posted: Tue Dec 05, 2006 5:28 am |
|
|
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
|
|
Posted: Tue Dec 05, 2006 5:37 am |
|
|
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
|
|
Posted: Wed Dec 06, 2006 6:59 am |
|
|
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. |
|
|
|