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

Your smartphone will only connect if you *let* it connect to his SSID and *give* the correct password/key.

Even if it passes this, *your* phone has to start a FTP server (or have it running) and he has to figure out the IP address which his DHCP server has assigned to your phone. That's of course doable, but not trivial.

If you let all that happen, you'll get what's coming to you! :-)

Reply to
Frank Slootweg
Loading thread data ...

I suppose there are people who set their mobile phones to automatically connect to any unsecured WiFi that comes within range - and use the DNS server supplied by it too. After all, it must be alright to do that or such settings wouldn't be possible ...

Reply to
Whiskers

Not entirely accurate. Generally any device on a network, if it follows the RFCs, will request a renewal of a lease at the 1/2 way point of the lease.

i.e. if the lease is valid for 10 hours, then the device will attempt to renew the lease after 5 hours.

If the renewal is denied, the current lease is still valid for the remaining 5 hours at which point the device will generally request the new address at some point before the current lease has actually expired.

If a device (cable modem included) released an IP address before getting a new one, there would be a break in traffic.

Reply to
Johann Beretta

It doesn't and if you set a static IP on your device, without telling the router, you risk an IP address conflict and can end up with colliding packets, or packets addressed for one device that are sporadically routed to two different devices. IP address conflicts are miserable to work with.

Routers of any sophistication will allow you to set your DHCP range. Using this method you could set, for example, 10.0.0.100 to 10.0.0.200 for the DHCP pool, and have 10.0.0.2 (assuming 10.0.0.1 is for the router itself) through 10.0.0.99 available for static assignments. However, you'll have to remember what addresses you have assigned. If you forget and assign the same address to two different devices, you'll have severe problems.

Another method (and much more "safe") is to simply mark certain IPs in your pool to only be assigned to particular MAC addresses. This is known as address reservation. Your Android device will simply be given the same address, by the router, every single time it connects to the network. For all intents and purposes, you'll have a static address, but you will have no risk of address collisions.

/ip dhcp-server lease add address=10.10.10.237 always-broadcast=yes client-id=1:18:a6:f7:e7:41:ef \ comment=Harper lease-time=1d mac-address=18:A6:F7:E7:41:EF server=\ dhcp-server add address=10.10.10.227 always-broadcast=yes client-id=1:c0:3f:e:c5:27:65 \ comment="Hradecky" lease-time=1d mac-address=C0:3F:0E:C5:27:65 \ server=dhcp-server

That particular block of text is how you'd reserve addresses on a MikroTik router (as an example only) for two separate devices

One of the great joys of RouterOS (Mikrotik's Router Operating System), for me, is the ability to COMMENT everything... In that particular example, Harper is given a "static address" of 10.10.10.237. In reality, it's a dynamic lease, but it is ONLY and ALWAYS assigned to his router. The lease time is set to 1d (day) but can be just about any value you want. I have, however, seen problems with leases that exceed 14 days as some devices simply aren't able to deal with lease times that long.

I'm fairly certain the lease time is sent in some value of seconds and once you get to two weeks you're handing out leases of 1,209,600 seconds and some devices may not be able to work with that large of a number.

Reply to
Johann Beretta

I noticed that on cable they associate IP address with MAC and then if you change MAC you get different address. Return MAC, and you get previous address :P

Reply to
Melzzzzz

That is not a property of cable: it is just an option that management has. The dhcp server daemon can do that.

Reply to
Carlos E.R.

While your post is interesting, why write now, after the thread died two years ago? :-)

Reply to
Carlos E.R.

From dhcpd.conf manpage : ======================================================================== IP ADDRESS CONFLICT PREVENTION The DHCP server checks IP addresses to see if they are in use before allocating them to clients. It does this by sending an ICMP Echo request message to the IP address being allocated. If no ICMP Echo reply is received within a second, the address is assumed to be free. ========================================================================

Of course this works only if the device with the static address is online and replies to ICMP echo (aka ping) requests.

Can you explain the relationship between packet collision (physical layer) and IP address conflict (network layer) ?

Reply to
Pascal Hambourg

it only works if the dhcp server does that. not all do. most do not.

Reply to
nospam

My newsserver had a hiccup and I ended up downloading some ancient articles (back to 2014).. I didn't notice until I had already posted.

Reply to
Johann Beretta

Happens to us all now and then :-)

Reply to
Carlos E.R.

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.