How to setup a public server using the D-Link DSL-502T ADSL Router

From GLUG-BOM

lacnadarda You are here : Main Page > Howtos > How to setup a public server using the D-Link DSL-502T ADSL Router

This How-to assumes that you have a public IP assigned to the WAN interface of your router. This is a documentation of how I configured virtual servers on a MTNL ADSL broadband connection using the D-link DSL-502T ADSL router. This document does not cover the configuration of the service you are planning to host.


Contents

Before You Begin

The Administrative Console of the ADSL router (D-Link DSL-502T) is available on port 80 by default. It would be advisable to change this port to something else for two reasons.

  • You cannot host a web server if port 80 is already being used by some other service, eg. the administration console.
  • The administration console of the router can be accessed from the Internet. So changing the default admin password & port and disabling the console from being accessed from outside is a good idea. The port for the administration console & the admin password can be changed from Admin in the Tools menu (See screen-shot below). I haven't quite figured out how to disable access to the administration console from the WAN interface on the D-Link DSL-502T yet.
Changing the port address for the Administration Console
Enlarge
Changing the port address for the Administration Console


Defining Your Server IP Address

The DSL-502T assigns IPs using DHCP by default. To host a service on your public IP, the server machine should have a static LAN IP. So our first step would be to exclude an IP address from the router's DHCP pool which is to be assigned to the server.

  • In the administrative console of the router, go to the Lan Clients section under the Advanced menu. (See screen-shot below)
  • In the IP Address field enter the LAN IP you want excluded, and enter the subnet mask (255.255.255.0) in the field marked Host Name.
  • Click apply to save.


Just make it easier::

GO TO COMMAND AND TYPE

C:IPCONFIG/ALL

This gives you the detials of the following::

  • IP Physical address
  • DHCP Status
  • IP Address(USE THIS IP ADDRESS AS IT IS IN SELECTING IN LAN IP AS STATIC ADDRESS),
  • Subnet Mask, (USE THAT IN HOST FIELD) AND CARRY ON BELOW.

(THIS STEP IS MORE UNIQUE TO ANY COUNTRY RATHER THAN FOLLOWING VARIOUS QUAD DOTTED NUMBERS WHICH ARE SPECIFIC TO THE POSTING MEMBER'S ISP DETAILS.) edited by szn1

Defining a new LAN Client
Enlarge
Defining a new LAN Client

Defining The Service

The router has to be configured to forward requests coming to a particular port to the server that is running the service. This is done from the Virtual Server section of the Advanced menu.

  • Go to the aforementioned section in the administration console.
  • The IP Address we excluded above will be visible in the LAN IP drop down menu. Select it if not done so already. Leave the Connection setting as is.
  • Several preconfigured rules for services in various categories are already available. You can either select one of them or define your own.
  • To forward web server requests, select Web Server from the Servers category and click Add. Web Server will now be in the Applied Rules column. (See screen-shot below)
Adding the Web server Rule
Enlarge
Adding the Web server Rule

Port(s) or a range of ports for services other than the ones already available can be defined in the User category.

  • Click Add to begin.
  • Give the rule a name, select the protocol (TCP, UDP or both) and enter the start port and end port.
  • If only one port is required, then Port Start and Port End would be the same.
  • Port Map usually is the first port of the range or in case of a single port, the port address itself. (See screen-shots below)
Adding a new rule for a range of ports
Enlarge
Adding a new rule for a range of ports
Adding a new rule for a single port
Enlarge
Adding a new rule for a single port
  • Click Apply to save.
  • Add the newly defined rule to the Applied Rules section. (See screen-shot below)
Adding the new custom rule
Enlarge
Adding the new custom rule
  • Click Apply to save.
  • Finally, reboot the router using the Save and Reboot button in System under the Tools menu.
Rebooting the router
Enlarge
Rebooting the router


Did it work?

I've noticed that testing if it actually worked cannot be done from within your LAN. A web server configured for a particular LAN IP cannot be reached if you type your public IP in the browser of another system in the same network. You will have to test it from another location. You can test web servers using one of the many anonymous web proxy services like this one.


Defining Additional Services

You can add as many services on as many number of LAN IPs as your wish. But I don't think it's possible to have two LAN IPs running the same service.



Author(s): Vivek J. Patankar