QoS for VOIP in Mikrotik: Porovnání verzí

Z Wiki UnArt Slavičín
Skočit na navigaciSkočit na vyhledávání
Bez shrnutí editace
Bez shrnutí editace
 
(Nejsou zobrazeny 2 mezilehlé verze od 2 dalších uživatelů.)
Řádek 7: Řádek 7:


If your central internet gateway router handles/restores the DSCP-marked packets correctly (see the [[HTB]] script that we use on our gateway), then implementing QoS for VOIP packets at your Mikrotik routers is easy - see the following script:
If your central internet gateway router handles/restores the DSCP-marked packets correctly (see the [[HTB]] script that we use on our gateway), then implementing QoS for VOIP packets at your Mikrotik routers is easy - see the following script:
Mikrotik 2.9:


   /ip firewall mangle  
   /ip firewall mangle  
   add chain=prerouting tos=104 action=mark-packet new-packet-mark=voip-sip passthrough=yes
   add chain=prerouting tos=104 action=mark-packet new-packet-mark=voip-sip passthrough=yes
   add chain=prerouting tos=184 action=mark-packet new-packet-mark=voip-rtp passthrough=yes
   add chain=prerouting tos=184 action=mark-packet new-packet-mark=voip-rtp passthrough=yes
Mikrotik 3:
  /ip firewall mangle
  add chain=prerouting dscp=26 action=mark-packet new-packet-mark=voip-sip passthrough=yes
  add chain=prerouting dscp=46 action=mark-packet new-packet-mark=voip-rtp passthrough=yes


If your central router does NOT restore the DSCP marks for packet incoming from the VOIP providers (and the providers do not mark packets with DSCP), you must implement the same things as in the [[HTB]] script - mark connection, then mark unmarked packets with the connection mark and use the packet marks in the queues (note that Mikrotik 2.9.x can't use connection mark in queue rules)
If your central router does NOT restore the DSCP marks for packet incoming from the VOIP providers (and the providers do not mark packets with DSCP), you must implement the same things as in the [[HTB]] script - mark connection, then mark unmarked packets with the connection mark and use the packet marks in the queues (note that Mikrotik 2.9.x can't use connection mark in queue rules)
Řádek 17: Řádek 26:


   /queue simple
   /queue simple
   name="VOIP-SIP" interface=all packet-marks=voip-sip priority=1
   add name="VOIP-SIP" interface=all packet-marks=voip-sip priority=1
   name="VOIP-RTP" interface=all packet-marks=voip-rtp priority=0
   add name="VOIP-RTP" interface=all packet-marks=voip-rtp priority=1


Note that:
Note that:

Aktuální verze z 21. 5. 2009, 23:14

Prerequisities: Your VOIP SW/HW client can set the DSCP/TOS field in the IP packet in such a way that:

  • SIP signaling messages will be marked by DSCP=0x68 (=104)
  • RTP voice audio data will be marked by DSCP=0xB8 (=184)

These are the default values for SPA-XXXX VOIP gateways, but also SW clients should be able to make these settings. E.g., in XLite, just divide these values by 4 (DSCP for SIP=26, for RTP=46)

If your central internet gateway router handles/restores the DSCP-marked packets correctly (see the HTB script that we use on our gateway), then implementing QoS for VOIP packets at your Mikrotik routers is easy - see the following script:

Mikrotik 2.9:

 /ip firewall mangle 
 add chain=prerouting tos=104 action=mark-packet new-packet-mark=voip-sip passthrough=yes
 add chain=prerouting tos=184 action=mark-packet new-packet-mark=voip-rtp passthrough=yes

Mikrotik 3:

 /ip firewall mangle 
 add chain=prerouting dscp=26 action=mark-packet new-packet-mark=voip-sip passthrough=yes
 add chain=prerouting dscp=46 action=mark-packet new-packet-mark=voip-rtp passthrough=yes


If your central router does NOT restore the DSCP marks for packet incoming from the VOIP providers (and the providers do not mark packets with DSCP), you must implement the same things as in the HTB script - mark connection, then mark unmarked packets with the connection mark and use the packet marks in the queues (note that Mikrotik 2.9.x can't use connection mark in queue rules)

Finally, the queues:

 /queue simple
  add name="VOIP-SIP" interface=all packet-marks=voip-sip priority=1
  add name="VOIP-RTP" interface=all packet-marks=voip-rtp priority=1

Note that:

  • only one queue is necessary if you have DSCP marks on packets in both directions (DSCP marks for incoming packets can be restored on the central internet gateway - see the HTB script). The reason for one queue is that
  • the default pfifo queueing discipline prioritize the DSCP marks automatically, so theoretically, if the central internet gateway restores the DSCP marks on incoming packets from VOIP providers, everything could work OK even without any QoS settings on the router. The pfifo is defaultly used on HTB leafs and also on ethernet interfaces in Linux and Mikrotik which do not have any qdisc assigned.

But if you already do some QoS (e.g. using HTB in Linux or "queues" on Mikrotik)on your routers, you should add also these 2 queues dedicated to VOIP.