shareInternet-2.2.6.pet - Puppy as router - bugfix

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

shareInternet-2.2.6.pet - Puppy as router - bugfix

#1 Post by gyro »

When it comes to turning Puppy into a router, ShareInternet starts where the Network Wizard leaves off. Once you have at least 2 interfaces up and running and appropriately configured, run ShareInternet and it will run the firewall configured to protect your Internet interface, and dnsmasq to provide dhcp to your local interface(s).

ShareInternet works with ethernet, wifi, and ppp interfaces. So it could be used to share a wireless hot-spot with a local lan, or even a "mobile phone as a modem" with a local wifi network. (I use it when traveling so that 2 laptops can be surfing the web at the same time, via 1 mobile phone.)

NOTE: Since the changes from 2.2.4 to 2.2.5 are mostly cosmetic;
If you have, or can easily install, 'dnsmasq' use 2.2.5, else use 2.2.4.
If your 'iptables' complains, try 2.2.6, (like 2.2.5 has no 'dnsmasq').

gyro

Edit: Updated to 1.2
Rox-app is now in /root/my-roxapps.
If it finds 2 active appropriate interfaces, it attempts to use them.
Edit2: Updated to 1.3
Upgraded dnsmasq to 2.46.

Edit3: Updated to 1.4
Has facility to be started at boot time, Puppy boots as router.
Has facility to load custom iptables rules.

Edit4: Updated to 2.0
No more configs. It works it out itself.
Only configuration possible is to get it to be run automatically at boot time.
A version 2.1 is planned to provided a config utility for setting up of starting at boot time.

Edit5: Updated to 2.1
Added onDesktop file in /root/Desktop
Readme:http://www.users.on.net/~wrags/ShareInternet-2.1.html.

Edit6: Updated to 2.2.2 - tweaked iptables rules
It now uses it's own iptables rules, dosen't use rc.firewall.

Edit7: shareInternet 2.2.3, iptables now configured for changing upstream IP address.
(uses MASQUERADE instead of SNAT.)
If 2.2.2 works in your situation, no real advantage in upgrading to 2.2.3.

Edit8: attached shareInternet 2.2.4, fixes bug in detecting default route, that sometimes prevented shareInternet from working.
Also upgraded dnsmasq to 2.55, compiled on Puppy 431.
Recommend upgrade for all users of shareInternet.

Edit9: attached shareInternet 2.2.5.
Removed dnsmasq from the pet. If dnsmasq is not present in the current puppy, then it must be installed separately. This means that shareInternet should work on virtually any puppy.
Moved the Rox app to "/root/my-applications".
Fixed the "serverExample".
(Actually, I don't use this any more. I use a small wi-fi router from a cell-phone supplier.)

Edit10: attached shareInternet 2.2.6
Got rid of some 'offending' code in the iptables script.
Attachments
shareInternet-2.2.6.pet
reduced iptables script
(14.32 KiB) Downloaded 1538 times
shareInternet-2.2.5.pet
does not include 'dnsmasq'
(14.33 KiB) Downloaded 838 times
shareInternet-2.2.4.pet
includes 'dnsmasq'
(90.25 KiB) Downloaded 4061 times
Last edited by gyro on Mon 04 May 2015, 22:12, edited 22 times in total.

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

#2 Post by 01micko »

Interesting gyro. I'll be looking at this one.
Thanks
Puppy Linux Blog - contact me for access

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

updated to 1.2

#3 Post by gyro »

Updated to 1.2.
See original post.

gyro

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

updated to 1.4

#4 Post by gyro »

Updated to 1.4
See original post.

gyro

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

#5 Post by 01micko »

G'day gyro, told ya I'd look!

I'm having a problem. I have 'puppypc7' out in my shed wirelessly connectected to my network. I ran linux firewall from the menu, tried to configure your package but my firewall does not showup in your gui. Do I need something else, like 'bridge-utils'?

I want to connect my 486 to my network thru puppypc7, it is a crossover ethernet connection directly to puppypc7. The 486 is configured fine, I can connect by other means, so the prob is with puppypc7. 4.1.2 installed, installed ShareInternet 1.4, tried to configure firewall. Any ideas?

Cheers
Puppy Linux Blog - contact me for access

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

#6 Post by gyro »

01micko wrote:I ran linux firewall from the menu, tried to configure your package but my firewall does not showup in your gui. Do I need something else, like 'bridge-utils'?
No.
Don't use Puppy's firewall wizard and ShareInternet. ShareInernet configures the firewall itself. If you run Puppy's firewall wizard after installing ShareInternet, ShareInternet won't work.

Uninstall ShareInternet and then install ShareInternet.
Issue an "ifconfig" command in a console window, and ensure that both network interfaces are UP.
Click on the shareInternet icon in /root/my-roxapps.
It should show a dialog to allow you to select which interface connects to the Internet, for you this would be the interface that is not connected to the 486.
The icon should then get a green dot on it to indicate that all is up and running.
Click on the icon again and the firewall and dnsmasq will be shut down.

Explanation:
ShareInternet is quite dynamic about which 2 interfaces are used, and at startup it attempts to find the 2 that are UP. Once it's done this it needs to run /etc/rc.d/rc.firewall on the current 2 interfaces. But the rc.firewall produced by the Puppy firewall wizard has no facility to be told at runtime which interfaces to use. So ShareInternet installs a version of rc.firewall that imports the file /etc/rc.d/FWINTERFACES, which defines "DYNAMIC_INTERFACES" and "INTERNAL_INTERFACES". ShareInernet can run this rc.firewall with any interfaces by rewriting /etc/rc.d/FWINTERFACES.

gyro

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

#7 Post by gyro »

01micko wrote:Any ideas?
Just thought of another couple of things.
Puppy's rc.network is very conservative about bringing up ethernet interfaces. They must be physically connected to a device that is powered up. (Fortunately I happen to have a spare ethernet switch to use in this situation.)
So either power on the 486 and connect it to puppy7 before you boot puppy7.
Or, run rc.network on puppy7 after you connect the 486 and power on the 486, but before you click on the shareInternet icon.

Depending what OS is running on the 486, you may need to reboot the 486 after you get the green dot on the shareInternet icon on puppy7.

gyro

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

#8 Post by 01micko »

gyro,

everything is up, eth0 is up on puppypc7 and bluflops486.
I'm using blueflops because it is fast. A minimal console based distro with 'Links' gui browser and irc. I like it. Very easy to set up, comes with a setup progran. eth0 on the 486 is searching for an IP but I have no dialog in the ShareInternet GUI.

Hold the phone! Got the green light! I might have to restart udhcp on the 486, got 2 blinkys :wink:

Not getting an IP for eth0 on my pupppc7 :( . Do i need to configure that? say static of 192.168.1.1?

So read readme, RTFM!!!! :oops:
Puppy Linux Blog - contact me for access

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

#9 Post by 01micko »

gyro
Success :) I am posting from bluflops486 now. Got 2 blinkys flashing and all is good.

You've been a great help to me on this forum, have to catch up and buy you a beer!

Cheers

Mick
Puppy Linux Blog - contact me for access

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

#10 Post by 01micko »

8) I am posting from puppypc486, yep, running fat_free-2.16-dillo and the browser is faster than 'links'.

Thanks again
Puppy Linux Blog - contact me for access

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

#11 Post by gyro »

Mick,

Great news.

You are welcome.

gyro

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

#12 Post by 01micko »

gyro wrote:Mick,

Great news.

You are welcome.

gyro
Then the beer is on me, if not a coffee!
Puppy Linux Blog - contact me for access

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

#13 Post by 01micko »

G'day gyro

Slight problem.

If I open ~/File-Sharing/Setup-Sharing and choose to find shared folders it only searches on the "192.168.1.x" network. My main network is "192.168.33.1" (remember???) . Guessing if I change the 486 network to "192.168.34.x" or greater it might work, I'll try that.

Easily reconfigured this puppypc7 to 192.168.44.1 (486 still online after restarting network :wink: ). No joy with sharing... :cry: :? I'll do some searching...

Seems to default to eth0, (maybe looking for fastest connection?)
Puppy Linux Blog - contact me for access

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

#14 Post by gyro »

01micko wrote:If I open ~/File-Sharing/Setup-Sharing and choose to find shared folders it only searches on the "192.168.1.x" network.
I've just had a quick look at the script run by ~/File-Sharing/Setup-Sharing. It always looks in the local network defined by the first IP address it finds in the output from "ifconfig". Would need to change the software to do something different.
But even more significantly it is not using Windows folder sharing. It's looking for FTP servers, something completely different. If it's Windows folder sharing you want, then you will need to use "samba" on Puppy.

I've used "samba" on a Fedora 9 machine, but never Puppy.

If you're trying to do Windows folder sharing through a router (puppy7), then I'm not sure there is any chance.

gyro

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

#15 Post by gyro »

01micko,

If you are trying to use this Puppy share facility and already have servers setup on puppies on your main network, and you are trying to use the 486 as a client. This should work. But the scanning won't work from the 486, you will have to define your servers manually.

gyro

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

#16 Post by 01micko »

Hey gyro

SMB (Pnethood) is working fine.

Only native file sharing is broken (scanning) I'll test manually.
Puppy Linux Blog - contact me for access

jaymac407
Posts: 2
Joined: Sun 01 Feb 2009, 18:16

#17 Post by jaymac407 »

Is it possible to do port routing?

For example, Puppy's Internet IP is 192.168.1.2 and I want it to forward port 8080 to 192.168.3.2 (My computer's IP by Puppy)

Is this possible?


THX!

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

#18 Post by 01micko »

01micko wrote:
Only native file sharing is broken (scanning) I'll test manually.
Yep, fine manually. I can put up with that! The pros far outweigh the cons...
Puppy Linux Blog - contact me for access

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

#19 Post by gyro »

jaymac407 wrote:Is it possible to do port routing?
Yes.
Use the "iptables" utility to add extra functionality to the firewall. Google "iptables".

gyro

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

#20 Post by gyro »

jaymac407 wrote:For example, Puppy's Internet IP is 192.168.1.2 and I want it to forward port 8080 to 192.168.3.2 (My computer's IP by Puppy)
Try something like the following:

Code: Select all

iptables -A PREROUTING -t nat -p tcp -d 192.168.1.2 --dport 8080 -j DNAT --to 192.168.3.2:8080
iptables -I FORWARD 2 -p tcp -d 192.168.3.2 --dport 8080 -o ${INSIDE_DEVICE} -j ACCEPT
# This rule helps the "I can't reach my web server from the inside" problem.
#iptables -A POSTROUTING -t nat -p tcp -d 192.168.3.2 --dport 80 -s 192.168.3.0/255.255.255.0 -j SNAT --to 192.168.1.2
You woud need to replace "${INSIDE_DEVICE}" with the name of you inside interface, e.g. eth1
Or you could just omit "-o ${INSIDE_DEVICE}" from the second line.

Note: The above is based on code from the "floppyfw" project.

gyro

Post Reply