islander
Posts: 2
Joined: Sun Oct 12, 2014 9:18 pm

Connect to WiFi DHCP with fixed IP and 3g simultaneoulsy

Sat Oct 18, 2014 10:45 am

I'm impressed with the discussions I've seen here over the raspberry Pi. I'm a software architect and developer, currently working on a robotics project and I'm at the end of the tunel :) Here's the question:

Is it possible to connect the the Raspberry Pi to a fixed IP active DHCP server (over wi-fi, no internet) and to a 3g internet network simultaneously.

Now both are working independently, that is, it is possible to establish a wi-fi connection using the WiFi edimax adapter and connect to the internet using 3g modem. But, I need to send and receive packets over the (fixed IP to fixed IP) dhcp and at the same time all other applications on the Pi should keep using internet.

I would really appreciate any kind of direction .

(The PI is running raspbian OS)

drgeoff
Posts: 10676
Joined: Wed Jan 25, 2012 6:39 pm

Re: Connect to WiFi DHCP with fixed IP and 3g simultaneouls

Sat Oct 18, 2014 6:18 pm

Your teminology "DHCP with fixed IP" has confused me so much that I don't understand what you mean by it. :(

If you are asking "Can traffic for some IP address(es) be sent via one network interface while traffic for other IP address(es) is sent via a different network interface?" then the answer is "Yes, but possibly not without installing and configuring extra package(s) over and above the default Raspbian download".

Tobor Retsam
Posts: 1
Joined: Thu Oct 23, 2014 7:22 am

Re: Connect to WiFi DHCP with fixed IP and 3g simultaneouls

Thu Oct 23, 2014 7:43 am

I suggest you use n2n (from ntop.org). It allows you to ignore dynamic IP addresses assigned by your DHCP daemon. On your Pi you should run really tiny server 'supernode' and one instance of an 'edge' with fixed ip address (say 9.9.9.1). Now, on any machine on your wifi network you can run an instance of the 'edge' with another fixed ip address (9.9.9.*).

From that moment on, you can access those machines (and all those machines can access pi). This is kind of 'no pain' VPN. Mind to use the same version of n2n on all machines. Do not use old versions coming with some distributions (even Kali Linux is wrong).

islander
Posts: 2
Joined: Sun Oct 12, 2014 9:18 pm

Re: Connect to WiFi DHCP with fixed IP and 3g simultaneouls

Mon Nov 03, 2014 7:31 pm

Indeed drgeoff, my point on dhcp is confusing :) but it's a bit of complicated stuff for me being more from a
programming background.. Thanks for you response which is to the point.. I managed to get it to work.

Let me explain in clearer terms, what I meant is that I wanted to have a fixed IP being acquired from the DHCP server evrytime,
which Tobor did propose a nice solution to. However, I just chose to go with a node.js http server for now instead of the
fixed IP ; this will make communication with the PI simpler. So the wlan ip is dynamic from the dhcp in my current setup and the node.js application communicates across both network intefaces (3g and Wifi) whenever required.

Thanks again for your responses. it helped. For those that this could help, here's my setup on top of the RPI:

1. A USB WiFi Adapter ( Edimax – Wireless 802.11b/g/n nano USB adapter)
2. Corresponding extract from /etc/network/interfaces setup ( I am connecting to an unsecured wlan ) :
allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-essid ardrone2_113089
3. 3g usb dongle (Huawei e3131) and the tutorial from here using sakis3g, though defunct worked for me and much simpler than other methods :http://raspberry-at-home.com/installing-3g-modem/

lewis-mj
Posts: 4
Joined: Mon Nov 03, 2014 4:34 pm

Re: Connect to WiFi DHCP with fixed IP and 3g simultaneouls

Fri Nov 07, 2014 1:28 pm

I'm not sure what you are after, but if I read it correctly:

i) You have wireless USB device, this will get your Pi assigned an ip address
from a wireless router.
e.g. on mine, I'll see an IP Address on 'wlan0', usually within your router config (different per router) you can assign specific IP if you want to (usually not worth bothering).

ii) On your ethernet port eth0 - you can assign yourself a fixed IP address 192.168.1.1 for example (192.168 => internal network),

You could then do two things:
i) Use dhcp or something like dnsmasq to run a dhcp server, so that if you are connected to an ethernet router, other Pi will pick up their IP from 'this' Pi.
In the 'other Pi' they should set their resolv.conf to have a nameserver=first pi (e.g. 192.168.1.1)

ii) Google 'debian internet gatweay' you can write a simple ipTables script to ensure that your main Pi acts as internet gateway, effectively forwarding all requests to the wireless usb adaptor.

Return to “Networking and servers”