Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 07-18-2025, 06:03 PM   #1
killerbug
Junior Member
killerbug began at the beginning.
 
killerbug's Avatar
 
Posts: 8
Karma: 10
Join Date: Apr 2022
Device: PW6
Question How do I assign a static LAN IP address to my kindle

To transfer files to my kindle when I'm not at home, what I do is first start a WiFi hotspot on my Android phone. Then connect the Kindle to the corresponding WiFi. This way the Kindle and the Android are on the same local network. I can now ssh into the kindle.

The problem is assigned network changes every time. And now I can't have a convenient stfp bookmark in my file manager app to transfer files. I have to look up the IP address in the kindle and then change the bookmark accordingly.
Example of assigned IP: 10.171.131.210 or 10.69.217.210

How would I go about assigning static LAN IP address to my kindle when connecting?
killerbug is offline   Reply With Quote
Old 07-18-2025, 06:14 PM   #2
killerbug
Junior Member
killerbug began at the beginning.
 
killerbug's Avatar
 
Posts: 8
Karma: 10
Join Date: Apr 2022
Device: PW6
Welp, found the solution: https://www.mobileread.com/forums/sh...05&postcount=4

Click on the "Other..." in the wifi connection list. It has the option of static IP. It was drowned in the list of wifi connections.
killerbug is offline   Reply With Quote
Advert
Old 07-18-2025, 07:18 PM   #3
killerbug
Junior Member
killerbug began at the beginning.
 
killerbug's Avatar
 
Posts: 8
Karma: 10
Join Date: Apr 2022
Device: PW6
Welp again, seems like it was NOT the solution.

(I don't know much about networking.)
The problem is the router/gateway of the android hotspot is not fixed. It randomly chooses a /24 subnet from the 10.x.x.x private range. So you can't fill the IP address, router box. (they will change). It at least changes after restarting the phone.

for example this:
39: wlan2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 3000
link/ether 9a:6e:91:dd:3d:40 brd ff:ff:ff:ff:ff:ff
inet 10.69.217.162/24 brd 10.69.217.255 scope global wlan2

changes to this after a restart:
29: wlan2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 3000
link/ether b2:09:7f:bb:64:ce brd ff:ff:ff:ff:ff:ff
inet 10.136.103.178/24 brd 10.136.103.255 scope global wlan2
valid_lft forever preferred_lft forever

Last edited by killerbug; 07-18-2025 at 07:22 PM.
killerbug is offline   Reply With Quote
Old 07-18-2025, 07:58 PM   #4
jackm8
Evangelist
jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.
 
jackm8's Avatar
 
Posts: 421
Karma: 4500000
Join Date: Nov 2015
Device: none
Quote:
Originally Posted by killerbug View Post
To transfer files to my kindle when I'm not at home, what I do is first start a WiFi hotspot on my Android phone. Then connect the Kindle to the corresponding WiFi. This way the Kindle and the Android are on the same local network. I can now ssh into the kindle.

The problem is assigned network changes every time. And now I can't have a convenient stfp bookmark in my file manager app to transfer files. I have to look up the IP address in the kindle and then change the bookmark accordingly.
Example of assigned IP: 10.171.131.210 or 10.69.217.210

How would I go about assigning static LAN IP address to my kindle when connecting?
You would need to set up things on your Android. Android acts as a router for your Kindle, so it's Android that determines ip adresses of devices connected to its hotspot. It's not something that I've looked into, so it's possible that there's no way to set up static IP.
jackm8 is offline   Reply With Quote
Old 07-19-2025, 05:37 AM   #5
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 53,464
Karma: 181843001
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
One friend of mine once spent way too many hours trying to figure out how to have an Android phone do address reservations. Basically, what they came up with is that is not a supported function.
DNSB is offline   Reply With Quote
Advert
Old 07-19-2025, 10:44 AM   #6
dhdurgee
Guru
dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.
 
Posts: 938
Karma: 3000002
Join Date: Jun 2010
Device: K3W, PW4
Quote:
Originally Posted by DNSB View Post
One friend of mine once spent way too many hours trying to figure out how to have an Android phone do address reservations. Basically, what they came up with is that is not a supported function.
Is there any DNS capability available with the Android phone? Assuming an entry could be made by MAC address to a name he could then refer to his Kindle by DNS name instead.

Dave
dhdurgee is online now   Reply With Quote
Old Yesterday, 01:37 PM   #7
killerbug
Junior Member
killerbug began at the beginning.
 
killerbug's Avatar
 
Posts: 8
Karma: 10
Join Date: Apr 2022
Device: PW6
Last year I spent some time looking into assigning static IP for my kindle on android's hotspot. I couldn't get it to work properly, short of building my own android. I am not familiar with patching stuff on android.

I was met with some success using https://github.com/Mygod/VPNHotspot (root required), but it was quite a flaky solution. I don't remember exactly what went wrong but I uninstalled it.

I've found a solution now, so I'm leaving it here for posterity.

The problem was that I had to manually update Kindle's IP bookmark in my preferred file manager on android (FX) after every android reboot.

Previously I thought of having the Android assign a static IP, which didn't work out.

Now the solution I've settled on is in the other direction: update the file manager's bookmark automatically when the IP has changed (only needed to be done once after reboot). It will require root access.

Here's the script I'm using:

Code:
#!/system/bin/sh

###############################################################################
# Configuration
###############################################################################

# FX database
DB="/data/user/0/nextapp.fx/databases/Net.db"

# Bookmark ↔ Wi-Fi MAC mappings
# Format:
#   update_bookmark "<bookmark name>" "<wifi mac>"
#
# Add more lines here if needed.

BOOKMARKS="
pw6 <YOUR KINDLE'S MAC ADDRESS>
pw6-sub <REDACTED>
"

###############################################################################
# Logging
###############################################################################

LOGFILE=/data/local/tmp/fx-kindle.log

# Clear log every boot
: > "$LOGFILE"

exec >>"$LOGFILE" 2>&1

echo "================================================"
echo "Started: $(date)"
echo "PID=$$"
echo "UID=$(id)"
echo

###############################################################################
# Tools
###############################################################################

IP=/system/bin/ip
AWK=/system/bin/awk
SQLITE=/system/bin/sqlite3
LOGGER=/system/bin/log

###############################################################################
# Update one bookmark
###############################################################################

update_bookmark() {
    NAME="$1"
    MAC="$2"

    echo "--- $NAME ($MAC) ---"

    if [ ! -f "$DB" ]; then
        echo "Net.db not found"
        return 1
    fi

    NEWIP=$($AWK -v mac="$MAC" '
        BEGIN { IGNORECASE=1 }
        $4 == mac { print $1; exit }
    ' /proc/net/arp)

    if [ -z "$NEWIP" ]; then
        echo "Device not present"
        return 1
    fi

    CURIP=$($SQLITE "$DB" \
        "SELECT host FROM host WHERE display_name='$NAME';")

    echo "Current=$CURIP New=$NEWIP"

    if [ "$CURIP" = "$NEWIP" ]; then
        echo "Already correct"
        return 0
    fi

    $SQLITE "$DB" \
        "UPDATE host SET host='$NEWIP' WHERE display_name='$NAME';"

    VERIFY=$($SQLITE "$DB" \
        "SELECT host FROM host WHERE display_name='$NAME';")

    if [ "$VERIFY" != "$NEWIP" ]; then
        echo "Verification failed"
        return 1
    fi

    echo "Updated successfully"

    $LOGGER -t fx-kindle "Updated $NAME -> $NEWIP"

    return 0
}

###############################################################################
# Update all bookmarks
###############################################################################

update_all() {
    ALL_DONE=1

    echo
    echo "Checking bookmarks..."

    echo "$BOOKMARKS" | while read NAME MAC
    do
        [ -z "$NAME" ] && continue

        if ! update_bookmark "$NAME" "$MAC"; then
            ALL_DONE=0
        fi
    done

    # while runs in a subshell, so recompute outside
    for ENTRY in $BOOKMARKS
    do
        :
    done

    # Return success only if every configured MAC currently exists
    while read NAME MAC
    do
        [ -z "$NAME" ] && continue

        NEWIP=$($AWK -v mac="$MAC" '
            BEGIN { IGNORECASE=1 }
            $4 == mac { found=1 }
            END { exit !found }
        ' /proc/net/arp)

        [ $? -ne 0 ] && return 1
    done <<EOF
$BOOKMARKS
EOF

    return 0
}

###############################################################################
# Main
###############################################################################

echo "Initial attempt..."

if update_all; then
    echo
    echo "All bookmarks updated."
    exit 0
fi

echo
echo "Waiting for neighbour events..."

$IP monitor neigh | while IFS= read -r EVENT
do
    echo
    echo "EVENT: $EVENT"

    if update_all; then
        echo
        echo "All bookmarks updated."
        exit 0
    fi
done
For magisk, put this script in /data/adb/service.d, it will run on late boot.

This script uses ip monitor neigh to wait for network changes and when network changes occurs compares the device MAC to our Kindle's MAC. If it matches, then update the file manager's bookmark with the device IP and exits.

This is not polling based but event based, and stops after updating bookmark. So it has negligible cpu/memory usage.

Not as universal as static IP for a solution but solves the problem.
killerbug is offline   Reply With Quote
Old Yesterday, 02:04 PM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 84,353
Karma: 153744555
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
There is a solution that's so very simple. You're running around in circles trying to do what's so very very simple.

In my router under Advanced is Lan Setup. Under that is Device Setup. You put in the MAC address and the address you want it to be and that's it done. It's that easy. You're router may be different, but you should have the same function to assign an internal IP to a given MAC address,
JSWolf is online now   Reply With Quote
Old Yesterday, 02:37 PM   #9
killerbug
Junior Member
killerbug began at the beginning.
 
killerbug's Avatar
 
Posts: 8
Karma: 10
Join Date: Apr 2022
Device: PW6
Read the first post again.

There's no router. Only two devices: Android and Kindle.

We connect our Kindle to Android's hotspot. So Android acts as a router and assigns IP address to devices connected to it's wifi hotspot. On Android things aren't that easy to set up as you have described for a real router, even with root access.

My previous post already outlines a solution.
killerbug is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Troubleshooting Kindle not connecting to new LAN n0toriety Amazon Kindle 3 01-07-2025 04:26 AM
Is there anyway to set a static IP address on the Kobo Wifi? saladasalad Kobo Reader 3 07-11-2012 07:22 AM
Content Download a static website to the kindle? scotter Amazon Kindle 1 03-07-2011 06:52 PM
Free Book (Kindle) - The Static of the Spheres koland Deals and Resources (No Self-Promotion or Affiliate Links) 3 06-21-2010 06:24 AM
How does Calibre assign 'Book' vs. 'Personal Doc' for Kindle? thorn Calibre 1 02-04-2010 07:09 AM


All times are GMT -4. The time now is 06:45 PM.


MobileRead.com is a privately owned, operated and funded community.