FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
+1 vote
509 views 4 comments
by anonymous

Hello,

We have two different streaming packet with DSCP values 0x22 and 0x24. We want to route the packets with DSCP value 0x22 to qmimux8 and 0x24 to qmimux0 on the RUTX12 modem. I use the following iptables rules for this purpose. The rules work good when I send dummy packets with destination IP 8.8.8.8. But when I change the IP to 172.27.224.1, All packet pass through qmimux8:

The Rule:

#!/bin/bash
echo 1 >| /proc/sys/net/ipv4/ip_forward
echo 0 >| /proc/sys/net/ipv4/conf/all/rp_filter

iptables -t mangle -F
iptables -t mangle -X

iptables -I PREROUTING -i br-lan -t mangle -m dscp --dscp 34 -j MARK --set-mark 1
iptables -I PREROUTING -i br-lan -t mangle -m dscp --dscp 36 -j MARK --set-mark 2

# Add two new table to the ip_tables
if ! cat /etc/iproute2/rt_tables | grep -q '^250'
then
        echo '250     rt_link1' >> /etc/iproute2/rt_tables
fi
if ! cat /etc/iproute2/rt_tables | grep -q '^251'
then
        echo '251     rt_link2' >> /etc/iproute2/rt_tables
fi

ip route flush table 250
ip route add table rt_link1 default dev qmimux8
ip route flush table 251
ip route add table rt_link2 default dev qmimux0

ip rule del from all fwmark 2 2>/dev/null
ip rule del from all fwmark 1 2>/dev/null
ip rule add fwmark 1 table rt_link1
ip rule add fwmark 2 table rt_link2

And for testing the rules. I use following commands:

DSCP 0x22: 0x22 (DSCP) ---> 0x88 (TOS)
1- Generating Dummy traffic:
iperf -c 8.8.8.8 -i 1 -u -b 5000K -r -S 0x88
2- Capturing on Modem qmimux8 interface:
tcpdump  -i qmimux8 'ip and (ip[1] & 0xfc) >> 2 == 0x22' -vvv

DSCP 0x24 (Equal to 0x90):

1- Generating Dummy traffic:
iperf -c 8.8.8.8 -i 1 -u -b 5000K -r -S 0x90
2- Capturing on Modem qmimux0 interface:
tcpdump  -i qmimux0 'ip and (ip[1] & 0xfc) >> 2 == 0x24' -vvv

and the mangle table status after applying rules:

Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         
           all  --  anywhere             anywhere             -m quota --grow  --name rx_qmimux0  --quota 0
MARK       all  --  anywhere             anywhere             DSCP match 0x24 MARK set 0x2
MARK       all  --  anywhere             anywhere             DSCP match 0x22 MARK set 0x1

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
TCPMSS     tcp  --  anywhere             anywhere             tcp flags:SYN,RST/SYN /* !fw3: Zone wan MTU fixing */ TCPMSS clamp to PMTU
TCPMSS     tcp  --  anywhere             anywhere             tcp flags:SYN,RST/SYN /* !fw3: Zone wan MTU fixing */ TCPMSS clamp to PMTU
TCPMSS     tcp  --  anywhere             anywhere             tcp flags:SYN,RST/SYN /* !fw3: Zone wan MTU fixing */ TCPMSS clamp to PMTU
TCPMSS     tcp  --  anywhere             anywhere             tcp flags:SYN,RST/SYN /* !fw3: Zone wan MTU fixing */ TCPMSS clamp to PMTU
TCPMSS     tcp  --  anywhere             anywhere             tcp flags:SYN,RST/SYN /* !fw3: Zone wan MTU fixing */ TCPMSS clamp to PMTU
TCPMSS     tcp  --  anywhere             anywhere             tcp flags:SYN,RST/SYN /* !fw3: Zone wan MTU fixing */ TCPMSS clamp to PMTU
TCPMSS     tcp  --  anywhere             anywhere             tcp flags:SYN,RST/SYN /* !fw3: Zone wan MTU fixing */ TCPMSS clamp to PMTU
TCPMSS     tcp  --  anywhere             anywhere             tcp flags:SYN,RST/SYN /* !fw3: Zone wan MTU fixing */ TCPMSS clamp to PMTU
TCPMSS     tcp  --  anywhere             anywhere             tcp flags:SYN,RST/SYN /* !fw3: Zone wan MTU fixing */ TCPMSS clamp to PMTU
TCPMSS     tcp  --  anywhere             anywhere             tcp flags:SYN,RST/SYN /* !fw3: Zone wan MTU fixing */ TCPMSS clamp to PMTU

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
           all  --  anywhere             anywhere             -m quota --grow  --name tx_qmimux0  --quota 0

Chain counter_qmimux0 (0 references)
target     prot opt source               destination     

1 Answer

+1 vote
by anonymous
Hello,

Could you check if the setting on the Failover is set to Load balancing and in the Load balancing settings make sure you put the same values between SIM 1 and SIM 2

Regards,
Mellow
by anonymous

Thanks Mellow,

It was not on Load balancing mode. I put in in Load balancing mode. Then I activated it.

However, it still cannot redirect 0x24 to qmimux0 for 172.27.224.1, but it works for 8.8.8.8

Now it looks like this:

by anonymous

Hello, 

Regarding the issue, you are having. Could you try checking it with the latest firmware available we are having RUTX_R_00.07.00 it is best in doing this firmware upgrade to untick the keep settings to prevent configuration conflicts. 

Latest Firmware: RUTX12 Firmware Downloads - Teltonika Networks Wiki (teltonika-networks.com)

Regards,
Mellow

by anonymous
Hi,

even after flashing with the updated firmware we see the same issue. How can we proceed?

Thanks.
by anonymous

Hello, 

Could you try doing this method try to configure the RUTX12 without applying your script or any alterations it is best to reset to default settings and try configuring it as follows: 

Configure it in Network > Routing > Advanced Routing :

1. Create two routing tables for SimOne and SimTwo where the target and subnet are set to 0.0.0.0 0.0.0.0 

SimOne


SimTwo


2. Configure the Routing Rules for IPv4. 

Sim One 


Sim Two: 



Just test this one if it will work :) 

For clearer images  you can get it here: Pictures
Let me know the results 

Regards,
Mellow