LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-18-2014, 06:54 AM   #1
Elliottlc
LQ Newbie
 
Registered: Oct 2014
Posts: 7

Rep: Reputation: Disabled
Is bond0 ready and a bonding interface? - 4G Bonding Router Problems


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

Code:
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 - https://www.debian-administration.or...Debian_gateway

Code:
#!/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 ) - http://www.g7smy.co.uk/?p=505
A bonding walk though - http://www.linuxhorizon.ro/bonding.html
A bonding walk though - http://askubuntu.com/questions/53499...tions-into-one


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
 
Old 10-20-2014, 02:56 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,857

Rep: Reputation: 161Reputation: 161
The setup in interface files is mixed, half bond and half individaul.
You should setup three individaul interface, eth0, usb0 and usb1, at first and make sure these three interfaces work well. And then move to bond.
 
Old 10-21-2014, 08:35 AM   #3
Elliottlc
LQ Newbie
 
Registered: Oct 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
Hey, thanks for replying. i have been using before with those three only in there so i know they work, so it seems it is the bond thats upsetting it, would something like this be better.

Code:
auto lo
iface lo inet loopback

#LAN Facing NIC
auto eth0
iface eth0 inet static
address 192.168.1.1

#USB Modem one (EE)
auto usb0
iface usb0 inet dhcp
bond-master bond0

#USB modem two (o2)
auto usb1
iface usb1 inet static
address 192.168.0.195
bond-master bond0

#USB NIC Bond
auto bond0
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

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Thanks
 
Old 10-21-2014, 02:24 PM   #4
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,857

Rep: Reputation: 161Reputation: 161
If bonding eth0 and eth1, they should link following.

#eth0 is manually configured, and slave to the "bond0" bonded NIC
auto eth0
iface eth0 inet manual
bond-master bond0
bond-primary eth0
bond-mode active-backup

#eth1 ditto, thus creating a 2-link bond.
auto eth1
iface eth1 inet manual
bond-master bond0
bond-primary eth0
bond-mode active-backup

# bond0 is the bonding NIC and can be used like any other normal NIC.
# bond0 is configured using static network information.
auto bond0
iface bond0 inet static
address 192.168.77.33
gateway 192.168.77.1
netmask 255.255.255.0
dns-nameservers 192.168.77.1
bond-master bond0
bond-primary eth0
bond-mode active-backup
bond-miimon 100
bond-slaves none
 
Old 10-21-2014, 02:48 PM   #5
Elliottlc
LQ Newbie
 
Registered: Oct 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
Ok cool, so I'm using usb0 & usb1 so it should look some thing like this?


Code:
#LAN facing NIC 
auto eth0
iface eth0 inet manual
bond-master bond0
bond-primary eth0
bond-mode active-backup

#first 4G dongle (EE)
auto usb0
iface usb0 inet manual
bond-master bond0
bond-primary usb0
bond-mode balance-alb

#second 4G dongle (EE)
auto usb1
iface usb1 inet manual
bond-master bond0
bond-primary usb0
bond-mode balance-alb

# bond0 is the bonding NIC and can be used like any other normal NIC.
# bond0 is configured using static network information.
auto bond0
iface bond0 inet static
address 192.168.77.33
gateway 192.168.77.1
netmask 255.255.255.0
dns-nameservers 192.168.77.1
bond-master bond0
bond-primary eth0
bond-mode balance-alb
bond-miimon 100
bond-slaves none
As i am chaining from active -backup to balance-alb do i need to state witch NIC is the primary? Thanks
 
Old 10-22-2014, 02:37 PM   #6
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,857

Rep: Reputation: 161Reputation: 161
What interface do you want to bind, usb0 and usb1, eth0 and usb0 and usb1?
Should eth0 be in bond interface?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Channel bonding Issue - Bond0 interface not getting up in on RHEL6 Rohit_4739 Linux - Networking 13 05-01-2012 04:13 PM
bonding with bond0, but VMware Workstation does not see bond0 dimm0k Linux - Virtualization and Cloud 1 07-14-2011 09:22 PM
bonding bonding-xor and bonding-alb Chrysalis Linux - Networking 1 10-24-2009 02:14 PM
bonding and vlans. Bonding a vlan interface vs applying vlans to a bond interface JasonCzerak Linux - Networking 0 09-11-2008 09:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration