Installing debian - kernel - internet access on phone

shamsul hassan shamsulbuddy at gmail.com
Wed May 25 01:17:30 CEST 2011


Hi Eric,

Use the below method and script to ssh into the Neo and share the internet
connection with your laptop.I always use it from any Linux machine and it
works like charm --

On your Laptop --

1) Type "ifconfig -a"  before connecting the Neo through usb
2) Now connect Neo through usb and again type "ifconfig -a" , whichever the
new interface visible which was not there is Step 1 is the interface for Neo
, usually it is either "usb0" or "eth0".
3) save the below script as "startmyneo" :) -- Any name u want .. ..chmod
755 that script and then run the below script just passing the interface
name found above in step 2 as the parameter 1 and the internet interface on
your laptop as parameter 1 ) mine is wlan0 on my laptop--

root at bt# ./startmyneo usb0 wlan0

Please note -- while running this script might ask for the root password on
Neo as we are ssh ing into it.
Here is the "startmyneo" script , which you can save on your deskop and has
to be run from your desktop --

#!/bin/bash
interface=$1
desktop_inet_interface=$2
ip address add 192.168.0.200/24 dev $interface
ifconfig $interface 192.168.0.200 netmask 255.255.255.0 up
route add -host 192.168.0.202 dev $interface
ssh root at 192.168.0.202
#this section is for the internet on NEO from ur Desktop in between net n
Neo
echo "nameserver 192.168.0.1" >> /etc/resolv.conf
echo 1 >> /proc/sys/net/ipv4/ip_forward
echo 1 >> /proc/sys/net/ipv4/ip_dynaddr
modprobe ip_tables
modprobe iptable_nat
modprobe ipt_MASQUERADE
iptables -t filter -F
iptables -t nat    -F
iptables -t filter -P INPUT       ACCEPT
iptables -t filter -P FORWARD     ACCEPT
iptables -t filter -P OUTPUT      ACCEPT
iptables -t nat    -P PREROUTING  ACCEPT
iptables -t nat    -P POSTROUTING ACCEPT
iptables -t nat -A POSTROUTING -o $desktop_inet_interface -s
192.168.0.0/24-j MASQUERADE


Thanks
Shamsul

"Courage is contagious"

On Tue, May 24, 2011 at 9:03 PM, Eric Smith <es at fruitcom.com> wrote:

> Thanks Timo
>
> eric at htpc7:~$ sudo iptables -A POSTROUTING -o net -t nat -j MASQUERADE
> -s 192.168.4.0/24
> eric at htpc7:~$ sudo -i
> htpc7:~# echo 1 > /proc/sys/net/ipv4/ip_forward
> htpc7:~#
> htpc7:~#  sudo iptables -nvL -t nat
> Chain PREROUTING (policy ACCEPT 3 packets, 748 bytes)
>  pkts bytes target     prot opt in     out     source
> destination
>
> Chain POSTROUTING (policy ACCEPT 3 packets, 176 bytes)
>  pkts bytes target     prot opt in     out     source
> destination
>     0     0 MASQUERADE  all  --  *      net     192.168.4.0/24
> 0.0.0.0/0
>
> Chain OUTPUT (policy ACCEPT 3 packets, 176 bytes)
>  pkts bytes target     prot opt in     out     source
> destination
>
> htpc7:~# ping 192.168.4.202
> PING 192.168.4.202 (192.168.4.202) 56(84) bytes of data.
> ^C
> --- 192.168.4.202 ping statistics ---
> 5 packets transmitted, 0 received, 100% packet loss, time 4015ms
>
>
> --
> - Eric Smith
> Timo Juhani Lindfors said:
> > Eric Smith <es at fruitcom.com> writes:
> > > eric at debian:~$ sudo iptables -nvL -t nat
> > > Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
> > >  pkts bytes target     prot opt in     out     source
> destination
> > >
> > > Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
> > >  pkts bytes target     prot opt in     out     source
> destination
> > >
> > > Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
> > >  pkts bytes target     prot opt in     out     source
> > >  destination
> >
> > This shows that there is no NAT. Your phone can't talk to the outside
> > world using its private 192.168.4.202 address. You need to setup NAT
> > that translates packets between public and private address. Something
> > like
> >
> > iptables -A POSTROUTING -o net -t nat -j MASQUERADE -s 192.168.4.0/24
> > echo 1 > /proc/sys/net/ipv4/ip_forward
> >
> > should work assuming that your upstream interface is called "net" like
> > here. Yours might be eth0?
> >
> > _______________________________________________
> > Openmoko community mailing list
> > community at lists.openmoko.org
> > http://lists.openmoko.org/mailman/listinfo/community
>
> _______________________________________________
> Openmoko community mailing list
> community at lists.openmoko.org
> http://lists.openmoko.org/mailman/listinfo/community
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmoko.org/pipermail/community/attachments/20110525/2e3b0b32/attachment.htm>


More information about the community mailing list