Difference between revisions of "Building Windows Media Service Cluster using LVS"

From LVSKB
Jump to: navigation, search
(Configuration Example)
Line 10: Line 10:
  
 
== Configuration Example ==
 
== Configuration Example ==
 +
In order for us to get this to work, we need to allow the following ports in:<br/>
  
 +
<ul><li>80          tcp (<em>ONLY NEEDED IF YOU ARE SERVING STREAMS THROUGH HTTP</em>)</li>
 +
<li>554          tcp/udp</li>
 +
<li>1755        tcp/udp</li>
 +
<li>1024-5000    udp</li></ul>
 +
 +
<br/>This can be done like so, replacing <b>$EXT_IF</b> and <b>$EXT_IP</b> with your appropriate interface and IP:<br/><br/>
 +
 +
<ul><li>iptables -A INPUT -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 1755 -j ACCEPT</li>
 +
<li>iptables -A INPUT -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 554 -j ACCEPT</li>
 +
<li>iptables -A INPUT -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 554 -j ACCEPT</li>
 +
<li>iptables -A INPUT -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 1024:5000 -j ACCEPT</li></ul>
 +
 +
<br/>(<b><em>example:</em></b>  iptables -A INPUT -i eth0 -p tcp -s 0/0 -d 1.2.3.4 --dport 1755 -j ACCEPT)<br/><br/>
 +
 +
<br/>Next, we need to take a group the packets by using the MANGLE table in iptables.  To do that you would do the following, replacing <b>$EXT_IF</b>, <b>$EXT_IP</b> and <b>$WMS_MARK</b> with your appropriate interface, IP and mark that you would like to tag the packets with:<br/><br/>
 +
 +
<ul><li>iptables -t mangle -A PREROUTING -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 554 -j MARK --set-mark $WMS_MARK</li>
 +
<li>iptables -t mangle -A PREROUTING -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 554 -j MARK --set-mark $WMS_MARK</li>
 +
<li>iptables -t mangle -A PREROUTING -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 1755 -j MARK --set-mark $WMS_MARK</li>
 +
<li>iptables -t mangle -A PREROUTING -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 1755 -j MARK --set-mark $WMS_MARK</li>
 +
<li>iptables -t mangle -A PREROUTING -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 1024:5000 -j MARK --set-mark $WMS_MARK</li></ul>
 +
 +
<br/>(<b><em>example:</em></b>  iptables -t mangle -A PREROUTING -i eth0 -p tcp -s 0/0 -d 1.2.3.4 --dport 554 -j MARK --set-mark WMSLVS1)<br/><br/>
 +
 +
<br/>Next, we need to tell LVS to do the load balancing.  This can be done by doing the following, replacing <b>$WMS_MARK</b> and <b>$RSx_IP</b> with the appropriate mark that you chose above and your real server IPs:<br/><br/>
 +
 +
<ul><li>ipvsadm -D -f $WMS_MARK</li>
 +
<li>ipvsadm -A -f $WMS_MARK -s rr -p 600</li>
 +
<li>ipvsadm -a -f $WMS_MARK -r $RS1_IP:0 -m</li>
 +
<li>ipvsadm -a -f $WMS_MARK -r $RS1_2P:0 -m</li></ul>
 +
 +
<br/>(<b><em>example:</em></b>  ipvsadm -A -f WMSLVS1 -s rr -p 600)
 +
<br/>(<b><em>example:</em></b>  ipvsadm -a -f WMSLVS1 -r 10.10.10.1:0 -m)
 +
 +
<br/><br/>Once you have completed these steps, you should have a working Windows Media Streaming Server LVS!  Enjoy!
  
 
== Conclusion ==
 
== Conclusion ==

Revision as of 17:17, 13 July 2006

Introduction

Microsoft Windows Media Service uses uses two streaming media protocols to deliver content as a unicast stream to clients:

  • Real Time Streaming Protocol (RTSP)
  • Microsoft Media Server (MMS) protocol


Architecture

Configuration Example

In order for us to get this to work, we need to allow the following ports in:

  • 80 tcp (ONLY NEEDED IF YOU ARE SERVING STREAMS THROUGH HTTP)
  • 554 tcp/udp
  • 1755 tcp/udp
  • 1024-5000 udp


This can be done like so, replacing $EXT_IF and $EXT_IP with your appropriate interface and IP:

  • iptables -A INPUT -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 1755 -j ACCEPT
  • iptables -A INPUT -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 554 -j ACCEPT
  • iptables -A INPUT -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 554 -j ACCEPT
  • iptables -A INPUT -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 1024:5000 -j ACCEPT


(example: iptables -A INPUT -i eth0 -p tcp -s 0/0 -d 1.2.3.4 --dport 1755 -j ACCEPT)


Next, we need to take a group the packets by using the MANGLE table in iptables. To do that you would do the following, replacing $EXT_IF, $EXT_IP and $WMS_MARK with your appropriate interface, IP and mark that you would like to tag the packets with:

  • iptables -t mangle -A PREROUTING -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 554 -j MARK --set-mark $WMS_MARK
  • iptables -t mangle -A PREROUTING -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 554 -j MARK --set-mark $WMS_MARK
  • iptables -t mangle -A PREROUTING -i $EXT_IF -p tcp -s 0/0 -d $EXT_IP --dport 1755 -j MARK --set-mark $WMS_MARK
  • iptables -t mangle -A PREROUTING -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 1755 -j MARK --set-mark $WMS_MARK
  • iptables -t mangle -A PREROUTING -i $EXT_IF -p udp -s 0/0 -d $EXT_IP --dport 1024:5000 -j MARK --set-mark $WMS_MARK


(example: iptables -t mangle -A PREROUTING -i eth0 -p tcp -s 0/0 -d 1.2.3.4 --dport 554 -j MARK --set-mark WMSLVS1)


Next, we need to tell LVS to do the load balancing. This can be done by doing the following, replacing $WMS_MARK and $RSx_IP with the appropriate mark that you chose above and your real server IPs:

  • ipvsadm -D -f $WMS_MARK
  • ipvsadm -A -f $WMS_MARK -s rr -p 600
  • ipvsadm -a -f $WMS_MARK -r $RS1_IP:0 -m
  • ipvsadm -a -f $WMS_MARK -r $RS1_2P:0 -m


(example: ipvsadm -A -f WMSLVS1 -s rr -p 600)
(example: ipvsadm -a -f WMSLVS1 -r 10.10.10.1:0 -m)



Once you have completed these steps, you should have a working Windows Media Streaming Server LVS! Enjoy!

Conclusion

References


LVS.png "Building Windows Media Service Cluster using LVS" is an LVS Example related stub. You can help LVSKB by expanding it