Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼

Embedded Systems

Building Your Own Web Server

Networking Acronyms at Work

There are a number of networking protocols that come into play in Webster2's design.

  • DHCP. Webster2 can use DHCP to obtain its networking parameters (IP address, and so forth) from a DHCP server on the network to which it is attached. If DHCP isn't used, the networking parameters can be set statically via entries in a configuration file.
  • DNS. DNS is like a phone book for the Internet for turning host names into IP addresses. DNS entries must be in place so that Webster2 can be found on the Internet by name.
  • FTP. Webster2's software includes an FTP server that lets website content be stored on the on-board SD memory card to be updated remotely. Updates can be made using FTP client programs like FileZilla, or via the publishing mechanism of your web page design software.
  • HTTP. HTTP is the protocol of the WorldWide Web. HTTP is used between web browsers and web servers for information transfer.
  • NTP. Webster2's software uses NTP (Network Time Protocol) for keeping its system clock accurate.
  • UDP. UDP (User Datagram Protocol) can be used by Webster2 to log web server accesses to a remote computer.

Because Webster2 uses all of these protocols, it may be necessary to configure any firewall software you use. Most importantly, you must allow HTTP requests to pass through the firewall or Webster2 won't be available on the Internet. This feature is called "port forwarding" in some cases.

Using Webster2

Before Webster2 can go online. you must decide if static or dynamic IP addressing is to be used. Using DHCP is always easiest if your network permits it. For my website, I connect Webster2 directly to my wireless DSL router and use DHCP so the router assigns an IP address automatically. This works fine. Once your web server has a public IP address, as mentioned, you must open up the firewall in the router to allow inbound HTTP connections so users outside your network can hit your server. How this is done depends upon your firewall software.

Keep in mind, in trying to host a website on a home DSL connection, the IP address assigned to your DSL router changes from time to time. This is a problem whether you are using Webster2 as your web server or a professional product like Apache. Regardless of how you access your website, when your router's IP address changes, connectivity to your website using an old address will be lost.

A solution that lets you host a DSL-connected website is a program called No-IP (www.no-ip.com). No-IP (the company) offers a free dynamic DNS and web redirection service for just this purpose. No-IP will even provide you the use of a domain name from a list of preexisting domains that you can use for free.

The No-IP client program runs as a service under Windows XP. It continually monitors the public address exposed by your router for your web server and informs No-IP's DNS servers of any changes. So as long as access to your website is via your chosen domain name, you are insulated from changes to your router's IP address. By running No-IP on any PC in your network, access to your website is maintained even if the public IP address of your router/server changes. Pretty slick, huh?

Once you register your web server host with No-IP and your server is operational, you should be able to ping your server:

ping myhost.mydomain.com

Executing this command verifies whether myhost in the domain mydomain.com is operational or not. You would need to change the ping command to check your server in your domain.

Once you have web content in place and you can ping your server, you should be able to access your website with a browser (Internet Explorer, Firefox, or whatever) by specifying a Universal Resource Locator or URL of the form:


If you don't specify a specific HTML file to access, the file index.html is assumed. Once this works, you are good to go.

Webster2 Hardware

Again, Webster2 is based entirely on the NB MOD5270LC development kit hardware. As such, only two things are required to get Webster2 running. First, you need to insert an SD memory card (64-GB max) into the socket on the development board and second. you need to download the web server code I provide (see www.ddj.com/code/) with this article.

While packaging the NB hardware is not required for its operation, I decided to package the development hardware to protect it from accidental abuse or damage. At my local electronics shop, I found a plastic box made by Serpac that the hardware would easily fit into; see the complete parts list in Table 1.

Designation Value Notes
MOD5270LC NB development kit hardware. Part #: NNDK-MOD5270LC-KIT Available directly from NetBurner, Inc.
Box Serpac Model #271 or #271-I Dimensions: 7"x 4 3/4"x 1 3/4" See www.serpac.com
SPST power switch Any brand off/on switch I used a miniature toggle switch
SPST momentary contact pushbutton switch Any brand pushbutton switch This is the server's reset switch
LED power on indicator Any brand LED I used a green LED for power on
LED access indicator Any brand LED I used a red LED as access indicator
Misc. hardware Screws, nuts and spacers, etc. For mounting NB module
Memory Card SD memory card 64 GB max; 1 GB usually adequate

Table 1: Webster2 parts list.

Because I was going to hide the hardware inside the box, I thought it necessary to mount important controls and indicators on the outside. In the end, I mounted a power switch, power indicator, reset switch, and access indicator on the box; see Figures 1 and 2. The packaging steps I took are as follows:

  1. Lay the NB module into the box with the dip-switch facing the front of the box to visualize how things will fit.
  2. Remove any of the box's molded standoffs that are in the way using a drill bit larger in diameter than the standoff. The idea is that the NB hardware should be supported in the box by the acrylic feet attached to the bottom of the printed circuit board (PCB).
  3. With the PCB held in place, mark the box with the position of two or more of the mounting holes on the NB PCB. Drill these holes for #6 machine screws.
  4. Layout the positions of the two switches and the two LEDs on the bottom front portion of the box. Drill holes of the appropriate sizes for mounting. Glue the LEDs into place and mount the switches.
  5. File two holes in the top rear portion of the box to allow the power and network cables to protrude.
  6. Mount the NB PCB into the box using appropriate screws. The screw heads should be on the outside of the box; nuts on the inside. Tighten the screws but not so tightly as to cause the PCB to bend.
  7. Carefully unsolder surface-mounted LEDs 8 and 9 from the PCB. Unsolder and remove the reset switch as well. Led8 is the furthest right in the row of eight LEDs. Led9 is located to the left of the dip-switches. The reset switch is located above the row of eight LEDs.
  8. Cut the connector off of the supplied power cable. Pay attention to the polarity of the cable. There was a white strip on the + side of the cable on the unit I used. If you cannot tell which is the + side of the cable. use a multimeter to determine it.
  9. You will probably have to extend the power cable by soldering other wires onto it. A six-inch extension will probably do it. Again. be careful of the polarity.
  10. Solder the - end of the power cable to the GND terminal on the PCB. Solder the + end to one side of the power switch.
  11. Solder one side of another wire to the other switch connection and the other side to the "7to18V" terminal on the PCB.
  12. Determine the + side of the power LED by holding the leads to a 9V battery and noting which orientation causes the LED to light. Note which lead of the LED is connected to the + side of the battery.
  13. Solder a wire from the + side of the power LED to the + connection on the PCB for Led9, which was removed earlier. Solder another wire from the other lead of the LED to the other connection for Led9.
  14. If you are feeling lucky, plug in the wall wort and turn the power switch on, if all is well you should see the power LED come on. Turn power back off and unplug the wall wort.
  15. Solder two wires from the reset switch to the two pads on the PCB from which the reset switch was removed. Polarity is not important here.
  16. Determine the + side of the access LED as you did for the power LED.
  17. Solder a wire from the + side of the access LED to the + connection on the PCB for Led8, which was removed earlier. Solder another wire from the other lead of the LED to the other connection for Led8.
  18. Connect an Ethernet cable to the RJ-45 connector on the MOD5270 module and route it and the power supply cable out of the box.
  19. Place the top on the box and screw it to the bottom using the screws provided.

That's it with the hardware. Plug Webster2's power cable in and plug the network cable into a network port. Flip the power switch to on and you are ready to go.

[Click image to view at full size]

Figure 1: Inside the Webster2 chassis.

[Click image to view at full size]

Figure 2: The finished Webster2 Web Server From the left are the power switch, the green LED power on indicator, the pushbutton reset switch, and the red access LED. Holes are filed in the rear of the chassis for power supply and network cables to pass through.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.