Multiple Network Interfaces, WiFi and/or Ethernet


I have a project where the user can select between a WiFi or an Ethernet connection on a Cobra board. The selection is made through a startup script file located on an SD card or a USB drive. Once the card or the drive has been mounted, the script is parsed and the appropriate network interface is chosen.

My problem is that if I have the GHI MRF24WB0MA based module connected to the Cobra it will be the only one detected. It seems that NetworkInterface.GetAllNetworkInterfaces() returns only one interface. If I disconnect the WiFi module, I will have only the Ethernet interface in the NetworkInterface array but if I connect the WiFi module then it will be the only one to appear in the interface array.

I’ve tried setting the hibernate pin on the WiFi module early upon startup but it doesn’t seem to prevent the Cobra from detecting it although it does seem to disable the module’s functionnality.

Any ideas?


Currently, we do not support multiple network interface. You can freely switch between PPP, WiFi and Ethernet at runtime but you can’t have them all active at once.


Ok, great! That’s precisely what I want to do, switching at runtime as opposed to running both simultaneously. But how can I select the onboard Ethernet port instead of the WiFi module if it isn’t listed by GetAllNetworkInterfaces()?


Whichever you select will be interface[0]

So what you are saying is that I can’t select through “software” which interface I want to use? Must I physically enable or disable one of them in order to switch between them?


Not that is wrong. If you look in the GHI library documentation you will find Ethernet.Enable and WiFi.Enable methods. The function you call will determine what interface is used. It is always interface[0] but this can changed in software and at runtime. No need to reset the system


OK! I’ll try this.


One question is situation still same(that we can use only one interface in same time)?
What I wan’t is that Ethernet is allway active and in same time also WiFi or PPP(not booth at same time)…
Why I need this? I need Ethernet as service interface that some tehnican cam to destination and connect notebook to ethernet(with crossover cable) he can use HTTP interface to configure device settings but device still comunicate with remote server trough WiFi or GPRS/UMTS/HSDPA connection…
Is something like this possible?

GHI is planning on checking this option on NETMF 4.2, no guarantees it will be implemented but it will be looked into for sure…that is about 6 month away.

Thanks for this info then looks like I must find another solution(some switch on board) which enable service mode, disable wifi and PPP and use ethernet… I think this can be easy done :slight_smile:

@ Gus: Did this feature find it’s way into 4.2 now? (Using multiple network interfaces at the same time)
In my case I would like to use 2 wired ethernet connections (2 different networks) on a G120.
So far we use one ENC28 module. Best thing would be to use a 2nd ENC28 which should be no problem on the hardware side, but SW?
Alternatively it might be ok to use one network port with two IP adresses if this is possible.
The 3rd solution I could think of is to use an additional controller which handels the 2nd NW stack and is connected to G120 by SPI. Any ideas which one I could use? Something from Atmel for example?

Yes but we disabled it due to internal reasons. If you look at the new networking support in 4.2 you see how we have all interfaces available at once. Like you can search for wifi connection while using Ethernet. But, the networking stack is not hooked to all interfaces, only one of them. You can simply switch from one to another.

We still want to enable all simultaneously in future but no promises it will happen or when it will.

Unfortuenatlly switching is not an option because we need to keep an FTP server open on one of the interfaces.
The 2nd interface could be a lot: FTP, raw TCP/IP, …
b.t.w. do you know if it is possible to access network shares from NETMF on a Windows or Smaba server?

I am not sure

@ Gus, @ andre, thanks a lot.