View previous topic :: View next topic |
Author |
Message |
sickboy2583 Tux's lil' helper
Joined: 30 Jan 2004 Posts: 83 Location: UK
|
Posted: Sat May 08, 2004 12:52 pm Post subject: help IPAQ -> Gentoo -> internet |
|
|
Been trying to connect my IPAQ 3970 running Gpe Familiar to the internet by sharing my Gentoo box internet connection.
Tried a few how to's on handhelds.org and searched Gentoo forums but no luck so far. I have also tried firestarter to share the connection but no luck there either. Can some please help
Here is my setup :
Gentoo box :
eth0
192.168.1.101 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 DNS 194.168.4.100 194.168.8.100
usb0
192.168.0.101 netmask 255.255.255.0 broadcast 192.168.0.255
IPAQ :
usbf 192.168.0.100 netmask 255.255.255.0 broadcast 192.168.0.255 gateway 192.168.100 (not sure what his should be set to)
DNS 194.168.4.100
As you can see the IPAQ is connected to the Gentoo box via a usb cable.
The Gentoo box is connected to the internet via eth0 through a router, hence gateway 192,168.1.1.
I can ssh into the IPAQ from my Gentoo box ok.
So how can I get my IPAQ connected to the internet ? |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54801 Location: 56N 3W
|
Posted: Sat May 08, 2004 1:22 pm Post subject: |
|
|
ickboy2583,
You need this script. Code: | #
# ipaqnet Control script for iPAQ USBNet connection
#
# Author: Michel Stempin
# Creation: 11/08/2002
# additional comments and minor tweaks
# Roy Bamford 6 Dec 2003
PC_ADDR=192.168.100.201
IPAQ_ADDR=192.168.100.202
IPAQ_NET=192.168.100.0/24
# WARNING:usb0 is hard coded in some places
UPLINK_IF=usb0
start() {
# load the usb networking module
/sbin/modprobe usbnet
# bring up the PC end of the link with IP addr PC_ADDR
# exit if it fails for some reason
/sbin/ifconfig usb0 inet $PC_ADDR up
if [ $? -ne 0 ]; then
echo "Could not set up usb0"
echo "Is the iPaq connected and switched on?"
exit 1
fi
# set up proxy_arp for our usb interface
echo "1" >/proc/sys/net/ipv4/conf/usb0/proxy_arp
UPLINK=`/sbin/ifconfig $UPLINK_IF >/dev/null 2>&1`
# exit if it fails for some reason
if [ $? -ne 0 ]; then
echo "Could not set up proxy_arp for usb0"
exit 1
fi
# set up proxy_arp for eth0, so this better be our
# internet connection
echo "1" >/proc/sys/net/ipv4/conf/eth0/proxy_arp
# turn on IP forwarding
echo "1" >/proc/sys/net/ipv4/ip_forward
# delete the unwanted route via usb0
# its wrong anyway
/sbin/route del -net $IPAQ_NET dev usb0
# add the route we really want
/sbin/route add $IPAQ_ADDR dev usb0
}
stop() {
/sbin/ifconfig usb0 down
# rmmod -r usbnet
}
case "$1" in
start|add)
start
;;
stop|remove)
stop
;;
*)
echo $"Usage: $0 {start|stop|add|remove}"
exit 1
esac
| Fiddle with the IP addresses at the top to suit yourself.
The iPaq is on the same subnet as the PC. The original is on the handhelds.org wiki somewhere _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
sickboy2583 Tux's lil' helper
Joined: 30 Jan 2004 Posts: 83 Location: UK
|
Posted: Sat May 08, 2004 3:41 pm Post subject: |
|
|
NeddySeagoon
Thanks this worked a treat |
|
Back to top |
|
|
electroarts Tux's lil' helper
Joined: 03 Jan 2004 Posts: 86
|
Posted: Mon Jun 28, 2004 5:27 pm Post subject: |
|
|
I'm using this script on my laptop to set up USB networking, and some very weird stuff is happening. First of all, I get "unable to reach network" from my IPAQ when trying to ping the laptop if I use a subnet number anything other than 0 [i.e. 192.168.0.201 works, but 192.168.100.201 doesn't]. All changes were made in both network configuration in GPE and in the script running on the laptop.
When I put them both on the 0 subnet, I can ping the laptop from the IPAQ, ping the IPAQ from the laptop, and even ssh to the IPAQ, but cannot reach the internet.
What am I doing wrong here?
Laptop ifconfig:
Code: | root 19:17:37> ifconfig usb0
usb0 Link encap:Ethernet HWaddr 7A:22:16:3D:1D:AF
inet addr:192.168.0.201 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:338 errors:0 dropped:0 overruns:0 frame:0
TX packets:448 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:37089 (36.2 Kb) TX bytes:39496 (38.5 Kb) |
IPAQ ifconfig:
Code: | ~ # ifconfig usbf
usbf Link encap:Ethernet HWaddr 26:0F:99:59:36:38
inet addr:192.168.0.202 Mask:255.255.255.0
inet6 addr: fe80::240f:99ff:fe59:3638/10 Scope:Link
UP RUNNING MTU:1500 Metric:1
RX packets:429 errors:0 dropped:0 overruns:0 frame:0
TX packets:322 errors:0 dropped:18 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:32236 (31.4 KiB) TX bytes:38793 (37.8 KiB) |
Specs: Familiar 0.7.2 GPE, IPAQ 5550
TIA,
d. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54801 Location: 56N 3W
|
Posted: Mon Jun 28, 2004 7:22 pm Post subject: |
|
|
electroarts,
The script I posted uses forwarding through the PC to the iPaq.
The PCs eth0 (port to the internet) and usb0 are all on the same subnet. In my case 192.168.100.0/24
If your eth0 has a public IP this will not work for you unless you have some spare IP addresses in the same subnet as eth0. In that case, your PC needs to support NAT. Look into building iptables and finding a firewall script.
Are you sure you are changing what you think you are in GPE.
Here is my /etc/network/interfaces (frm my iPaq). The USB stuff is commented out because I have wireless now.
Code: | /etc/network # more interfaces
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
# automatically added when upgrading
auto lo
iface lo inet loopback
iface bnep0 inet dhcp
# usb network
# (192.168.100.202 is the iPAQ's IP, 192.168.100.201 is the host's IP)
iface usbf inet static
# address 192.168.100.202
# netmask 255.255.255.255
# network 192.168.100.0
# gateway 192.168.100.1
# wireless networking
iface wlan0 inet static
address 192.168.100.244
netmask 255.255.255.0
network 192.168.100.0
gateway 192.168.100.1
broadcast 192.168.100.255 |
Is that any help? _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
electroarts Tux's lil' helper
Joined: 03 Jan 2004 Posts: 86
|
Posted: Tue Jul 06, 2004 2:30 pm Post subject: |
|
|
Hi again,
I cooked up a fairly simple set of commands to get a PPP connection going via the Gentoo laptop serial port connected to the IPAQ charging cradle. Here it is, for future forum-searchers. I saved it to my home directory as "ipaqppp", and it should be run as root. See comments for full usage:
Code: | #/bin/bash
# For creating PPP connection between [lap/desk]top and IPAQ.
# See also:
# http://www.handhelds.org:8080/wiki/PPPHowto
# http://www.handhelds.org:8080/wiki/IPMasqHowto
# First start PPP:
# /usr/sbin/pppd /dev/ttyS0 115200 192.168.0.1:192.168.0.2 nodetach local noauth nocrtscts lock user ppp connect "/usr/sbin/chat -v -t3 ogin--ogin: ppp"
# Then run this script:
# sh ipaqppp
iptables -F
iptables -t nat -F
iptables -t nat -A POSTROUTING -s 192.168.0.2 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -s 192.168.0.2 -j ACCEPT
iptables -A FORWARD -d 192.168.0.2 -j ACCEPT
# Remember to copy the resolv.conf:
# scp /etc/resolv.conf root@192.168.0.2:/etc/resolv.conf
# After that, login via ssh:
# ssh root@192.168.0.2
# Once logged in on the IPAQ, set the [lap/desk]top as the IPAQ's gateway:
# route add default gw 192.168.0.1
# You might need to bring down the USB networking on the IPAQ if there are any troubles with reaching the network:
# ifconfig usbf down
# That's it! |
cheers!
d. |
|
Back to top |
|
|
|