Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-11-2005, 11:58 AM
|
#1
|
Member
Registered: Jul 2005
Posts: 161
Rep:
|
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.
|
|
|
09-11-2005, 02:30 PM
|
#2
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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.
|
|
|
09-11-2005, 02:33 PM
|
#3
|
Member
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338
Rep:
|
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
|
|
|
09-11-2005, 11:53 PM
|
#4
|
Member
Registered: Jul 2005
Posts: 161
Original Poster
Rep:
|
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.
|
|
|
09-12-2005, 12:00 AM
|
#5
|
Member
Registered: Jul 2005
Posts: 161
Original Poster
Rep:
|
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.
|
|
|
09-12-2005, 02:59 PM
|
#6
|
Member
Registered: Jul 2005
Posts: 161
Original Poster
Rep:
|
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?
|
|
|
09-12-2005, 08:10 PM
|
#7
|
Member
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338
Rep:
|
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
|
|
|
09-13-2005, 02:15 AM
|
#8
|
Member
Registered: Jul 2005
Posts: 161
Original Poster
Rep:
|
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?
|
|
|
09-14-2005, 01:11 AM
|
#9
|
Member
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338
Rep:
|
'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
|
|
|
09-14-2005, 02:22 AM
|
#10
|
Member
Registered: Jul 2005
Posts: 161
Original Poster
Rep:
|
These are the read outs:
cat /proc/sys/net/ipv4/ip_forward
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".
|
|
|
09-14-2005, 02:37 AM
|
#11
|
Member
Registered: Jul 2005
Posts: 161
Original Poster
Rep:
|
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?
|
|
|
09-14-2005, 06:04 AM
|
#12
|
Member
Registered: Jul 2005
Posts: 161
Original Poster
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 04:04 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|