0

Due to various reasons, I have 3 WiFi broadband routers at my home (or say my personal hobby hacking lab). On WAN side one is FTTH, another is ADSL and third is 4G-LTE. On WLAN side they are assigned 192.1.x.x, 192.2.x.x, 192.3.x.x subnets, and all of them are configured to assign DHCP IP-address to requesting devices in the 192.x.1.0 - 192.x.200.0 range, and above 192.x.200.0 range are reserved for static-IP address.

House-hold (like many, these days) has half a dozen Android phones / tablets, and few PCs. All of the devices use DHCP for IP-address assignment. However, as one might imagine a device may be connected to any one of the 3 WiFi routers, and as a result may have any IP-address (in 192.x.1 ~ 192.x.200 range, where x = 1, 2, 3).

I am trying to develop an Android application, that needs to use TCP/IP to talk to a specific server. The server is a Linux application, running inside a virtual-machine (Ubuntu 32-bit guest, running on VMWare Workstation Pro 14 hypervisor), on a Windows 10 laptop. The laptop is also assigned IP-address dynamically (DHCP). The Linux virtual-machine uses NAT-mode virtual NIC.

Here is a diagram to explain the setup: enter image description here

The issue is that due to use of dynamic IP, and usage of explicit IP-address (private class, thus not manageable via DNS), I am having to reconfigure the server IP-address in Android client application frequently. A simple solution would be to switch to using static-IP for the servers -- however, I am wondering if there is any alternative approach, that is simple & elegant ?

2
  • 1
    Use of static IPs for servers IS the simple approach.
    – MaQleod
    Commented Nov 4, 2017 at 18:56
  • Thought so. OTOH, one of the laptops (a high end laptop which is able to run some of the software I need) is a company assigned/managed laptop, on which I am unable to change the network configuration from DHCP to Static-IP. This is the one running the VMWare workstation. I could move the server to another spare PC, but didn't want to lose the convenience of developing server application software, on the same laptop.
    – bdutta74
    Commented Nov 5, 2017 at 9:42

2 Answers 2

3

Try a DHCP reservation, provided your router firmware supports it. For DHCPv4 all you need is a MAC address and the desired IP address; the reservation ensures that DHCP will always lease the reserved IP address to a device with the given MAC address.

The clients will always be given the same address, but note that they are still DHCP clients. If DHCP goes offline for longer than DHCP's lease period, they will loose the address and revert to an APIPA address. Also applications that require a static IP address may not be satisfied with a reservation since the IP address is still leased (ADDS for example).

Hope that helps.

1
  • Point taken. Just wondering, why/how will the fact that an IP address is leased, as against being permanently assigned via static assignment, impact the application's behaviour or capabilities ? ADDS = Active Directory Domain Service ?
    – bdutta74
    Commented Nov 5, 2017 at 9:47
2

There are two parts to this question. The first part is how to deal with the 3 WAN connections, the second part how to lookup assigned IP addresses.

The second part is actually not that difficult: You should have a single LAN segment for your entire home, using the routers as Wifi repeaters if necessary. On that LAN segment, you need a single DHCP server combined with a single DNS server. The DHCP server will remember the client names in the DHCP request, and provide them to the DNS server (or you can assign names based on MAC address).

In this way, you will be able to access all device in your home network by name. There are routers that already offer this kind of functionality by default.

The hard part is the 3 WAN connections. The traditional IP protocols don't allow multihoming, so you can't use several internet connections at once. I don't know why you have 3 WAN connections, maybe you want some sort of failover scheme, or maybe you want to decide based on client devices.

If you don't want a unified solution, and you insist on using the 3 routers for 3 subnets, you can still try to setup a single DNS server for all three, but giving this DNS server current information will be more difficult.

Assigning static IPs is of course also a solution, though you'll have to edit the configuration files each time something changes, which can be a hassle. So I prefer a unified central solution.

3
  • Thanks. "...using the routers as Wifi repeaters if necessary", is a capability of most home wifi routers ? Are we talking of high-end (say small enterprise-grade) wifi routers ? My routers are rather modest, entry-level TP-Link (and similar) devices. At any given time, for WAN redundancy sake (my FTTH and ADSL are both somewhat unreliable, and 4G-LTE is reliable but with there is too much variance in it's throughput), I might be using the "routing" capability of any of the 3 routers. In this situation will the repeater concept work ?
    – bdutta74
    Commented Nov 5, 2017 at 9:54
  • 1
    Basically all home routers allow this. Especially for the TP-Link ones, you can flash them with OpenWRT if the TP-Link firmware doesn't do what you want. As I said, configuring for 3 WAN connections, with failover or otherwise, isn't easy to setup; but it definitely can be done in OpenWRT if you have the expertise. You'll have to install some kind of script on all 3 of them that can toggle the routing between the various possibilities. Possibly also a monitoring script that does that automatically.
    – dirkt
    Commented Nov 5, 2017 at 10:01
  • 1
    The best configuration is to connect all 3 routers via Ethernet, if possible. Having the routers talk to each other via WLAN can also be done, but will slow everything quite a bit.
    – dirkt
    Commented Nov 5, 2017 at 10:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .