How does setting a static IP on a mobile device prevent linux router from assigning that IP address?

How does setting a static IP on a linux Android mobile device prevent the linux router from assigning that IP address to another device?

On any mobile device (iOS, Android, whatever), you can set up an FTP server (eg ES File Explorer on Android) with a static IP address so that Windows "My Network Places" has a permanent "shortcut" to the entire mobile device file system (eg ftp://192.158.1.15:3721).

This is very useful, and I've been using it for a couple of weeks ever since it was discussed here - because it effectively mounts the mobile device as a network drive on Windows without adding any new software on either Android or Windows.

The Android linux mobile device seems to retain the static IP address even after multiple boots of the linux Android phone or of the Linux SOHO router which is set up to serve DHCP addresses.

How does that work? Why doesn't the linux router give another linux device the IP address "192.168.1.15"?

It seems as if it works by "magic" but there must be some logic here.

How does setting the IP address to be static on the Android phone cause the linux router to *accept* that static address permanently?

which can be set up in the mobile device connection settings Android: Settings > WiFi > AP > Modify network config > IP settings > static (IP address = 192.158.1.15)

Reply to
Tomos Davies
Loading thread data ...

It doesn't (permanently); it is still dynamic to the router.

For the same reason that when a cable modem releases its leased IP, waits a short while, and then renews its lease with the DHCP, it gets the exact same dyanmic IP back again. Normally.

However, you should be able to get the router to attach a particular LAN IP to a particular MAC address device on the LAN.

Reply to
Mike Easter

[...]

My guess is that your router's DHCP server originally gave your Android device the dynamic IP number 192.168.1.15 (not 192.158.1.15 - that's a publicly routable IP number) and still has it associated with that device because it hasn't run out of unused IP numbers for allocating to other devices on your LAN. That could happen easily if for example you have six devices that connect to your LAN but the router is set to use a range of 100 dynamic IP numbers. So when your Android device asks the router 'can I be 192.168.1.15' then the router says 'OK'.

Dynamic IPs don't /have/ to change each time you disconnect and reconnect.

You may be able to set the router to use a static IP for the Android device and DHCP for everything else, if you want to be sure.

Reply to
Whiskers

Whiskers wrote in news: snipped-for-privacy@ID-107770.user.individual.net:

Usually, your router is acting as a DHCP host for the rest of the devices on your network. In the setup for DHCP on the router, there is a setting that lets you define the range of available DHCP addresses. Just set that range so that some of the 255 addresses are not within the range of DHCP addresses, then pick one of those outside that range to use as your static IP

Reply to
Tim

If you did it correctly, you assigned a static IP address _outside_ the so-called DHCP range. Any DHCP server, like in your router is set up to hand out addresses in a specific range. Example:

network 192.168.1.0 netmask 255.255.255.0 gateway 192.168.1.1 (the address of the router on the LAN) DHCP range 192.168.1.16 - 192.168.1.63

Now, if you decide to assign static addresses to any device, those addresses have to be outside the DHCP range.

192.168.1.0 invalid, it is the address of the network as a whole 192.168.1.1 invalid, used by the router 192.168.1.2 valid, outside DHCP range 192.168.1.25 invalid, in the DHCP range 192.168.1.102 valid, outside DHCP range 192.168.1.255 invalid, broadcast address for this network

You probably mean 192.168.1.15 .

HTH

Reply to
Kees Nuyt

It doesn't.

There are three possibilities, though.

a) You accidentally assigned your phone an IP outside of the range your router uses for DHCP addresses. Ie, the range dedicated to manually given fixed addresses.

b) You accidentally assigned your phone the same IP as the router had given it by DHCP.

c) You happen to have a router that before assigning an IP, first pings that IP to see if it responds, then automatically removes that IP from the pool of addresses it can give.

You should make sure that 'a' is true.

Reply to
Carlos E.R.

It does not. You have been lucky, unless you go into the router to tell it to reserve that IP address for that Mac address. dhcp will usually reserve an IP for a mac for a little while, but there is no guarentee. If your other machines are permanatly connected, there is no reason for their IP addresses to change.

It does not.

Reply to
William Unruh

Each of the very few routers I've ever used has its 192.168.a.* address range split into two halves: a lower range ( * running roughly 1-100) which are treated as *fixed* addresses, *not* dynamically assignable; and an upper range ( * roughly 101-253), dynamically assignable addresses. Here the value "a" is either 0 or 1, depending on the router model/maker, and is not variable.

It is *I* who can assign static addresses, from among the addresses in the lower range; and it is the router who assigns the dynamic addresses, from among the addresses in the upper range.

Addresses 192.168.a.254 and 192.168.a.255 are *not* assignable, not by me, not by the router, as they play a fixed role already, as does 192.168.a.0 .

HTH, Stijn. Cheers, -- tlvp

Reply to
tlvp
[snip]

Yes, put your static IP outside the DHCP pool.

BTW, that's "254 addresses" since both 0 and 255 (for the low octet) can't be used. Also, the router itself will take one of these (often, but not always, 1).

For my router, it uses 1 for itself, and the DHCP pool is 100-149. I use addresses in the range 2-99.

Reply to
Mark Lloyd
[snip]

'a' can be any number 0-255. The only one >1 I'm sure I've seen is 15.

On my router, 'a' is 1, the router's address is 192.168.1.1 and the DHCP pool is 100-149. Addresses 2-99 and 150-254 are available. This is changeable, although I haven't had a need to.

IIRC, I've used 192.168.a.254 and it worked fine. Maybe your router itself is set to that.

Reply to
Mark Lloyd

Google "address reservation". You don't want a fixed IP address on a phone. You want it in DHCP so it will work anywhere. Tell YOUR router to reserve/assign a FIXED IP address to the MAC address of the phone. Best of both worlds. Fixed at home, DHCP elsewhere.

Reply to
mike

maybe by default it's that way, but you can change the dhcp range to start/stop at whatever you want as well as the ip block.

you can assign static addresses to whatever you want, inside or outside of any range in the router.

254 is.
Reply to
nospam

It is 192.168.a.255 which is not usable, as it is the broadcast address.

Reply to
Carlos E.R.

Not true, he does.

It will work everywhere perfectly as it is.

Please remember that the setup only applies to his home WiFI. Other WiFis get different configs.

Reply to
Carlos E.R.

254 is often the default router IP, they're usually either 192.168.1.1 or (less often) 192.168.1.254 if using the 192.168.1 block.
Reply to
Chris Green

he might think he does, but he doesn't.

Reply to
nospam

Your opinion noted.

Reply to
Carlos E.R.

it's not an opinion. he should *not* have a fixed ip address on his phone. that is only going to cause a world of problems, especially since he doesn't understand what he's doing.

what he wants is a reserved address, which is done at the router.

Reply to
nospam

depends on the router. it's easily changed to anything you want and it doesn't need to be 192.168/16 either.

Reply to
nospam

Setting his phone to use a static IP while connected to his home network, would be a good idea if (when) he sets his router to use a static IP for that device. If he wants to connect to other networks away from home he should set his phone to use DHCP with them if that's what they expect (which it probably is, as a general rule).

Reply to
Whiskers

Cabling-Design.com Forums website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.