Linux - NetworkingThis 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.
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.
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.
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.
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.
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?
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
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.
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.
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
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?
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?
'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
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?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.