02-02-2013, 02:38 PM | #1 | |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Kindle Networking
This thread is a continuation of the USBnetwork installation thread at:
https://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:
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 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 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 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:
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 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 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 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. |
|
02-03-2013, 05:41 PM | #2 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
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 |
02-03-2013, 05:41 PM | #3 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
|
02-03-2013, 05:43 PM | #4 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
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
|
|
08-08-2013, 07:39 AM | #5 |
Junior Member
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 |
08-08-2013, 07:48 AM | #6 |
(offline)
Posts: 2,907
Karma: 6736092
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.
|
08-08-2013, 08:00 AM | #7 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
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 08:03 AM. |
08-08-2013, 09:29 AM | #8 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
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. |
08-08-2013, 12:28 PM | #9 |
BLAM!
Posts: 13,477
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
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
|
08-08-2013, 12:31 PM | #10 |
Junior Member
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 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kindle Touch USB Networking/SSH | ChrisKaos | Kindle Developer's Corner | 55 | 02-22-2013 09:53 AM |
Kindle PW supports 802.1X corporate networking | lyric | Amazon Kindle | 2 | 12-20-2012 08:08 AM |
Hacks Kindle 3 USB Networking | n10 | Amazon Kindle | 2 | 10-11-2010 09: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 04:23 AM |
Hacks USB networking disabled on Kindle firmware 2.0.3 | hmemcpy | Amazon Kindle | 19 | 05-01-2009 10:51 AM |