You are on page 1of 7

Study of OpenWRT and It’s Application for Port

Forwarding and Wireless Repeater


By:
9324-9680 / Travis Wright

there are many other features, which could


Abstract:
be very useful to the general public that are
OpenWRT is an open source project that in not implemented. This project will explore
2009 joined the “Software in the Public how to implement two of those additional
Interest” domain. This unique status gives features with OpenWRT:
it more organizational structure and shows
1. Simplified port forwarding
the maturity of its development. The
distinction also allows it to work in concert 2. Configuration of wireless repeater
with many other projects that have similar
These capabilities will also be discussed as
interests such as Debian, PostgreSQL,
to how they can be leveraged with the recent
OpenOffice and MadWifi. This project will
developments in smartphone technology
explore just some of the many unique
which have driven the need for better and
aspects that OpenWRT can improve over
better networks.
the current commercially available router
software in the marketplace today.
With new 4G technology attempting to
Specifically OpenWRT’s Port Forwarding
handle the loads of these new smartphones
and Wireless Repeater capabilities will be
one possible solution that is actibly being
explored.
pursued by companies is to use wireless
internet to relieve the load off these
During the project certain technical issues
networks for data and allow them to handle
meant I was not able to implement the Port
voice only. By improving the ability of
Forwarding and Wireless Repeater
wireless routers already in place with a
functions myself. The issues will be
firmware upgrade this could greatly help to
discussed in this paper.
improve current networks.
Keywords: OpenWRT, Port Forwarding,
Both commercial and private individuals
Wireless Repeater
would benefit from this advance as it would
allow an existing infrastructure to handle
I.
Introduction

even greater loads. The use of OpenWRT
itself may not bring about this ultimate
OpenWRT is a Linux based firmware advance, but it can be a stepping stone for
designed for embedded devices such as a development which as an open source
personal wireless router that has become development project that is its main focus.
ubiquitous in the modern world for both the
home and commercial applications. These II. Preliminary Investigation
wireless routers are so integrated into our
daily lives that the majority of people no I began my research at the OpenWRT.org
longer give a second thought to their official website. This gave me an idea of the
capabilities and simply use them for their history and purpose of OpenWRT. The
plug and play features. While these initial design is based around a Linux firmware
default capabilities are well implemented structure for embedded devices such as such
as the common household internet router. not already included on the wireless router.
This firmware is designed with hooks to The conversion requires purchase of various
allow further development and parts and soldering of them that I was not
customization to implement a wide range of prepared for (serial connector). The parts
abilities for a router. In my case I chose to are listed below [7]:
focus on the port forwarding and wireless 1. AD233BK 233A CTS RTS
repeater aspect. adapter kit
2. DB9M Serial Connector
Other aspects of OpenWRT are: firewall and 3. DB9F serial connector
router configurations, Quality of Service 4. 10 pin IDC male PCB-mount
(QoS) for various applications such as VoIP, head
mesh networking, and a fully writable file 5. 10 pin IDC female cable-mount
system which allows integration of new head
software without the need to rebuild the 6. Soldering iron
firmware image [1].
If I had been able to complete the hardware
I chose Port Forwarding because I was conversion the process for installing the
interested in using my wireless router software was laid out on the OpenWRT.org
instead of having to hook up via a wired website and the basic steps are listed here
LAN connection every time I wanted to [6]:
perform functions with the class project 1. Physically open the device you are
using Asterisk and Kamailio. I attempted going to install the OpenWRT on.
port forwarding with my current Linksys A list of supported devices are
router software, but was unable to make a available at
connection during the first half of the http://oldwiki.openwrt.org/TableOf
semester so wanted to attempt the same feat Hardware.html.
with OpenWRT instead. 2. Solder a serial connection port using
the parts listed above to the J1
I also started researching the wireless connector of the electronics board.
repeater capability because I have 3. Install OpenWRT using one of the
previously investigated WiMAX for other following methods
classes and am interested in the ability of a. Online GUI provided by the
wireless devices to be turned into repeaters vendor. This is the easiest
that could effectively increase the range of way but not always the best
all nearby wireless devices. This would also as there is no way to go
lead into mesh networks but that scope back if something goes
would be to much for me to take on in the wrong.
course of this semester. b. Using TFTP which if there
is an error you can reload
III. OpenWRT Conversion the original files and restore
the function of your device.
For my Interim Report I discussed the 4. Configure WAN for internet access
general process for conversion of a Linksys a. DHCP for the Cable internet
wireless router WRT54GL series. When I access
was reading through the literature on various b. PPPoE
websites (included at the end of this report c. QoS
[6] [7]) discussing how to complete the d. Dynamic DNS
conversion I focused on the software sites 5. Enable WiFi
and commands. I was aware the conversion
required a serial connection to the router, but After realizing I could not perform the
did not understand that the serial port was conversion I chose to focus on the research
aspect of my project for port forwarding and protocol to the destination computer. If the
wireless repeater capabilities of OpenWRT. wrong protocol is used the computer will not
I will refer to the OpenWRT “Kamikaze” be able to understand the message and the
version throughout the rest of this report. forwarding will be useless.

I was also planning on using Kamailio as a For the Linksys router in in figure 1 all the
basis for my PBX as we had in class on my ip addresses will begin with 192.168.1.xx
machine, but after many attempts and because those are reserved private addresses
discussions with both the TA and professor I that the router is able to use for its private
was unable to properly configure Kamailio. network. Other routers may use other
I have previously documented these efforts addresses.
in Homework #3. It is located at
http://5718wiki.gatorfone.com/wikka.php?w B. OpenWRT Port Forwarding
akka=TravisWrightKamailioProblems. For OpenWRT there is no GUI and all
inputs will be done from the command line
IV. General Port Forwarding which can give us more control of the port
forwarding process. An example of
Port Forwarding is the process of forwarding OpenWRT manual port forwarding would
packets to a specific port on a machine be:
located behind a gateway in another iptables
­t
nat
­A
prerouting_rule
­i

network. The forwarding is necessary vlan1
­p
tcp
­­dport
80
­j
DNAT
­­to

because the wireless router (gateway) masks 192.168.1.150

the private network from the Internet and iptables

 

 

 

 ­A
 forwarding_rule
 ­i

without the forwarding rules established the vlan1
 ­p
 tcp
 ­­dport
 80
 ­d

packet has nowhere to go once it enters the 192.168.1.150
­j
ACCEPT

private network space. 

The two lines of code provide the
commands necessary to forward port 80 to
the internal IP address 192.168.1.150 using
TCP. As discussed in class TCP is a reliable
connection oriented transfer protocol so the
message will be received. The Protocol can
be changed to whatever is appropriate for
the task though. In addition this code is
actually updating the iptables of the
OpenWRT firmware to allow for the port
forwarding.


Figure 1 While researching the full implementation


of port forwarding for the newest version of
A. Linksys Port Forwarding OpenWRT, Kamikaze, I found
For the Linksys default interface, port documentation very lacking from the official
forwarding is done from a Graphic User OpenWRT website. I was able to cross-
Interface (GUI) with certain available reference various pages to find the proper
customizations, shown in Figure 1. You can course for implementing the port forwarding
choose a range of ports to forward to and the option though.
private ip address of that computer. You
can also specify the protocol to use for the The file that code needs to be placed in is
forwarding. This feature ensures the the ‘firewall’ file. This file will update the
information is forwarded using the correct code to allow access through your
OpenWRT firewall to the machines on the
internal network. The first step is to update This will allow port 25 access through your
the file /etc/config/firewall with: OpenWRT firewall which would otherwise
block it from your private network. It
“config defaults redirects the incoming port 25 to the specific
option syn_flood 1 ip address 192.168.1.5 on port 25. You can
option input ACCEPT substitute your ip address as appropriate.
option output ACCEPT
option forward REJECT The previous coding will allow forwarding
of any WAN port to a LAN port. This is
config zone very useful because now you can forward
option name lan information to only one machine on your
option input ACCEPT LAN, but that is only half of the objective.
option output ACCEPT
option forward REJECT It is also desirable to have a LAN port
forwarded to a WAN port. This is a slightly
config zone more complicated task as most port
option name wan forwarding is done from WAN to LAN.
option input REJECT This is also referred to as Loopback Port
option output ACCEPT Forwarding because you are looping back on
option forward REJECT top of yourself to send information back to
option masq 1 the source.

config forwarding In the firewall.user file enter the following


option src lan lines of code:
option dest wan
option mtu_fix 1” [11] “iptables -t nat -A prerouting_rule -
d “public IP address here”0 -p tcp -
option path /etc/firewall.user -dport 80 -j DNAT --to “LAN IP
here”
This code will enable port forwarding iptables -A forwarding_rule -p tcp --
commands for your router. The next step is dport 80 -d “LAN IP here” -j
to setup your ports to forward with the ACCEPT
following code in the same firewall file. iptables -t nat -A postrouting_rule -s
“CIDR Notation of LAN” -p tcp --
“config 'redirect' dport 80 -d “LAN IP here” -j
option 'src' 'wan' MASQUERADE” [12]
option 'proto' 'tcp'
option 'src_ip' '' With this last piece of code you can now
option 'src_dport' '25' restart your firewall to enable the
option 'dest_ip' '192.168.1.5' portforwarding and loopback abilities
option 'dest_port' '25' “>/etc/init.d/firewall”.

config 'rule' The OpenWRT router will now be capable


option 'src' 'wan' of completing communication to and from a
option 'proto' 'tcp' WAN machine because the router has
option 'src_ip' '' information for both sending and receiving
option 'dest_ip' '' information on the specified port.
option 'dest_port' '25'
option 'target' 'ACCEPT'”[11]
V. General Wireless Repeater option ssid
HostSSIDHere
Wireless repeaters are used in circumstances option encryption none [1]
where due to obstacles, signal attenuation, or
other factors cause the loss of a signal of
over the air transmissions. For this papers Add to file /etc/config/network: [1]
application we focus on a wireless internet
repeater. This would be useful in large config switch eth0
block houses where the signal farther away option vlan0 "1 2 3 4 5*"
from the access point and router is degraded option vlan1 "0 5"
so much that speed and accessibility are a
problem. config interface loopback
option ifname "lo"
This function has been implemented in the option proto static
Linksys router discussed in this paper and option ipaddr 127.0.0.1
option netmask 255.0.0.0
can be activated by a few simple steps in its
proprietary GUI, refer to reference [14].
This paper will focus and explore the config interface lan
OpenWRT wireless repeater functions option type bridge
though. option ifname "eth0.0"
option proto 'static'
VI. OpenWRT Wireless Repeater option ipaddr '10.0.0.1'
option netmask
From the OpenWRT website the code is '255.255.255.0'
available to enable wireless repeater option gateway ''
functions in OpenWRT. Add the following option dns ''
code to the file /etc/config/wireless:
config interface wan
config wifi-device wl0 option ifname "wl0"
option type broadcom option proto dhcp
option channel 5
# disable radio to prevent an open This will enable the router to act as a
repeater now instead of just an access point.
ap after reflashing:
option disabled 0 This is possible because the wireless card of
the router actually has two wireless
config wifi-iface interfaces that can be configured separately.
option device wl0 Now one of the interfaces acts as the base
option network lan station to access the WAN or internet while
option mode ap the other is configured as a wireless repeater
option ssid and can send and receive information from
YourSSIDHere another wireless repeater.
option hidden 0
With this you can connect multiple routers
option encryption wep
option key '1' together in a chain to connect a larger area
option key1 through the same WAN Base Station. As
'XXXXXXXXXXXXXXXXXX shown in figure 2.
XXXXXXXX'

config wifi-iface
option device wl0
option mode sta
that does not mean it is their only
application. Both can be used for other
applications and the principles are the same.

For instance cell phones are all connected on


a large scale wireless network and if each
cell phone could be turned in to a wireless
repeater it would effectively increase the
range of every cell phone tower because
they now have thousands of mini repeaters
out their relaying information back to the
tower that it would not normally have
received. Many researchers and students are
already working on this problem and
Figure 2 [14] OpenWRT may be a possible solution or
stepping stone on the way to that solution.
The figure illustrates a wired connection,
between the Access Point (AP) and WAN, While I did not achieve my original goal of
but this could just as easily be a wireless implementing OpenWRT on my home
connection. The flexibility of the wireless router I was able to find out that it was
repeater gives a lot more capabilities than possible and given the write tools could
the wired infrastructure in the home and complete it. I was able to complete my goal
commercial application because the AP can of researching the port forwarding and
be moved to wherever it is needed much wireless repeater abilities of OpenWRT and
more easily than a wire connection. see how they are implemented in a
commercial device.
This code to enable the wireless router also
offers great flexibility in the protocol usage With OpenWRT’s past success and its new
and netmask choices to configure your classification as Software in the public
router that can affect speed and reliability. interest its capabilities will continue to
improve and develop. Its abilities can be
VII. Conclusion levereaged in the future to expand all
wireless communication and perhaps a
The OpenWRT implementation for port devlopment first implemented in OpenWRT
forwarding and wireless repeater both offer can be used in the commercial world to
the advantages of customization to the user extend coverage to places it has never been.
for use with the personal computers and
networks. Through these customizations the VIII. Reference list
user can allow applications to run faster and
more efficiently in their home over a [1] “OpenWRT” Wikipedia,
wireless LAN if they desire. <http://en.wikipedia.org/wiki/OpenWRT>

I was able to find the process for [2] “Open WRT wireless freedom”.
implementing both of these capabilities for <http://nuwiki.openwrt.org/oldwiki/OpenWr
the OpenWRT enabled router, but was not tDocs/Hardware/Linksys/WRT54GL>
able to enact them due to the issues
discussed in this paper. [3] “Tutorials for OpenWRT”
<http://www.macsat.com/oldguides/>
While I focused on the implementation of
these capabilities on a wireless home router
[4] “Linksys WRT54GL v1.1 english”
<http://www.hendlsofen.de/WRT54GL/eng/
WRT54GL_main.html>

[5] “OpenWRT Nears Primetime”


<http://www.linux.com/archive/feature/1141
15>

[6] “OpenWRT”
<http://oldwiki.openwrt.org/OpenWrtDocs(
2f)Hardware(2f)Linksys(2f)WRT54GL.html
#head-
d34b409c6c22cd8b5b10f3215f99eeac6c846
0d8>

[7] “Rod Whiteby”


<http://www.rwhitby.net/projects/wrt54gs>

[8] “Port Forwarding with OpenWRT” <


http://www.nowhere.dk/articles/port-
forwarding-with-openwrt-kamikaze>
[9] “port forwarding”
http://portforward.com/help/portforwarding.
htm

[10] “Nyetwork Wiki”


http://www.nyetwork.org/wiki/OpenWrt

[11] “Small Business Tech Solutions” <


http://www.sbtechsolutions.biz/more-
complicated-instructions/openwrt/setting-
up-port-forwarding-and-dealing-with-
loopbacks-on-openwrt-kamikaze-8.09.1>

[12] “PixelChef” <


http://pixelchef.net/content/how-setup-
loopback-port-forwarding-openwrt-
kamikaze>

[13] “Wireless Communications” Second


Edition. Prentice Hall. Theodore Rappaport.
2002.

[14] Cisco Systems.


http://www.cisco.com/en/US/docs/routers/ac
cess/800/860-880-
890/software/configuration/guide/wireless_o
verview.html

You might also like