shareInternet-2.2.6.pet - Puppy as router - bugfix

Configuration wizards, scanners, remote desktop, etc.
Message
Author
User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#21 Post by ecomoney »

Internet connection sharing has been a "holy grail" for many people for quite some time. This actually seemed promising because it had a gui, and it said it works with wireless, but it seems to lack instructions. I tried for two hours without success to get it to "work". Gyro, if you know how to do this, its only half the story, actually making it work easily is the rest!

I wanted to forward an internet connection from my wireless adaptor (wlan0) on my laptop out of the ethernet port. I was using a crossover ethernet cable to attach from the laptop to the computer it was being shared to, but I suppose I could have used a switch, router and normal cables. On the host computer I want to be able to attach easily, preferably via dhcp (autodetect through the network wizard).

Would you post step by step instructions on how to do this? Including how to get the interfaces "up" (cant they be brought "up" automatically via the program?).

The other use for this program would to be able to effectively turn the puppy p.c. into a wireless router, taking a wired ethernet internet connection and turning into a wireless "hotspot" that clients can connect to via dhcp. This would add a major blindspot in puppy's current useability, that would take very little space.

If this were made simple and easy, I for one would push very hard for its inclusion in mainstream puppy linux. Thank you for your work so far.

Ecomoney
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#22 Post by 01micko »

Rob,
I think this may be a case of RTFM! There is a readme.

I connected my old 486 thru my machine which is on my wireless network easily. Your machine with the 2 interfaces, assign a static IP to the ethernet interface, then try.

Cheers

Mick
Puppy Linux Blog - contact me for access

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#23 Post by 01micko »

Rob

I just installed shareinternet on my 4.2 machine and am now posting on my 486. The slowest part was waiting for the 486 :) .
Step by step
1) Install shareinternet, don't touch it!
2)Go to internet wizard, choose LAN, eth0 (or whatever your ethernet card is)
3) configure a static IP of 192.168.x .1 making sure x is differrent from the wireless interface, subnet 255.255.255.0, ALL OTHER FIELDS BLANK.
3)Save
4) click on ~/MyRoxApps/Shareinternet. A box will pop up. Choose the wireless interface, a big green dot will appear on the icon. Do not try to configure a firewall or anything.
5) On the client machine, run network wizard as usual, choose automatic IP and you are done!

Cheers.

Mick
Puppy Linux Blog - contact me for access

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#24 Post by ecomoney »

I have found the holy grail!!!!

Many thanks Micko, you have succeeded in showing me something I have been trying to achieve for years.

I assumed I would have to set up my wireless connection first, which is open and able to connect via dhcp. I chose a static i.p. of 192.168.2.1 for my ethernet, as my wireless (wlan0) was given 192.168.1.12. I also had to right click the shareInternet icon in /root/my-roxapps which brought up a right-click menu...this is where I found the manual (the readme file), and also the "configure sharing internet" option which brought up the dialog box. I was a bit confused here, so I guessed and chose the "wlan0_eth0" option...and I must have guess right.

I read the readme file...once I found it.....for a bit, but it made my head spin. Do we really expect new linux users to wade through that, when the operation is so much simpler in Windows? Dont get me wrong...this is the only thing that works for puppy I have seen in 4 years of using it (including the built in puppy firewall wizard, which says it can share the internet but doesnt), so I am grateful at least for that.

Its possible to tell via the thread hit rankings what a popular feature this would be if puppy included it. Because I havnt (until now Micko) found a definitive solution I can only assume a lot of people (like me) decided it was impossible and either switched distro, or went out and bought a £50 router.

It there a way that this program could detect if an internet connection was already set up, and via which interface? It could then find out what I.P address number the x in 192.168.x.1 was (see above) and increment it by 1, and set up the outbound port with a static ip automatically?

Also how would I use this to work the other way around, i.e. connect to the modem via a ethernet cable, and create a wireless hotspot using a common garden usb wireless adaptor (I believe this is call a "peer-to-peer" wireless network) that could be attached to via a laptop with built in wireless or a pcmcia or usb adaptor? I darnt touch the current setup in case I cant get it working again.

This would make so much "old junk" so much more useable, and save a lot of people money if it worked easily.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#25 Post by 01micko »

Hey Rob

Glad you got her going!
t there a way that this program could detect if an internet connection was already set up, and via which interface? It could then find out what I.P address number the x in 192.168.x.1 was (see above) and increment it by 1, and set up the outbound port with a static ip automatically?
Well a fairly simple script should do itm I might even do that as a side project, and my buddy Trio will surely help!
Also how would I use this to work the other way around, i.e. connect to the modem via a ethernet cable, and create a wireless hotspot using a common garden usb wireless adaptor (I believe this is call a "peer-to-peer" wireless network) that could be attached to via a laptop with built in wireless or a pcmcia or usb adaptor? I darnt touch the current setup in case I cant get it working again.
Easy, exactly the same way... The one you click is your connection to the internet.... no matter the signal source. Even better, you don't have a peer to peer network, you have a router, an address assigning router with dhcp server, neat eh? Theoretically you could piggy back unlimited networks!

Cheers
Puppy Linux Blog - contact me for access

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#26 Post by ecomoney »


PostPosted: Today, at 6:36 am Post subject:
Hey Rob

Glad you got her going!
Quote:
t there a way that this program could detect if an internet connection was already set up, and via which interface? It could then find out what I.P address number the x in 192.168.x.1 was (see above) and increment it by 1, and set up the outbound port with a static ip automatically?


Well a fairly simple script should do itm I might even do that as a side project, and my buddy Trio will surely help!
That is good to know, and if you have the skills it would be a very worthwhile use of your time. Perhaps also when the icon is clicked upon, it might run a quick test to see if there is internet connectivity already present ("ping www.google.co.uk"?), and if not offer to run the internet connection wizard to set it up ("exec /usr/sbin/net-setup.sh"...see I am not a total "noob", although I may feel it sometimes.) Clicking the icon again would then show a list of ports (minus the one that the web was currently connected by) that the user would wish to share out the connection via. If this were a list of interfaces in the machine, with a tick box next to each one, then it would be possible to to share the internet from a wireless (or cable) to any number of wired and wireless interfaces....so this could make puppy into a wireless repeater too.....am I getting ahead of myself here? I have wanted a skilled coder to address this for so long. :oops:

I hope you get the picture, it offers so many more possiblities for reuse. Many thanks for your help micko.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#27 Post by 01micko »

I'm not much of a coder! :lol: But we are Puppy! I'll write a basic script with gui over the next week or two including your suggestions (they were on my mind anyway :wink: ) and when I get something going, I'll start a thread, maybe even gyro will jump on board. I'm sure more devs will come on board, that's how it works around here! :)

How about "PInternet-Sharing"? hehe!

Cheers
Puppy Linux Blog - contact me for access

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

#28 Post by gyro »

Hi,

Sorry for the absence, I thought I had been keeping an eye on things, but obviously not.

ShareInternet doesn't attempt to touch the interfaces, since it's designed to work with any two interfaces in any direction. So it looks for any two useful interfaces, either ppp0 or interfaces with ethernet encapsulation. Once it has found two and only two active interfaces, it asks the user to say which one is the "internet/upstream" one. The easiest way to be agnostic about which interfaces to use, is to do nothing until two are provided.
When it's starting it attempts to guess which configuration to use based on the two interfaces provided. In my machine I have "ppp0_eth0" and "ppp0_wlan0" configured. I bring up either the ethernet or wireless interface with a static definition, then attach my 3G mobile phone, and "dial" to produce ppp0, then start ShareInternet, and it automatically chooses the appropriate config to use.

Process:
1) Using the network wizard, get your upstream/internet interface active using dhcp.
2) Using the network wizard, get you downstream interface active using a static configuration.
3) Run ShareInternet.
4) If it asks you which interface is the Internet one, click on the interface you setup in 1)

Actually attempting to guess which is the Internet interface, could try the following:
a) If ppp0 is one of the interfaces, then it is most likely the Internet one.
b) The interface that connects to the network that contains the default gateway, is very most likely the Internet interface. This should be discern-able from the output from " iproute | grep default | cut -d' ' -f5".
Hm, if the above two rules do not produce the correct result, then there's a good chance that the configuration won't work anyway.

Interesting, thanks for stimulating this idea.
I'll look at a new version of ShareInternet that implements a) and b) above. I'll most likely chuck out the whole concept of storing configurations altogether, including the configuration dialog. ShareInternet will just keep on complaining, with hopefully meaningful error messages, until it gets two interfaces that should work. Doing a "ping" to a well known server might be the final test.
I'll get to it as soon as I've gotten my current project to a working version.
But I have no intention of ShareInternet actually controlling any interfaces. The Puppy network wizard, plus rc.network, plus "StoredNetConfigs" should provide all that's necessary to manage the interfaces.

Producing good documentation is always the hardest part.

gyro

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#29 Post by 01micko »

gyro,

Thanks for your response mate.

What ecomoney wants and what I reckon can be done with some good bash should give puppy a good reliable ICS alternative.

Cheers

Mick
Puppy Linux Blog - contact me for access

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#30 Post by ecomoney »

What ecomoney wants
It isnt just me I assure you! This has been one of the most asked for requests by new users on the forum.

Like I say, if the program were to check for internet connectivity to start with, it could pretty much guess at the interface that the internet connection was needed to be served out via. If there was no connectivity then it would start the internet connection wizard.

If the "outgoing" interface was a wireless device (I dont know how this is checked for, but the current internet connection wizard has code for it), then an additional dialog would be needed for the user to insert wireless parameters (SSID, possibly encryption etc) to create the "hotspot". I cant see anyone wanting to "dish out" their internet connection, from whatever source, by any other method than either an ethernet port or a wireless device.

I know "incoming" and outgoing dont "technically" apply, but they help describe the process. :-)
But I have no intention of ShareInternet actually controlling any interfaces. The Puppy network wizard, plus rc.network, plus "StoredNetConfigs" should provide all that's necessary to manage the interfaces.
On a technical level your completely correct Gyro (thanks for looking over this), but "isnt working" and "cant be got to work without spending hours RTFM'ing" will amount to the same thing for people without your level of networking knowledge. To be useable it needs to be simple, and just do the work in the background, how it does that could be in the readme if people are interested. It should bring all the interfaces up and assign i.p. automagically, so people can *just get their computer working* and read about the details when they have to.

Like I say, this is a huge blindspot in functionality in the current puppy linux, and has been for some time.....you wouldnt want 100mb puppy not to be able to do something as easily a windows would you?? :twisted: :wink:
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#31 Post by ttuuxxx »

ecomoney wrote:you?? :twisted: :wink:
Its always best say get a wack of used company / school / government pc's if your going to say setup a internet cafe, that way they are all the same make models, cards etc. Thats a real ideal situation where you could basically have a large hub and have them all wired together, with a remastered puppy cd with the internet settings already saved on it, Then you just do a ghost image and boom 30 pc's all up and running on 2 hubs. in like 3-4mins using a server. In college when I took networking management thats what we used to do every morning using server 2003 and Nortons Ghost, we did try linux type ghosting, but at the time Nortons Ghost was the only one which could do windows and linux, since we were using fedora, ubuntu, linux mint, puppy, what ever I would bring in that day. The thing about Nortons Ghost you could make images for different machines, and just call them out, a full xp installl with office was about 20mins, and you would just boot up using a floppy disk do a few clicks and then it was set.
anyways thats my 2c

ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#32 Post by ecomoney »

You did a network management course at college?

Im not surprised you had to reinstall windows every day, probably the safest bet.. :lol:
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#33 Post by ttuuxxx »

ecomoney wrote:You did a network management course at college?

Im not surprised you had to reinstall windows every day, probably the safest bet.. :lol:
Yes I spent 3 Yrs doing I.T full time, due to the fact I had Visa issues for Australia, So the First Year I took Network management, and the Second and 3rd year I took Web development/ management diploma.
ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

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

Re: ICS lookalike for Puppy

#34 Post by gyro »

01micko, ecomoney,

a) Puppy already has utilities to manage and automatically activate interfaces.

b) I have just re-written ShareInternet as v2.0, (done proof of concept testing, but needs more testing, expect release in a couple of days.)
The thing about v2.0 is that given 2 or more, appropriately configured, active interfaces it does it's thing automatically. No more questions. No more stored configs. No more configuration dialog. Just "UP" a few interfaces, and run it. The interfaces can be any combination of ethernet, wifi, and upto one ppp0.

Given that, I would humbly suggest that to produce an ICS equivalent, you might look at producing a wizard that does the following:
1) Sends them into the Puppy network wizard to setup the Internet interface using dhcp.
2) Sends them into the Puppy network wizard to setup the local interface statically.
3) runs ShareInternet v2.0

Enhancements:
1) Create a customised version of the network wizard for step 2), that only shows "IP address" and "Network Mask", and both these already filled with default values "10.10.1.1" and "255.255.255.0". No confusing extra fields, and make it accept the above without complaint.
2) Nice if step 3) also provides them with an option to automatically run ShareInternet at boot time.
3) Create a customised version of the network wizard for step 1) e.g. automatically uses dhcp.
4) Further customise network wizard for step 2) so that it provides an oportunity to loop to define more than one local interface. (The second time round the loop the IP address would be "10.10.2.1" etc...)

You might consider making a single pet that contains the ShareInternet files as well as the new wizard stuff.

Have fun!

gyro

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#35 Post by 01micko »

gyro

Thanks for that info... I was leaning toward that approach.

I will not start anything until V2.0 is available. Looking forward to it. :wink:

Mick
Puppy Linux Blog - contact me for access

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#36 Post by ecomoney »

Greets Gyro

Please would you explain, from the point of view of someone sat at the screen, how the wizard behaves. For example, What exactly happens if ShareInternet doesnt find two active connections?

What would happen in the case of ShareInternet being run, and one internet interface is already up and configured? Would it then be able to seek out another, possible non-"upped" interface (or offer a choice of several if it finds more than one), and offer to share out the connection to that? Could it even share the internet out to several *at the same time*?

For example, if share internet were to run, and discover an active connection on eth0 already configured via DHCP, but also an unconfigured eth1 and wlan1? Would it offer the choice to share the connection out via either, or both of them? Just one would be fine for a start for sure. Sharing a connection from a mobile phone out via wireless or ethernet would also be a

What happens if ShareInternet finds no active connections at all? Would it then offer to launch the internet connection wizard? One idea...could the existing internet connection sharing wizard have an extra option upon a successful connection to the internet, the share this out via Shareinternet?

You may also wish to point out that to share a connection from one computer with a live connection, to one without a live connection via ethernet, a crossover cable is required.

I think its important to design a feature like this from the User Interface down, rather than from the internal mechanics up. I would be happy to spend a few hours designing the look and logic of the user interface, if you would write the internal code to put underneath it. Ive done a lot this before
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

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

Version 2.0

#37 Post by gyro »

01micko,

V2.0 is now available for download. I've updated the original post. I hope that it is useful.

ecomoney,

ShareInternet V2.0 is not a wizard. It's more of a backend that just does things.

If you run it with less than 2 "UP" interfaces, it shows an error message stating this, and exits.
If you run it with 2 interfaces, but no default gateway is defined, it shows an error message, and exits. (Such a configuration wouldn't work anyway.)
If you run it with 3 "UP" interfaces, it will share the one that connects to the default gateway, with the other 2.

ShareInternet uses all the interfaces that are "UP". You control what it does by what interfaces are "UP" and how they are configured. If the Internet/upstream interface is configured with dhcpcd or pppd, and all local/downstream interfaces are statically configured with just an IP address and netmask, then it just works.

I don't use a crossover cable, rather a spare ethernet switch. These tend to be agnostic about which type of cable you use. Also, Puppy won't bring up an ethernet interface unless it is connected to a powered on device on the other end. Since I prefer to setup the router first and then startup the client, plugging Puppy into a powered on ethernet switch is my preferred method.

You, or anyone else, are most welcome to write a wizard/ frontend, and use ShareInternet as a backend.
I use "StoredNetConfigs" to easily control which interfaces are "UP" and how they are configured. This is so that I can quickly turn my laptop into any of the 3 types of router that I sometimes use.
(Share modem over ethernet, share modem over wifi, share local wifi over ethernet.)

Thanks for the stimulation.
I've just realised I should re-write "StoredNetConfigs" so that it works at a higher level, with configs having user defined names like "Ethernet workstation". "Wifi workstation", "Share PPP over ethernet", "Share PPP over wifi" and "Share wifi over ethernet". Ah well another project to keep me off the streets.

gyro

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

#38 Post by ecomoney »

ShareInternet V2.0 is not a wizard. It's more of a backend that just does things.
You, or anyone else, are most welcome to write a wizard/ frontend, and use ShareInternet as a backend.
A wizard really is what is needed, the whole idea of puppy is that it "just works" (see mission statement). However, what your saying is that this is a set of "libraries" that could be called by such a wizard in order to easily set up internet connection sharing for those new to networking? If this is the case would you document the API (Application Programming Interface) when you have completed your own testing, so that a "newb-friendly" front end can be developed from it.

It definitely sounds like ShareInternet 2.0 would be very useful in the further development of this much needed function. Thank you for your work.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

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

#39 Post by gyro »

ecomoney wrote:However, what your saying is that this is a set of "libraries" that could be called by such a wizard in order to easily set up internet connection sharing for those new to networking? If this is the case would you document the API (Application Programming Interface) when you have completed your own testing, so that a "newb-friendly" front end can be developed from it.
No, it's not a library, it has no API. Its a standalone application that you execute once you have configured and activated the network interfaces you want to use in your router.

It doesn't care what software you use to configure the interfaces.
You can do it with the Puppy network wizard + rc.network.
If more flexibility is required you can do it with StoredNetConfigs.
You can write your own script to configure the interfaces using only command line utilities if you really want to do things the hard way.
Or you can write your own GUI to configure and activate the interfaces.

Just somehow get all the required interfaces configured and activated ("UP").
Then, execute ShareInternet to start the router running.
Later when you've finished with routing, click on ShareInternet's icon again, and routing will stop.

gyro

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

Re: ICS lookalike for Puppy

#40 Post by gyro »

01micko,

A snippet of bash code that calculates a static address in the next subnet. Just in case it is useful in presetting the IP address in a customized network wizard for static router local interfaces:

Code: Select all

#!/bin/bash

calcNextIpNet() {
XSNET=${XIP%.*}
XNET=${XSNET%.*}
XNETN=${XSNET##*.}
XNETN=$[XNETN+1]
[ $XNETN -gt 254 ] && XNETN="1"
XIP="$XNET.$XNETN.1"
}

X_IFCE="`iproute | grep default`"
[ "${X_IFCE:(-1)}" == " " ] && X_IFCE=${X_IFCE% *}
X_IFCE=${X_IFCE##* }
XIP=`ifconfig $X_IFCE | grep inet`
XIP=${XIP#*:}
XIP=${XIP%% *}
XSNET=${XIP%.*}
XNET=${XSNET%.*}
[ "$XNET" != "192.168" ] && XIP="192.168.0.1"

calcNextIpNet
echo "$XIP"

calcNextIpNet
echo "$XIP"

exit
Note: The code assumes that the internet interface is already "UP".

Edit: Fixed code so that it works with ppp0 interfaces.
And always uses subnets in 192.168.n.n,

gyro

Post Reply