shareInternet-2.2.6.pet - Puppy as router - bugfix

Configuration wizards, scanners, remote desktop, etc.
Message
Author
gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#46 Post by gyro »

alienx2,

Thinking about this after my last response, I'm wondering if this is a dhcp problem, since it happens some time later.
(shareInternet only starts things going, and stops things. It doesn't actually run while traffic is flowing.)

That said, can we establish which link dies, when things fail:
Can the puppy machine still talk to the internet?
Can the puppy machine still talk to the Linksys router?

Other questions:
Is the ethernet port on the Puppy machine, that is connected to the Linksys router, defined statically?
Are you using the Linksys router as a router?
Is it running dhcp as a server?
(When I do something similar I plug the puppy machine into one of the client ports of the wireless router, and stop the dhcp server on the router. Effectively using the wireless router as an ethernet switch.)

gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

shareInternet-2.2.2.pet

#47 Post by gyro »

I have attached the current version of shareInternet, 2.2.2.

The only change is a tweak to the iptables firewall rules.

gyro

Edit: withdrawn, please use v2.2.3 as per first post
Last edited by gyro on Sat 12 Jun 2010, 01:45, edited 1 time in total.

alienx2
Posts: 13
Joined: Mon 24 May 2010, 08:16

#48 Post by alienx2 »

gyro wrote:alienx2,

Thinking about this after my last response, I'm wondering if this is a dhcp problem, since it happens some time later.
(shareInternet only starts things going, and stops things. It doesn't actually run while traffic is flowing.)

That said, can we establish which link dies, when things fail:
Can the puppy machine still talk to the internet?
Can the puppy machine still talk to the Linksys router?
Its only one problem is talk to internet... Linksys is working connect to puppy linux (tested with Remote Desktop VNC, FTP)


Is the ethernet port on the Puppy machine, that is connected to the Linksys router, defined statically?
yes. eth0 = static IP to linksys. then eth1 = auto DHCP to internet...
Are you using the Linksys router as a router?
yes but gateway to puppy linux as router.
Is it running dhcp as a server?
only internet have dhcp.

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#49 Post by gyro »

alienx2 wrote:Its only one problem is talk to internet... Linksys is working connect to puppy linux (tested with Remote Desktop VNC, FTP)
I think you are saying that all links stay up except the link between the Puppy box and the Internet.
Just to be sure, when the problem occurs can the windows box "ping" the puppy box?
If the puppy box is not running as a router, does not run shareInternet, can it maintain the link to the Internet?
alienx2 wrote:only internet have dhcp.
I would be surprised if this were the case.
If you run shareInternet, then it runs "dnsmasq" to provide a dhcp service downstream to the Linkysys router, and SOHO routers usually provide a dhcp service to their clients, in this case the windows box.
I would also suspect that the Linksys expects a dhcp service upstream on the puppy box.

gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#50 Post by gyro »

alienx2,

Just thought of another couple of questions.

What is the static IP address on eth0 of the puppy box?
What is the IP address of the windows box?

gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#51 Post by gyro »

alienx2,

A silly question, have you tried connecting the linksys directly to the ethernet port of the motorola?

gyro

alienx2
Posts: 13
Joined: Mon 24 May 2010, 08:16

#52 Post by alienx2 »

gyro wrote:
alienx2 wrote:Its only one problem is talk to internet... Linksys is working connect to puppy linux (tested with Remote Desktop VNC, FTP)
I think you are saying that all links stay up except the link between the Puppy box and the Internet.
Just to be sure, when the problem occurs can the windows box "ping" the puppy box?
If the puppy box is not running as a router, does not run shareInternet, can it maintain the link to the Internet?
windows box cant ping internet even also puppy linux (with shareinternet) cant ping internet. so manual turn off eth1 (internet) then turn on eth1.. both of them ping work.

because it sound like the problem is 2 network card conflict.

yes puppy box need shareInternet to be router :)


gyro wrote:
alienx2 wrote:only internet have dhcp.
I would be surprised if this were the case.
If you run shareInternet, then it runs "dnsmasq" to provide a dhcp service downstream to the Linkysys router, and SOHO routers usually provide a dhcp service to their clients, in this case the windows box.
I would also suspect that the Linksys expects a dhcp service upstream on the puppy box.
linksys is working connect with puppy box (with shareInternet)... because linksys gateway ip is Ip address of puppy box.
gyro wrote: What is the static IP address on eth0 of the puppy box?
in puppy box, eth0 is 192.168.1.101
gyro wrote: What is the IP address of the windows box?
windows box is 192.168.1.102

192.168.1.xxx is linksys router

gyro wrote: A silly question, have you tried connecting the linksys directly to the ethernet port of the motorola?
yes its always working.. but linksys got disconnect.. because my internet always disconnect every 3-6 hours... there is no automatic detect DHCP in linksys settings... About test straight up to internet (motorola) without router, Windows, ubuntu is working and automatic detect after internet disconnect...

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#53 Post by gyro »

alienx2,

I think you are saying:
if you connect the windows box directly to the motorola, it works fine.
If you connect the linksys router directly to the motorola, then the link to the internet drops after a few hours.
If you connect the puppy box to the motorola and the linksys to the puppy box, then the internet drops after a few hours.

One guess is that the motorola often gets a different IP address from dhcp every few hours. The windows box can follow this IP address change, but neither the linksys nor puppy with the current shareInternet can follow this IP change.
The current shareInternet is not correctly setup for such a dynamic situation. I will create a new version of shareInternet, v 2.2.3, in a couple of days, that is configured for such a situation. ( I need time to setup a test situation.)

When the problem occurs, does just a reboot of the puppy box fix it?

I'm surprised that the linksys is functioning as router, with eth0 of the puppy box being 192.168.1.101 and the windows box being 192.168.1.102. Normally I would expect these to be in different sub-nets, thus I would expect eth0 of the puppy box to be something like 192.168.2.101.

gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#54 Post by gyro »

alienx2,

Please upgrade shareInternet to v2.2.3 and try again.
It's available on the first post.

gyro

alienx2
Posts: 13
Joined: Mon 24 May 2010, 08:16

#55 Post by alienx2 »

gyro wrote:alienx2,

Please upgrade shareInternet to v2.2.3 and try again.
It's available on the first post.

gyro
Sure i will test it tonight.. i will let you know tomorrow.

alienx2
Posts: 13
Joined: Mon 24 May 2010, 08:16

#56 Post by alienx2 »

still same problem... i think it was dhcpcd because there is no automatic dhcp everytime in PUPPY Linux. but i tried searched some forum who similar the problem to me...

i feeling the problem similar to http://www.murga-linux.com/puppy/viewto ... c43a41c303

but there solved the problem is take a look http://www.murga-linux.com/puppy/viewtopic.php?t=51424

i didnt test that script... that sound great tricky about repeating renew dhcp every 15 minutes.. :) i will test it next 6 hours from now...

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#57 Post by gyro »

alienx2,

Normally dhcpcd does automatically renew the IP address.
But it would appear that for some folk the dhcpcd in puppy fails to do this.

Again it's a guess, but one explanation would be if some ISP's often give a different IP address, instead of renewing the old one. And the dhcpcd in puppy can automatically handle the renewing of the old IP address, but not getting a completely new one.

If my guess is correct, then the suggested script should work around the problem. You should set it to run every 2 hours.
The new version of shareInternet has more chance of being capable of coping with a changing IP address.

One way to see if changing IP address is happening, is to see what is the IP address of eth1, when it's working, and then again after you've got it working again.

gyro

alienx2
Posts: 13
Joined: Mon 24 May 2010, 08:16

#58 Post by alienx2 »

Thanks.. Its working script now :) for me, its fine for every 15mins...

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

shareInternet-2.2.4.pet

#59 Post by gyro »

Bug:
If the default route had a non zero metric, shareInternet failed to properly detect the interface pertaining to the default route. This resulted in all interfaces being detected as "inside". Thus shareInternet did not work.

Fixed in shareInternet 2.2.4. (see first post for download)
Recommended upgrade for all users of shareInternet.

gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#60 Post by gyro »

alienx2 wrote:so is there automatic?
Yes, its called "dhcpcd".
But the version of "dhcpcd" that's in the puppy you are using, doesn't seem to be working correctly in your situation.

I have compiled a newer version for puppy 431, see http://www.murga-linux.com/puppy/viewtopic.php?t=51424

gyro

potong
Posts: 88
Joined: Fri 06 Mar 2009, 04:01

#61 Post by potong »

Is this the pet for me?

My current configuration is three computers and a network printer connected to a fast ethernet switching hub.
Internet access is normally (well as normal as can be accepted for my phone/isp company) via a Billion ADSL Router which runs DHCP and allocates the computers their IP addresses (the printer has a static address so as to avoid problems with DHCP), the router is attached to the hub too.

Presently the phone lines and thus ADSL as well, are down and so I've reverted to plan B for internet access i.e. GPRS/Edge via a mobile phone.
I log on to the internet on my main puppy 4.3.1 usually on the first available IP address 192.168.1.2 (192.168.1.1 is the router and 192.168.1.50 is the network printer).

When ADSL is up, all the computers can get access to the internet via the router.
But since it's down only I can get access via ppp on my machine: I would like the other machines to have access via my machine.

Also, in order to gain access to the internet via GPRS/Edge I have found I have to bring down my eth0 interface on my puppy machine using

Code: Select all

ifconfig eth0 down
logon to the internet via connections icon and then bring the eth0 back up via

Code: Select all

ifconfig eth0 up
otherwise I can not print to the network printer.
Could someone explain to me why, and how to remedy this situation.
I fumbled around on the router web setup but cannot see an obvious choice.

Lastly, when ADSL is up I allow port forwarding via my router so my friends can access my discs using python and SimpleHTTPServer.
Can I achieve this using this pet?

Sorry for the inordinate length of this post but I'm wary of changing my working setup too much and finding all goes tits up when they get around to fixing the phone lines and ADSL comes back on line.

Potong

p.s. almost forgot: will this also cater for any virtual machines running via VirtualBox on my puppy?

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#62 Post by gyro »

potong wrote:Is this the pet for me?
I'm not sure if you would consider it to be "the" pet for you, but it can certainly help.

The best that could be achieved with this software is, to switch from ADSL to phone, you would have to:
1) Disconnect the ADSL router from the hub, (mostly to get rid of it's dhcp server).
2) Reconfigure eth0 to have a static IP of 192.168.1.2
3) Establish ppp0 as the Internet interface, using your phone.
4) Run shareInternet.
5) You may need to "repair" the ethernets of the other machines or simply reboot them.

Challanges:
1) Configure iptables in the puppy machine to do the necessary port forwarding. shareInternet has a facility for reading extra iptables rules for just this purpose. It installs a file called "/root/.shareInternet/iptablesExtraRules/serverExample"
2) If the fixed IP for the printer is controlled by the ADSL router, then we would need to find a way to get "dnsmasq" to do the same thing.
3) Changing the configuration of eth0 is a pain in standard puppy 431. That's why I wrote a script called storedNetConfigs, so you can have a dhcp config for eth0 and a static config for eth0 and easily choose which one you want enabled.
potong wrote:Could someone explain to me why, and how to remedy this situation.
It could be a dhcp conflict, but even if it's not, you need to configure eth0 not to use dhcp when you are using puppy as a router.
When the dhcp client (dhcpcd) gets an IP address it also writes a new copy of "/etc/resolv.conf" and a new routing table. This configures the machine to be able to talk to the up-stream network. It's not good to have 2 interfaces doing this at the same time. That's why it's a simple rule of thumb for routers, use dhcp on the up-stream interface, use static on the down-stream interface(s).
potong wrote:will this also cater for any virtual machines running via VirtualBox on my puppy?
I'm not sure, hopefully they will send a dhcp request onto the ethernet and get a response from eth0 as 192.168.1.2.

gyro

NOTE: if you want a copy of storedNetConfigs, I will upload a new one, since I've made a few cosmetic changes since the last version I published.

potong
Posts: 88
Joined: Fri 06 Mar 2009, 04:01

#63 Post by potong »

Thanks Gyro

There's a lot to assimilate here, perhaps I'll make my three computers all static IP addresses and remove the DHCP problem from the equation.
I did this with the network printer (the printer IP address is static set by the printers web interface).
This would also mean I can just disconnect the router until such time that the phone engineers get around to replacing the stolen line.
So all I need to do then is fix the shared internet.
I'm just having a gander at dnsmasq now, I'm afraid my knowledge of networking is woeful but I'll get there eventually.
Thank again for the detailed reply

Potong

p.s. please do update your storedNetConfigs pet I'll download and study it

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#64 Post by gyro »

potong wrote:perhaps I'll make my three computers all static IP addresses and remove the DHCP problem from the equation.
Remember that dhcp does more than just provide IP addresses, it also provides DNS server IP's and the gateway IP.
I would go for a dhcp solution wherever possible, for a network that changes. Then you can just plug in a new client machine and it just works, (except for entering the password for a WAP2 wireless network). Also after a network rearrangement, the worst you have to do to a client is reboot.
potong wrote:I'm just having a gander at dnsmasq now
If you use shareInternet there's no need to configure dnsmasq yourself, since the static IP for your printer is not controlled by your current dhcp server.

gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#65 Post by gyro »

See http://www.murga-linux.com/puppy/viewtopic.php?t=37468 for latest storedNetConfigs.

gyro

Post Reply