Routing Ethernet to 3g/4g


#1

Hello,

I’m new using a mangOH-green and FX30. I would like to create a router that transfers all data from/to a legacy Ethernet device towards a server via 3G/4G connection.

Is there such an application for the Sierra platform?

Best regards,

Roland


#2

I tested these instructions on a mangOH Red a while back and they seemed to work. I don’t imagine it will be much different on an FX-30.

enable forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

this command opens up eth0 to accept all packets
iptables -A INPUT –i eth0 –j ACCEPT

provide NAT so that many devices connected to the Ethernet port can use the same single IP provided to the cellular data connection
iptables -t nat -A POSTROUTING -o rmnet0 -j MASQUERADE

Forward related packets arriving on rmnet0 to eth0
iptables -A FORWARD -i rmnet0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT

Forward all packets arriving from eth0 that are destined to rmnet0
iptables -A FORWARD -i eth0 -o rmnet0 -j ACCEPT

To really make this work nicely, you will probably want to run a DHCP server on eth0 rather than a DHCP client. You should look at dnsmasq for that. Try poking around /etc/dnsmasq.d/ to figure that out.

If you will just be plugging a single legacy device directly into the ethernet port, then you could skip DHCP and just assign a static IP to your legacy device and eth0 of the fx30. Then you need to configure the routing table of your legacy device such that the IP of the fx30’s eth0 is your legacy device’s default route.


Internet Access with Mangoh Red over PC
#3

Dear dfrey,

That looks like a straight forward recipe :slight_smile:

I will definitely test this!

Regards,

Roland


#4

HI friend, Have you tried this ? I am facing the same issue. Could not able to resolve.
LAN is detecting . But, Internet access is not sharing.


#5

Below is the step to share the cellular connection over Ethernet

// start data connection
// ( www is sample APN )
cm data apn www
cm data connect 30 &

// create a bridge
brctl addbr br0
brctl addif br0 eth0
ifconfig br0 192.168.0.1 up

// start dhcp process, customer can modify the default /etc/dnsmasq.conf
killall dnsmasq
dnsmasq -i br0 -I lo -z --dhcp-range=br0,192.168.0.20,192.168.0.60,255.255.255.0,43200 --dhcp-hostsfile=/etc/dhcp_hosts --dhcp-option-force=6,8.8.8.8 --dhcp-option-force=120,abcd.com &

// set iptables rules, here we just allow everything, customer should review it.
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT

//enable routing
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o rmnet0 -j MASQUERADE


#6

Hi,

My understanding is that you are creating a bridge interface which I believe requires that both interfaces be ethernet capable. The rmnet0 interface is not an ethernet device and thus this won’t work. Please try following the instructions that I mentioned in my previous post and let me know if you have any problems after that.


#7

HI dfrey,

Thanks for your comments. But, comments which i mentioned on Oct 27 is also working for me. If i connect Ethernet from MangOH green to any PC, PC is able to access internet.

Thanks.


#8

Interesting. I thought I had tried something like that initially and it didn’t work. I will have to revisit this again at some point. Thanks for the update.


#9

hes basically mimicking the WRT / LEDE way of creating the bridge… both ways from what i have read will work…