mlosh writes:
I've got a Samsung Galaxy Note 10.1 (2014) and would like to connect to a private network through WiFi for development work, but still have access to the general Internet through the 3G/4G cellular radio for other apps. So far, it does not seem possible. Connecting to WiFi seems to route all data through WiFi to the private network, cutting off the Internet. Is there a way to have both radios working and routing packets separately on this Galaxy Note, or any other Android device, short of customizing the network stack software?
(Score: 4, Informative) by Anonymous Coward on Friday March 28 2014, @12:05PM
This is a complicated issue, related to the more general concept of running different connections through different network connections.
The most basic way is to set the "metric" parameter of each network connection - presumably, your wifi connection has a low metric value, so it gets used first. The cell phone network has a higher metric, so it only gets used if the wifi is disabled, or when the wifi doesn't provide a default route.
It sounds like you want to use the cell phone connection by default, and use the wifi only for the local network. You should set the wifi connection to have a higher metric (like 20), and the cell phone radio to have a lower metric (like 10).
If you only want to access hosts on the same subnet as the wifi network, (for example, all on the same 192.168.X.Y network), then you're done. If you have a list hosts not on that subnet, which you also want to access over wifi, then manually add each host to the routing table:
Assuming your wifi network's gateway is 10.8.6.4, and the host you want to contact is "devbox.example".
Since the metric is 1, it will take this route with a higher priority than the metric 10 default route provided by the cell phone network.
(Score: 1) by mlosh on Friday March 28 2014, @01:35PM
Yes, you have the basic scenario right. Configuring this metric parameter looks worth exploring. Thanks for the big hint!
Do you or any other readers know how to configure this in Android 4.1? I don't need to access any other nodes beyond a simple subnet in WiFi, so the extra routing table entries should not be needed. I'd like to configure the gateway address of each network independently too.
(Score: 1, Informative) by Anonymous Coward on Friday March 28 2014, @03:26PM
Skip the metric stuff, that only matters for complicated routing and this ain't complicated. You can ignore that part of the AC's post and just stick to the basics:
1) Set the default route to point to the gateway to the cell network.
2) Add a specific route for the development network to the gateway on the wifi network (like the AC's example, just leave off the metric option, or leave it on, it isn't really do anything)
(Score: 1) by mlosh on Friday March 28 2014, @05:21PM
Yes, thanks, this is probably what I want. I need to set up the route tables to have different gateways for each network device (like I have done with traditional Linux systems before).
The GUI user-level settings app in Android does not let you do this, but it seems that if I install and use the Android Debugging Bridge (ADB) I can use a PC to open a shell and issue the route table change commands... hopefully without rooting and can be made permanent through a startup script or something.
(Score: 0) by Anonymous Coward on Friday March 28 2014, @01:37PM
Has anyone added BGP support for phones? This is much easier once you have created a personal ASN and eBGP peer with something on both networks.
Make sure to filter properly so you do not provide a path to internal resources if they are using non-RFC1918 address space.
(Score: 0) by Anonymous Coward on Friday March 28 2014, @11:07PM
how the fuck did this get modded up to 4?! it is completely wrong. this has ab-so-fucking-lutely nothing to do with metrics. none.
routing tables are matched most specific to least. that does all the stuff you're babbling about up there. metric not related.