Is bond0 ready and a bonding interface? - 4G Bonding Router Problems (RPI)

HI all,

First post on the forum, and my first proper project on the Paspberry Pi, so sorry if this is in the wrong place.

I am trying to turn my Pi in to a 3G/4G Bonding router. I have been researching and trying this for a week or so now. The basic plan is to have up to 6 ZTE MF823 USB dongles. The Pi would then bond them together in to bond0. It would then forward traffic on eth0 (my internal network) to the bond. Having the bond on a mode to allow for maximum bandwidth & redundancy.

I started with setting up my Pi as a router. It took me some time and a lot of problems but I have managed to use iptables to forward traffic from eth0 to usb0, and this works perfectly.

I have set up isc-dhcp-server on my Pi and added the IP range for the local subnet. So I have proven that my Pi works as a router, with one internet source.

The problem I am getting starts with plugging in two of the dongles. They both go in separate ports on the PI but both get the same IP (192.168.0.194) and the same MAC address. But they are on different interfaces, usb0 + usb1. But when on the 192.168.0.1 page the information about the dongle says that it has got a public ip with in it. I have tried setting usb0 & usb1 to dhcp and static, on dhcp they both get the same 192.168.0.194 address. On static they wont actually connect to the internet.

I would like to also add the ability to access all of the USB modems control page, but they all come though on 192.168.0.1, can I change this to work in a sequensual order? 192.168.0.1, 192.168.0.2, 192.168.0.3 ....

So my question/request is for a bit of guidance on setting up the bond. I have followed some guides that talk you though setting up the bond but have had no luck, I currently am getting the error message �Failed to enslave usb0 to bond0, Is bond0 ready and a bonding interface?� when I start networking.

I have the follow setup;

Raspberry Pi B+
Latest Raspbian
LTE MF823 X 2
1 - 4 USB hub, used just to allow space for both dongle to plug in, one plugs into that and the other into the Pi.

My /etc/network/interfaces looks like

auto lo
auto bond0
auto eth0
auto usb0
suto usb1

iface lo inet loopback

iface bond0 inet static
address 192.168.1.2
gateway 192.168.0.1
netmask 255.255.255.0
bond-slave none (have tried with �usb0 usb1� aswell)
bond-mode balance-alb
bond0miimon 100

iface eth0 inet static
address 192.168.1.1

iface usb0 inet dhcp
bond-master bond0
#comes up as 192.168.0.194

iface usb1 inet static
address 192.168.0.195
bond-master bond0

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Iptables walk though - Wayback Machine_up_a_simple_Debian_gateway

#!/bin/sh

PATH=/usr/sbin:/sbin:/bin:/usr/bin

#
# delete all existing rules.
#
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X

# Always accept loopback traffic
iptables -A INPUT -i lo -j ACCEPT


# Allow established connections, and those not coming from the outside
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state NEW -i ! eth1 -j ACCEPT
iptables -A FORWARD -i bond0 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT

# Allow outgoing connections from the LAN side.
iptables -A FORWARD -i eth0 -o bond0 -j ACCEPT

# Masquerade.
iptables -t nat -A POSTROUTING -o bond0 -j MASQUERADE

# Don't forward from the outside to the inside.
iptables -A FORWARD -i bond0 -o bond0 -j REJECT

# Enable routing.
echo 1 > /proc/sys/net/ipv4/ip_forward

I then chmod 755 and executed it as well as saved in if-up.d. I swapped the eth1 for usb0 to test it, and then I have changed it to bond0 for it to pass that though.

Router walk though (DHCP setup ) - g7smy.co.uk/?p=505
A bonding walk though - linuxhorizon.ro/bonding.html
A bonding walk though - networking - How to merge multiple Internet connections into one? - Ask Ubuntu

I have tried numerous walk thoughts for bonding but all seem to come up short.

My problems;

  • USB Modems not getting there own IP's and MAC address
  • Bond not starting/set up correctly

If any one has any ideas or solutions i would love to hear them.

Many thanks.
Elliott