LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-11-2005, 11:58 AM   #1
Navyblue
Member
 
Registered: Jul 2005
Posts: 161

Rep: Reputation: 30
Sharing Internet through USB networking


Hi guys,

I am trying to set up a USB network between my iPaq 3870 (running Familiar Linux 0.82) and my PC (running Ubuntu Hoary). And I want the iPaq 3870 to be able to connect to internet through the PC. Btw the PC connects to internet through LAN connection.

I have followed the instruction below (the Debian part) but no luck.

http://www.handhelds.org/moin/moin.cgi/UsbNet

http://mia.ece.uic.edu/~papers/WWW/L...ml#USB-NETWORK

Here is my IPs set on my PC for usb0.

address 192.168.1.200
netmask 255.255.255.0
broadcast 192.168.1.255

IPs on my iPaq side
IP Address 192.168.1.202
Subnet Mask 255.255.255.0
Gateway 192.168.1.200

On Firestarter, I can see a usb0 appearing as a connection.

The result of ping 192.168.1.202 (I am not even sure if it is the right IP to ping)

Code:
PING 192.168.1.202 (192.168.1.202) 56(84) bytes of data.
From 192.168.1.2 icmp_seq=2 Destination Host Unreachable
From 192.168.1.2 icmp_seq=3 Destination Host Unreachable
From 192.168.1.2 icmp_seq=4 Destination Host Unreachable
From 192.168.1.2 icmp_seq=6 Destination Host Unreachable
From 192.168.1.2 icmp_seq=7 Destination Host Unreachable
From 192.168.1.2 icmp_seq=8 Destination Host Unreachable
From 192.168.1.2 icmp_seq=10 Destination Host Unreachable
From 192.168.1.2 icmp_seq=11 Destination Host Unreachable
From 192.168.1.2 icmp_seq=12 Destination Host Unreachable

--- 192.168.1.202 ping statistics ---
12 packets transmitted, 0 received, +9 errors, 100% packet loss, time 11000ms, pipe 3
The result of ping 192.168.1.200

Code:
PING 192.168.1.200 (192.168.1.200) 56(84) bytes of data.
64 bytes from 192.168.1.200: icmp_seq=1 ttl=64 time=0.078 ms
64 bytes from 192.168.1.200: icmp_seq=2 ttl=64 time=0.069 ms
64 bytes from 192.168.1.200: icmp_seq=3 ttl=64 time=0.070 ms
64 bytes from 192.168.1.200: icmp_seq=4 ttl=64 time=0.069 ms
64 bytes from 192.168.1.200: icmp_seq=5 ttl=64 time=0.071 ms
64 bytes from 192.168.1.200: icmp_seq=6 ttl=64 time=0.070 ms

--- 192.168.1.200 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 4998ms
rtt min/avg/max/mdev = 0.069/0.071/0.078/0.005 ms

I am very new to networking so I don't know what other info to supply, may be you guys can enlighten me.

Thanks.
 
Old 09-11-2005, 02:30 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You might want to look at the output of the "route" command.

Make sure that a ping to 192.168.1.202 goes to the proper interface. You may also decide to setup the two interfaces on different subnets. This would allow you to, for example, have a second iPaq that you could plug in, in the first one's place.

Finally, you will neet to set up NAT, so that your iPaq can share the Internet IP address (I'm assuming you don't have two addresses here assigned by your ISP). Someone who uses Ubuntu will probably be able to point you to a tool to set this up. Given that the USB device is showing up in ifconfig is a good sign that your devices are working.
 
Old 09-11-2005, 02:33 PM   #3
Snowbat
Member
 
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338

Rep: Reputation: 31
PING 192.168.1.202 (192.168.1.202) 56(84) bytes of data.
From 192.168.1.2 icmp_seq=2 Destination Host Unreachable

For whatever reason, your PC is sending traffic for 192.168.1.202 through 192.168.1.2. Can you show us the output of the following commands on your PC?

/sbin/route

/sbin/ifconfig
 
Old 09-11-2005, 11:53 PM   #4
Navyblue
Member
 
Registered: Jul 2005
Posts: 161

Original Poster
Rep: Reputation: 30
Snowbat,

Thanks a lot for your response. After posting this same question in the PDA forum and no luck getting any help. I was about to give up. Now you guys have given me some hope.

/sbin/route

Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 usb0
default         mygateway       0.0.0.0         UG    0      0        0 eth0
/sbin/ifconfig

Code:
eth0      Link encap:Ethernet  HWaddr 00:0F:EA:79:8E:7F
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20f:eaff:fe79:8e7f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:217 errors:0 dropped:0 overruns:0 frame:0
          TX packets:242 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:166369 (162.4 KiB)  TX bytes:34584 (33.7 KiB)
          Interrupt:22 Base address:0x6000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:84 (84.0 b)  TX bytes:84 (84.0 b)

usb0      Link encap:Ethernet  HWaddr C2:68:70:47:D8:BB
          inet addr:192.168.1.200  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::c068:70ff:fe47:d8bb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:5 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Last edited by Navyblue; 09-12-2005 at 12:03 AM.
 
Old 09-12-2005, 12:00 AM   #5
Navyblue
Member
 
Registered: Jul 2005
Posts: 161

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by jschiwal
You might want to look at the output of the "route" command.

Make sure that a ping to 192.168.1.202 goes to the proper interface. You may also decide to setup the two interfaces on different subnets. This would allow you to, for example, have a second iPaq that you could plug in, in the first one's place.

Finally, you will neet to set up NAT, so that your iPaq can share the Internet IP address (I'm assuming you don't have two addresses here assigned by your ISP). Someone who uses Ubuntu will probably be able to point you to a tool to set this up. Given that the USB device is showing up in ifconfig is a good sign that your devices are working.
Thanks a lot for your response.

As a newbie, I know nothing about what IP to assign. May be you could give me specific suggestion.

I'm not sure if I am right, it seems that Ubuntu/Debian uses ipmasq to achieve this. or may be dnsmasq too. But anyway I have installed these two packages. But I don't kow how to use them, I am merely following the instruction in the link above.

Last edited by Navyblue; 09-12-2005 at 12:06 AM.
 
Old 09-12-2005, 02:59 PM   #6
Navyblue
Member
 
Registered: Jul 2005
Posts: 161

Original Poster
Rep: Reputation: 30
I have changed my IPs

usb0 on my PC:

address 192.168.2.200
netmask 255.255.255.0
broadcast 192.168.2.255

iPaq
addressess 192.168.2.202
Subnet Mask 255.255.255.0
Gateway 192.168.2.200

Now, from my PC I can ping 192.168.2.202. and from the iPaq I can ping 192.168.2.200. Does that mean that the USB network is working alright now? The internet on iPaq still doesn't work though.

What should I do next?
 
Old 09-12-2005, 08:10 PM   #7
Snowbat
Member
 
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338

Rep: Reputation: 31
The problem here was that your PC has two routes defined to the same /24 network, one through eth0 and one through usb0. The solution, as you've found, is to move one of the interfaces to a different /24 network.

For internet access, it looks like your internet connection is via a NAT router called mygateway, possibly at 192.168.1.1. There are two ways you can do this. I prefer the first as the right technical solution but the second is probably faster for you to set up:

Option 1) On 'mygateway', add a route to 192.168.2.0/24 via 192.168.1.2. On your PC, enable packet forwarding. On the iPaq set the default route via gateway 192.168.2.200 and add your ISP nameservers (or 192.168.1.1 if your router has a caching nameserver) in the appropriate place. The following command enables packet forwarding in Mandrake - not sure if Ubuntu differs:
echo 1 > /proc/sys/net/ipv4/ip_forward

Option 2) Run a NAT router on your PC. On the iPaq set the default route via gateway 192.168.2.200 and add your ISP nameservers (or 192.168.1.1 if your router has a caching nameserver) in the appropriate place. The following commands enable a NAT router for eth0 in Mandrake - not sure if Ubuntu differs:
/sbin/modprobe iptable_nat
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
 
Old 09-13-2005, 02:15 AM   #8
Navyblue
Member
 
Registered: Jul 2005
Posts: 161

Original Poster
Rep: Reputation: 30
Assuming I am going option 1. I know very little about networking so please bear with my very basic questions.

Btw, My PC is connected to a D-Link DSL-G604T wireless router through LAN cable. It has a built in ADSL modem. It saves the dialup information in it and all the PC would just need to connect to it by wired or wireless LAN to get to the internet. So I assume this is a caching nameserver?

Quote:
Originally posted by Snowbat
Option 1) On 'mygateway', add a route to 192.168.2.0/24 via 192.168.1.2.
How do I do this? How do I go to "mygateway"?

Quote:
Originally posted by Snowbat
On your PC, enable packet forwarding.
Again how do I do this? I see "ipmasq" was initialised during PC startup. Is it this one?

Quote:
Originally posted by Snowbat
On the iPaq set the default route via gateway 192.168.2.200 and add your ISP nameservers (or 192.168.1.1 if your router has a caching nameserver) in the appropriate place.
On my iPaq, there is a file /etc/network/interfaces. Is it this file to edit?

There is a part in there that says:

iface usbf static
address 192.168.2.202
netmask 255.255.255.0
network 192.168.1.1
gateway 192.168.2.200

I guess all the IPs are correct? Is the "network" above hte caching nameserver that you mentioned? It was originally 192.168.0.0 or 192.168.0.1 I can't remember.

Quote:
Originally posted by Snowbat
The following command enables packet forwarding in Mandrake - not sure if Ubuntu differs:
echo 1 > /proc/sys/net/ipv4/ip_forward
I found an empty file /proc/sys/net/ipv4/ip_forward in my PC, so I guess it is the same as Mandrake?
 
Old 09-14-2005, 01:11 AM   #9
Snowbat
Member
 
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338

Rep: Reputation: 31
'mygateway' is your D-Link DSL-G604T. You'll need to log in, go to the LAN configuration bit, and see if there is a place to add an additional route or subnet.

Does the following command show '0'?:
cat /proc/sys/net/ipv4/ip_forward
If yes, the following command should enable packet forwarding:
echo 1 > /proc/sys/net/ipv4/ip_forward

I don't know how you'd set the default route in the iPaq but changing line 4 of the file might do the trick:
iface usbf static
address 192.168.2.202
netmask 255.255.255.0
network 0.0.0.0
gateway 192.168.2.200

If you have dig installed, you can check if you have a caching nameserver in the D-Link using the following command:
dig @mygateway www.linuxquestions.org
 
Old 09-14-2005, 02:22 AM   #10
Navyblue
Member
 
Registered: Jul 2005
Posts: 161

Original Poster
Rep: Reputation: 30
These are the read outs:

cat /proc/sys/net/ipv4/ip_forward
Code:
1
dig @mygateway www.linuxquestions.org

Code:
; <<>> DiG 9.2.4 <<>> @mygateway www.linuxquestions.org
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64174
;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.linuxquestions.org.                IN      A

;; ANSWER SECTION:
www.linuxquestions.org. 10000   IN      A       64.179.4.149

;; Query time: 2 msec
;; SERVER: 192.168.1.1#53(mygateway)
;; WHEN: Wed Sep 14 14:59:43 2005
;; MSG SIZE  rcvd: 56
Btw, last night I've found a file /etc/network/options that says:

Code:
ip_forward=no
spoofprotect=yes
syncookies=no
Not sure if I should touch it, but I have changed "ipforward=no" to "yes".
 
Old 09-14-2005, 02:37 AM   #11
Navyblue
Member
 
Registered: Jul 2005
Posts: 161

Original Poster
Rep: Reputation: 30
On a second thought, if possible I'd prefer not to do any alteration of settings on the router. If i were to go with option 2 does it mean that I won't need to do so?
 
Old 09-14-2005, 06:04 AM   #12
Navyblue
Member
 
Registered: Jul 2005
Posts: 161

Original Poster
Rep: Reputation: 30
Hi,

Just to let you guys know that I finally did it!

It's nothing fancy. For those who are interested to know:

On the iPaq side:
- Follow the intruction here on the USB networking here http://www.handhelds.org/moin/moin.c...seNotes#usbnet
- Look for /etc/resolv.conf, you would find that it is a symbolic link to /var/run/resolv.conf. And this file would be reset to blank on a soft reset. So delete this link and copy /etc/resolv.conf from the host PC to the iPaq.
- Do a soft reset or reset the network.

On the host PC side:
- Follow the intruction here on the USB networking here http://www.handhelds.org/moin/moin.cgi/UsbNet but ignores the part on NAT.
- Establish the USB network link between the PC and the iPaq
- Install iptables
- Install Firestarter, for some reason, I can only do this as root to make this work correctly (not even sudo)
- As root, type "firestarter" in the console, and for the same reason, I can only do this as root to make this work correctly (not even sudo), and you'll be greeted with a GUI wizard You'll be asked whether you want to enable internet sharing. Enable it and select your network link to the iPaq.
- If you have already installed Firestarter, you can access to the wizard from the menu.
- type "echo 1 > /proc/sys/net/ipv4/ip_forward" in the console.
- edit /etc/network/options, change "ipforward=no" to "ipforward=yes".
- Reboot or simply reset the network

Voila, done!

Just a side note on how to establish the USB network link. When I plug the iPaq into the craddle, the connection doesn't just start. First, let the iPaq sit in the craddle. With Opie (I don't know how to do it with GPE), under the "Settings" tab, tap on the "Network" icon. Tap on the "usbf" and tap on the "Start/Stop" Button and tap "Start". For some reason here, I always got an error message. Ignore it and close the "Network" window. The next time you start Network you'll see the network link established.

Last edited by Navyblue; 09-14-2005 at 06:15 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Networking / File sharing over internet problem Mandrake 10.1 sc_3007 Mandriva 2 03-26-2005 10:16 PM
Internet connection sharing help...using USB modem & Network card Daz155HGT Linux - Networking 6 04-28-2004 01:44 PM
DSL Ethernet USB Combo Router + Internet Sharing kenny_zzz Linux - Networking 0 02-28-2004 03:05 AM
networking adsl sharing usb ( many questions) oobe Linux - Networking 11 01-29-2004 10:37 PM
RH9 Internet Sharing USB Cable Modem Ju Deddo Koinu Linux - Networking 5 05-01-2003 03:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration