I want to achieve equal distribution between two PPP client interfaces with dynamically assigned IPs.
The purpose is to achieve:
- Double the bandwidth available for clients
- Failover in case one of the connections go down
I have the following setup:
/port
set 0 baud-rate=auto data-bits=8 flow-control=none name=serial0 parity=none \
stop-bits=1
set 1 baud-rate=9600 data-bits=8 flow-control=none name=usb2 parity=none \
stop-bits=1
set 2 baud-rate=9600 data-bits=8 flow-control=none name=usb3 parity=none \
stop-bits=1
Flags: I - inactive
# NAME CHANNELS USED-BY BAUD-RATE
0 serial0 1 Serial Console auto
1 usb2 3 PPP <ppp-out1> 9600
2 usb3 2 PPP <ppp-out2> 9600
/interface ppp-client
add add-default-route=no allow=pap,chap,mschap1,mschap2 command-channel=0 \
comment="" data-channel=0 dial-command="ATDT phone=*99***1#" \
dial-on-demand=no disabled=no info-channel=0 max-mru=1500 max-mtu=1500 \
modem-init=at&f mrru=disabled name=ppp-out1 null-modem=no password=cdma \
phone="" port=usb2 profile=default use-peer-dns=no user=cdma
add add-default-route=no allow=pap,chap,mschap1,mschap2 command-channel=0 \
comment="" data-channel=0 dial-command="ATDT phone=*99***1#" \
dial-on-demand=no disabled=no info-channel=0 max-mru=1500 max-mtu=1500 \
modem-init="AT+CGDCONT=1,\"IP\",\"internet\"" mrru=disabled name=ppp-out2 \
null-modem=no password="" phone="" port=usb3 profile=default \
use-peer-dns=no user=""
/ip firewall mangle
add action=mark-connection chain=prerouting comment=\
"Mark every 2. new connection for PPP1" connection-state=new disabled=no \
in-interface=ether1 new-connection-mark=ConnPPP1 nth=2,1 passthrough=yes
add action=mark-routing chain=prerouting comment=\
"Mark all packets in conn ConnPPP1 with routing mark RoutingPPP1" \
connection-mark=ConnPPP1 disabled=no in-interface=ether1 \
new-routing-mark=RoutingPPP1 passthrough=no
add action=mark-connection chain=prerouting comment=\
"Mark the rest of new connections for PPP2" connection-state=new \
disabled=no in-interface=ether1 new-connection-mark=ConnPPP2 nth=2,2 \
passthrough=yes
add action=mark-routing chain=prerouting comment=\
"Mark all packets in conn ConnPPP2 with routing mark RoutingPPP2" \
connection-mark=ConnPPP2 disabled=no in-interface=ether1 \
new-routing-mark=RoutingPPP2 passthrough=no
/ip route
add comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=ppp-out1
add check-gateway=ping comment="" disabled=no distance=1 dst-address=\
0.0.0.0/0 gateway=ppp-out2 routing-mark=RoutingPPP2
add check-gateway=ping comment="" disabled=no distance=1 dst-address=\
0.0.0.0/0 gateway=ppp-out1 routing-mark=RoutingPPP1
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
# DST-ADDRESS PREF-SRC G GATEWAY DISTANCE IN..
0 A S 0.0.0.0/0 r ppp-out1 1 pp..
1 A S 0.0.0.0/0 r ppp-out2 1 pp..
2 A S 0.0.0.0/0 r ppp-out1 1 pp..
3 ADC 10.0.0.0/24 10.0.0.1 0 et..
4 ADC 10.112.112.125/32 77.16.84.54 0 pp..
5 ADC 10.112.112.132/32 91.149.48.53 0 pp..
As can be seen, every second new connection is connmarked for ConnPPP1 and ConnPPP2, respectively.
Then all packets belonging to these connmarked connections are assigned routing marks.
In my routing table I have 2 entries for 0.0.0.0/0, dealing with the routing marked packets.
In addition I have defined two routing entries, without routing marks, assuming they will take care of the packets from the router itself. When disabling one of the PPP clients, the associated route becomes blue.
I don’t need round-robin on this router-originated traffic, it’s okay to always use #1 and then just switch to #2 in case #1 fails. I think I have achieved this.
My question is: What happens with the packets routing-marked “RoutingPPP1” in case interface PPP-Out1 goes down? Will the packets be lost, and then retransmitted over the other gateway?
Because gateway addresses are unknown, my first two routes are specified to use a certain interface, not address. I assume for this reason they cannot be pinged? At least the routes don’t turn blue when disabling the associated interface.
So what is the correct way of doing this?
Demands:
-nth distribution (round-robin) of traffic through router
-any interface used for router originated traffic
-failover for all traffic