Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-02-2013, 03:38 PM   #1
knc1
Helpdesk Junkie
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 6,819
Karma: 6314522
Join Date: Feb 2012
Device: Too many.
Kindle Networking

This thread is a continuation of the USBnetwork installation thread at:
http://www.mobileread.com/forums/sho...d.php?t=204450

Conditions:
You have already installed the USBnetwork, kindle-usbnet-0.7.N.zip package, as described in the prior thread.
The prior thread left you using the telnet to access your Kindle.
You made note of the sequence required to start/stop USBnetwork, which is repeated here:

Quote:
This order should work on all firmware versions.
Early firmwares, v-2 and v-3 may also work with the cable attached.
  • un-plug cable (if still plugged in)
  • toggle USBnetwork ON in launcher
  • plug the cable
  • kill any automation (or configure yours to do: )
  • sudo ip link set up dev usb0 (It may already be up)
  • sudo ip address add 192.168.15.201 peer 192.168.15.244 dev usb0
  • use the networking until your done
  • un-plug cable
  • toggle USBnetwork OFF in launcher
You may or may not have configured your network automation to automatically bring up the link and set the point-to-point address that you are using on your host PC.
There are a number of network automation things used by the various Linux distributions, refer to your distribution information on how to set up yours (not here, your distro's help forum).

We knew from the prior thread that the networking over the USB cable was working.
We knew from the prior thread that telnet over USB was working.

Now telnet into the Kindle (telnet 192.168.15.244).

The prior thread used the ip utility to display network related information from the Linux host (your PC).
The Kindle also has a (limited) version of ip installed as part of the Busybox build.

Examine the routing setup on the Kindle:
Code:
[root@kindle root]# ip route
192.168.15.0/24 dev usb0  src 192.168.15.244
Examine the network addressing setup on the Kindle:
Code:
[root@kindle root]# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
6: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether ee:19:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.15.244/24 brd 192.168.15.255 scope global usb0
Now get a verbose report on the firewall setup:
Code:
[root@kindle root]# iptables -L -v
Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     tcp  --  ppp0   any     anywhere             anywhere            tcp dpt:40317 
    0     0 ACCEPT     tcp  --  ppp0   any     anywhere             anywhere            state RELATED,ESTABLISHED 
    0     0 ACCEPT     tcp  --  wlan0  any     anywhere             anywhere            state RELATED,ESTABLISHED 
    0     0 ACCEPT     udp  --  wlan0  any     anywhere             anywhere            state ESTABLISHED 
    0     0 ACCEPT     udp  --  ppp0   any     anywhere             anywhere            state ESTABLISHED 
    0     0 ACCEPT     udp  --  ppp0   any     anywhere             anywhere            udp spt:40317 
    0     0 ACCEPT     udp  --  ppp0   any     anywhere             anywhere            udp spt:49317 
    0     0 ACCEPT     udp  --  ppp0   any     anywhere             anywhere            udp spt:33434 
 1973 2260K ACCEPT     all  --  lo     any     localhost.localdomain  anywhere            
 5224  303K ACCEPT     all  --  usb0   any     anywhere             anywhere            
    0     0 ACCEPT     icmp --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED 

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 3826 packets, 246K bytes)
 pkts bytes target     prot opt in     out     source               destination         
 1973 2260K ACCEPT     all  --  any    lo      anywhere             localhost.localdomain
Magic decoder notes to that header:
target : what to do with the matching packet
prot : Protocol
opt : Options
{in,out} : Interface
{source, destination} : IP address(es)
dpt : Destination port
spt : Source port

Interfaces shown:
ppp0 : 3G (this device does not have 3G - forget about those for this machine)
wlan0 : WiFi (got that, but at the moment, its down (airplane mode enabled) )
lo : localhost (IP: 127.0.0.0/8 - every networked machine has one)
usb0 : Guess what.

Protocol: icmp - that is, among other things, 'ping packets'

All of the firewall rules shown above are in the kernel's dynamic memory.
You can add/delete/change them (in memory) with the iptables utility.
These rules will be restored from a configuration file in the /etc/sysconfig directory at the next system boot.

For the curious, here is what is in the Kpw-5.3.3 /etc/sysconfig directory:
Spoiler:

Off-topic here, but to be complete:
Code:
[root@kindle root]# ls -l /etc/sysconfig
-rw-r--r--    1 root     root             0 Jan  8  2013 ALLOW_CVM_RESET
-rw-r--r--    1 root     root           546 Jan  8  2013 cpufreq
-rw-r--r--    1 root     root           541 Jan  8  2013 devtypes
-rw-r--r--    1 root     root           140 Jan  8  2013 fs
-rwxr-xr-x    1 root     root           982 Jan  8  2013 iptables
-rw-r--r--    1 root     root           369 Jan  8  2013 mntlog
-rw-r--r--    1 root     root           333 Jan  8  2013 mntus
-rw-r--r--    1 root     root            86 Jan  8  2013 nomkd
-rw-r--r--    1 root     root           112 Jan  8  2013 ntp
-rw-r--r--    1 root     root           772 Jan  8  2013 paths
-rw-r--r--    1 root     root           238 Jan  8  2013 srstlog
NOTE: It is strongly recommended that you do not mess with the system configuration files!
If you screw them up, your on your own, nobody here will fix your mess for you, forget that!


Since you have decided to become your own network admin person by installing this networking package, you need at least a minimum knowledge of the firewalling in Linux.

A quick review of the network interface states at the moment:
Code:
[root@kindle root]# ip -o link | cut -f 2,9 -d ' '
lo: UNKNOWN
usb0: UP
Note: ip with the -o{neline} option is intended for string processing such as shown above.

First, for this purpose, clean up the listing of the three main chains above (there are other tables, google iptables).
Knowing that this machine does not have 3G and that the single output rule is bogus (why? think a bit, lab126 didn't).

Code:
** Hand edited for this post **
Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     tcp  --  wlan0  any     anywhere             anywhere            state RELATED,ESTABLISHED 
    0     0 ACCEPT     udp  --  wlan0  any     anywhere             anywhere            state ESTABLISHED 
 1973 2260K ACCEPT     all  --  lo     any     localhost.localdomain  anywhere            
 5224  303K ACCEPT     all  --  usb0   any     anywhere             anywhere            
    0     0 ACCEPT     icmp --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED 

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 3826 packets, 246K bytes)
 pkts bytes target     prot opt in     out     source               destination
Anything INPUT to the machine is subject to both the default policy and the rules of the INPUT chain.
Anything FORWARD(ed) or OUTPUT is subject to the default policy of those chains.

The states mentioned in the INPUT chain rules:
RELATED - a packet inbound that is related to a packet which was output, this is for protocols that use more than one port (such as ftp).
ESTABLISHED - A packet inbound that is a reply to a packet that originated on this machine.
There is no "RELATED" shown for the udp protocol because such a thing does not exist in the udp protocol.

Now you should be able to read your first rule (NOT THE first rule, A first rule).
INPUT - default policy: "DROP" - so unless allowed by a rule, this packet is going to the bit bucket.

Find the interface usb0
What are the restrictions? (ans: none)
What is the target of the packet? (ans: let it in)

What about packets forwarded or output to usb0?
(ans: only the default policy of the chains apply (no rules) - so let it pass the chain)

Now read your second rule (NOT THE second rule, A second rule).

Find the interface wlan0
What are the restrictions? (ans: INPUT chain only, only in response to something previously sent by the machine)
What is the target of the packet if it meets the restrictions? (ans: let it in)
What is the target of the packet if it fails to meet the restrictions? (ans: drop it on the floor)

What about packets forwarded or output to wlan0?
(ans: only the default policy of the chains apply (no rules) - so let it pass the chain)

Got all of that above? Now you are a junior net-admin! That's all you need to get started.

Now for your first network administration assignment:
What do you need to do to allow ssh over WiFi to your Kindle?
THINK! You can answer that assignment question now.

Ans:
The ssh protocol is identified by the "commonly used port", port number 22.
You have to add a rule to the INPUT chain, for the interface wlan0 and the destination port 22.

This is your lucky day - the USBnetwork package has that placed under the control of a "flag filename" for you. Just read the README_FIRST.txt file in the package for the directions on using that "flag filename".

Question: how to allow some other protocol than ssh over WiFi?
Same answer, different port number.

Question: how to allow some other protocol than those allowed already over 3G?
Same answer, different interface name and port number(s).

To have ssh communications with your Kindle, in addition to the networking, you need something to talk to.
In the USBnetwork package, that is an application called 'dropbear'.
So find out if it is running:
Code:
[root@kindle root]# ps -C dropbear
  PID TTY          TIME CMD
20446 ?        00:00:00 dropbear
Ans: It is up as process ID 20446.

PS: I do not want to ever again read a thread titled: "Connection Refused". Never! Ever!

For our next thread in this series, configuring ssh and some of the neat things you can do with it.
knc1 is offline   Reply With Quote
Old 02-03-2013, 06:41 PM   #2
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,552
Karma: 6021146
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Two buttons...

BLOCK...

UNBLOCK...

Then the world would be golden..

Oh and a "magically configure" button would be nice for the tricky stuff
twobob is offline   Reply With Quote
Old 02-03-2013, 06:41 PM   #3
knc1
Helpdesk Junkie
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 6,819
Karma: 6314522
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by twobob View Post
Two buttons...

BLOCK...

UNBLOCK...

Then the world would be golden
It is in the works.
knc1 is offline   Reply With Quote
Old 02-03-2013, 06:43 PM   #4
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,552
Karma: 6021146
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Quote:
Originally Posted by knc1 View Post
It is in the works.
\o/ Yay.
twobob is offline   Reply With Quote
Old 08-08-2013, 08:39 AM   #5
ekwus
Junior Member
ekwus began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Aug 2013
Location: Edinburgh
Device: Kindle DXG
Boot to USB Networking

Hi

Has anyone worked out how to get a Kindle to boot with USB Networking enabled?

I.e. I want to skip the ;debugon and `usbnetwork being required via the keyboard.

Is it possible to add a script to the boot sequence like this?

Cheers

Dave
ekwus is offline   Reply With Quote
Old 08-08-2013, 08:48 AM   #6
ixtab
(offline)
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,903
Karma: 6677557
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Newer versions of NiLuJe's usbnetwork packages have an option to automatically enable it on boot. I'm not 100% sure about the DXG, but I think it's available for that model too.
ixtab is offline   Reply With Quote
Old 08-08-2013, 09:00 AM   #7
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,552
Karma: 6021146
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
yup. sure is. tested it last night. (on a DXG)

Thinking about shoving out a V 2.1 of the KUAL to let the world see the swanky new options.

Just "abuse" testing it.


Also: I think it is an option in the config file. Kindle/usbnet/config (I may be wrong about that but seem to recall it being in there)

Also: You can do the modifications as outlined at http://kual.knetconnect.com/kindles-...g-custom-apps/ and then shove it in a startup script.

Lots of options.

Last edited by twobob; 08-08-2013 at 09:03 AM.
twobob is offline   Reply With Quote
Old 08-08-2013, 10:29 AM   #8
knc1
Helpdesk Junkie
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 6,819
Karma: 6314522
Join Date: Feb 2012
Device: Too many.
It has been an option in NiLuJe's USBnetworking for a long time.

User should read the WARNING about using it though, you can lock yourself out of the Kindle.
knc1 is offline   Reply With Quote
Old 08-08-2013, 01:28 PM   #9
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 5,102
Karma: 4987077
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW & PW2
Late to the party, but, yup, has been there since the beginning. Just drop an 'auto' file in the usbnet folder (or use the KUAL extension). Please heed knc1's warning, and read the doc before, though
NiLuJe is offline   Reply With Quote
Old 08-08-2013, 01:31 PM   #10
ekwus
Junior Member
ekwus began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Aug 2013
Location: Edinburgh
Device: Kindle DXG
Hey All

Thanks for all the help here. Got it working using the "auto" method.

Cheers

Dave
ekwus is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kindle Touch USB Networking/SSH ChrisKaos Kindle Developer's Corner 55 02-22-2013 10:53 AM
Kindle PW supports 802.1X corporate networking lyric Amazon Kindle 2 12-20-2012 09:08 AM
Hacks Kindle 3 USB Networking n10 Amazon Kindle 2 10-11-2010 10:29 PM
K4 Mac or PC How can I browse the internet in Kindle DX through my PC networking ? meem Amazon Kindle 0 08-04-2010 05:23 AM
Hacks USB networking disabled on Kindle firmware 2.0.3 hmemcpy Amazon Kindle 19 05-01-2009 11:51 AM


All times are GMT -4. The time now is 12:36 AM.


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