USB Over Ethernet EEM- Implementing port forwarding and NAT


#1

Hi all, I am using Sierra Wireless Controller Installed with Legato version 15.8 which I will update to 16.04… On board I have 1 USB port to connect the board to my PC’s USB. I am looking to provide internet services to my PC which are received from GPRS on Sierra Wireless.

I understand that this would require EEM/ECM implemented and thus using port forwarding to send and receive packets from and to my PC.

Is there any particular API and flow provided by the framework or do I need to implement the things bypassing the framework and using the Iptables on linux layer of the board.
Or If this is possible in some other manner then please suggest.


#2

Hi NiteshGarg,
If my understanding is correct you want to use Sierra Wireless module as USB modem i.e, You want to access the internet on your host PC through the USB port which are received from GPRS on Sierra Wireless module.

Please fallow the below steps/rules to access internet on the host PC through the USB port connect between your PC and Sierra Wireless module.

First setup the static IP address in your Ubuntu PC, open the following file:

vi /etc/network/interfaces

You may see a line looking like below:
auto eth0
iface eth0 inet dhcp

Change it to looking below and save the file.
auto usb0
iface usb0 inet static
address 192.168.2.3
netmask 255.255.255.0
gateway 192.168.2.2
dns-nameservers 4.4.4.4
dns-nameservers 8.8.8.8

After adding the above changes and saving, Reboot your ubuntu PC for the above changes to get reflected.

After rebooting the ubuntu PC, Run the below command to set the default GW, Here the 192.168.2.2 is Sierra Wireless module’s IP address.

sudo route add default gw 192.168.2.2 usb0

Run the below rules on the Sierra Wireless module:

sysctl -w net.ipv4.ip_forward=1
iptables -t nat -I POSTROUTING -o rmnet0 -j MASQUERADE
iptables -A FORWARD -o usb0 -i rmnet0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i usb0 -o rmnet0 -j ACCEP

I tried the above steps with WP8548 module, I was able to access the internet on my host PC. I am not sure which module you are using, I think steps should be same for any other module also.

Regards,
Muralidhara N.