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
Řádek 11: Řádek 11:
   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
Alternatively, if your central router does not restore the DSCP marks, you should mark connections, not packets:
  add chain=prerouting tos=104 action=mark-connection new-connection-mark=voip-sip passthrough=yes
  add chain=prerouting tos=184 action=mark-connection new-connection-mark=voip-rtp passthrough=yes
Finally, the queues:


   /queue simple
   /queue simple
Řádek 16: Řádek 23:
   name="VOIP-RTP" interface=all packet-marks=voip-rtp priority=0
   name="VOIP-RTP" interface=all packet-marks=voip-rtp priority=0


Note that the default pfifo queueing discipline, used on ethernet interfaces in Linux and Mikrotik, 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.
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.
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.

Verze z 24. 11. 2007, 07:58

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:

 /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

Alternatively, if your central router does not restore the DSCP marks, you should mark connections, not packets:

 add chain=prerouting tos=104 action=mark-connection new-connection-mark=voip-sip passthrough=yes
 add chain=prerouting tos=184 action=mark-connection new-connection-mark=voip-rtp passthrough=yes

Finally, the queues:

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

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.