KB111: Configuring Red5/FMS on a dedicated IP
A few of the advanced samples on the Samples page employ Red5. Red5
is a web server similar to IIS or Apache, and is used to serve the RTMP protocol. Red5
is an open-source alternative to Flash Media Server by Adobe. Most of the info
in this note applies to FMS as well.
Red 5 is easy to install and will coexist by default with IIS or Apache. A Flash
client will normally connect to Red5 or FMS via RTMP on port 1935. If this
fails (due to firewalling) then it reverts to a RTMPT ("http tunnelling")
protocol. By default Red5 serves RTMPT on port 8088, rather than the normal
port 80 - it does this so as not to interfere with any web server that you
might be running on the same machine. However some corporate firewalls are set
to restrict traffic to only port 80 (regular http) and port 443 (https).
So in the default configuration, a small percentage of clients will not
be able to connect, as they will not be able to revert to RTMPT.
To verify if your server supports RTMPT on port 80, you can use the Port
Tester tool. You can normally get there by pointing your browser to:
http://xx.xx.xx.xx:5080
Red5 implements http as debugging tool, and this defaults to port 5080. Choose
to view the sample apps, and then select Port Tester. Enter your IP address and
click Run. The following shows that RTMPT is not enabled on port 80.
If your server is dedicated to Red5 traffic, then you can simply change your
Program Files\Red5\conf\red5.properties file setting of
rtmpt.port=8088
to
rtmpt.port=80
and then restart the Red5
service. However if you do this on a web server that is also running IIS or Apache
then you Red5 will fail to start, and the Red5 log will contain an error referring to
a port being unavailable. This is because IIS (or Apache) has obtained a lock on port 80.
To enable Red5 and IIS/Apache to coexist, you need to obtain a second IP address
that is dedicated to Red5. In this example we are calling the original ip xx.xx.xx.xx and
the second one yy.yy.yy.yy. Once an IP address has been assigned by your ISP, you
need to set it up on your network card. To do this, select the Properties menu from
your network connection to get the Local Area Connection Properties dialog. Select
the Internet Protocol (TCP/IP) entry and click Properties. On the Internet Protocol
(TCP/IP) Properties dialog, click Advanced. In the Advanced TCP/IP Settings dialog,
click Add to add your second IP, along with any submask that you may have been given.
After installing your second IP you will normally be able to use both IPs interchangeably
to view your regular web site(s). To prevent this, navigate to your IIS console (My Computer > Manage,
IIS > Websites > Default Web Site. In the Properties dialog, Web Site tab, you will see
an IP address dropdown with both IPs and the (All Unassigned) setting. You must set this
to the original IP (xx.xx.xx.xx), and not the default (All Unassigned) setting. You need to repeat this
for any other web sites and ftp sites you may have.
Then, in your red5.properties, do a search and replace on the IP 0.0.0.0 to change it to your second
IP address. For example:
rtmpt.host=0.0.0.0
becomes
rtmpt.host=yy.yy.yy.yy
On Windows 2000 this is sufficient to get IIS to pay attention to only the original IP
address, however under Windows 2003 you will still find that Red5 will not start due
to port conflict. This is because Windows 2003 performs "socket pooling" and needs to be
instructed at a lower level to only consider traffic on the original IP - just telling IIS
is not sufficient. To do this you need to obtain the "httpcfg.exe" tool, which is installed as
part of the Windows XP Service Pack 2 Support Tools at the time of writing.
To use it, run this sequence, where xx.xx.xx.xx is your original IP address:
> httpcfg delete iplisten -i 0.0.0.0
HttpDeleteServiceConfiguration completed with 1168.
> httpcfg set iplisten -i xx.xx.xx.xx
HttpSetServiceConfiguration completed with 0.
> httpcfg query iplisten
IP : xx.xx.xx.x
------------------------------------------------------------------------------
> net stop http
> net start http
> iisreset
Verify that httpcfg query iplisten returns your original IP. Note that the special IP 0.0.0.0
is equivalent to (All Unassigned). After completing this, verify that your regular web traffic
still works correctly on the orginal IP address. Connecting to your second IP address will bring
you directly to the Red5 screen. Running the port tool again, pointing to your yy.yy.yy.yy address
will result in a screen similar to the following, indicating that tunnelling is configured correctly
as the fallback protocol on port 80.