Microchip TCP/IP Stack v3.75.6

Contents
Download zip file (1143KB)



Connecting to the Internet

If you are planning to get your embedded IP board access some services over the Internet, for example if you included the SNTP module to retrieve the time reference from a remote time server, there are some configuration details for your board and network setup that you must take in account.

This section will provide a brief description about the overall network setup and configuration settings for a standard home office network.

You must have a basic understanding of the TCP/IP protocol suite, IP addressing, routing, DHCP and NAT (there are plenty of on-line resources and publications to learn more about TCP/IP basics and related services and protocols).

The following diagram shows the typical situation in a Small Office/Home Office (SOHO) with a broadband connection to the Internet.


Figure 1
[Click on the image for a larger view]

In this example Internet access is provided via a broadband connection such as cable or DSL, the broadband modem is connected to the Internet Port of a broadband router/switch. Switch ports of the broadband router are used to connect different devices to the Local Area Network, including your embedded IP board.

The Internet Service Provider dynamically assigns a public IP address (in the example 24.0.x.y). The Local Area Network uses the private network address 192.168.1.0 with netmask 255.255.255.0, making the 192.168.1.1-192.168.1.254 range available for devices in the LAN.

The broadband router is also configured to provide dynamic IP address assignments for the LAN using DHCP with the 192.168.1.100-192.168.1.149 address range reserved for the DHCP server allocations.

The router LAN Ethernet interface has the statically assigned 192.168.1.1 address; PC1 is configured with static IP 192.168.1.2 and the embedded IP board 192.168.1.201 all with netmask 255.255.255.0 and default gateway 192.168.1.1; and PC2 will obtain its IP address, netmask and gateway via DHCP.

You also have the option to obtain the IP address for your embedded IP board via DHCP, but if you are planning to provide access to your board from remote sites in the Internet you will have better chances of success using the static IP address.

As an example the Figure 2 below shows the configuration screen of a Linksys BEFSR81 broadband switch/router based on the parameters mentioned above.


Figure 2
[Click on the image for a larger view]

Now to provide access to your embedded IP board for connections originated from a remote site in the Internet you have to enable port forwarding in your broadband router.

As you should know your router performs Network Address Translation in both directions, since your embedded IP board has a private IP address there is no way for the remote host to known how to reach it, the only public address you have is the one assigned to your router by your ISP, then your router must support this feature and has to be configured to forward packets to a specific port (UDP, TCP or both) to a specific IP address in your LAN, in our case 192.168.1.201.

If you are planning to provide access to the HTTP server included in the Microchip TCP/IP stack from a remote site, it is recommended that you change the HTTP server port to avoid conflicts with the internal HTTP server in the broadband router.

We'll use then for example 8080. (The HTTP server port in the current version is defined by the macro HTTP_PORT in the config.h file).

Figure 3 shows the Linksys BEFSR81 configuration screen where any TCP connection with destination port 8080 will be forwarded to the 192.168.1.201 address in your LAN and port 8080, ie your embedded IP board HTTP server.


Figure 3
[Click on the image for a larger view]

Once you have your router configured you will be able to access the HTTP server on the board using the URL=http://24.0.x.y:8080/ .

Now it will be much easier and fancy to access your board using a host name and domain name. Also the IP address dynamically assigned by your ISP is subject to change and there are no guarantees that you will be assigned always the same address.

Then for this you need what is called Dynamic DNS or DDNS, mapping a fully qualified domain name to the current IP address in use by your router.

There are several DDNS service providers that offer this service on a emporary basis for free (if you want a permanent assigned name you must pay for the service), and many standard broadband routers include this feature and support several DDNS providers.

Figure 4 shows the DDNS configuration screen for the Linksys BEFSR81 using the services of DynDNS.com and the hostname myboard and dnsalias.net domain.


Figure 4
[Click on the image for a larger view]

With this feature enabled and configured, when your router starts up or when the IP address changes it will register the IP address with DynDNS.com associated with myboard.dnsalias.net , and you will be able to access your HTTP server on the embedded IP board by using the URL= http://myboard.dnsalias.net:8080/.




   
    ©2006-2008, Jorge Amodio, All rights reserved

Last Update: July 15, 2007