How to share wifi(internet) from laptop?

What works, and doesn't, for you. Be specific, and please include Distro version.


Moderator: Forum moderators

Post Reply
arivas_2005
Posts: 37
Joined: Mon Oct 05, 2020 3:48 am

How to share wifi(internet) from laptop?

Post by arivas_2005 »

Greetings
a curiosity.
It will be possible to pass Wi-Fi internet from a mobile (point 1) to a laptop (point 2) and then distribute the Wi-Fi signal from a laptop, but the laptop only has one (1 card) wlan. (In the same wlan would enter signal (from 1) and also shared (point 2) to the others mobiles).
There is a way to configure laptop so that it receives a signal and at the same time shared (as hostpot), with only a(1) Wi-Fi card.
[ Or it is not possible! ]
My thanks to your comments
(I try to graph the idea)

Attachments
Shared_wifi.png
Shared_wifi.png (44.09 KiB) Viewed 1412 times
User avatar
wiak
Posts: 4244
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 70 times
Been thanked: 1257 times
Contact:

Re: shared wifi(internet) from laptop

Post by wiak »

The following suggests to me that it may be possible, but I have to leave you to try it out and report back please if you succeed:

https://anooppoommen.medium.com/create- ... 349b9c582d

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
ThruHammer
Posts: 257
Joined: Sun Jul 12, 2020 1:08 am
Location: Ray Brook, NY
Been thanked: 14 times

Re: shared wifi(internet) from laptop

Post by ThruHammer »

Maybe. Note the "sharing" segment.

The *crux* however depends on whether your card supports AP.

Code: Select all

Supported interface modes:
		 * IBSS
		 * managed
		 * AP
		 * AP/VLAN
		 * monitor

:o Kinda cool that mine ($20 or so US greenbacks) DOES!

I wish I had another device to test with.

arivas_2005
Posts: 37
Joined: Mon Oct 05, 2020 3:48 am

Re: How to share wifi(internet) from laptop?

Post by arivas_2005 »

Greetings..

I still have not advanced in my situation
Today it is like this:

===> Internet ==> eth0 ==> PC ==> wlan0

I want to share internet through wlan0.

I found a small script that creates the AP well and is seen on the clients, but does not share the internet
send error
Not Internet sharing.

and when starting the AP, the internet goes down by eth0 in the pc

Hopefully you can review it and give me the idea to share the signal with the internet.
I use the command

create_ap STUDENT STUDENT54321

I attach the script (just remove the .gz)
Thanks!

Attachments
create_ap.gz
(41.16 KiB) Downloaded 71 times
Clarity
Posts: 4066
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1704 times
Been thanked: 553 times

Re: How to share wifi(internet) from laptop?

Post by Clarity »

This post does NOT address your script. But from looking at your diagram, it appears you may be trying to set up a LAN proxy for your users. Not sure if your intent is a mere proxy or a caching-proxy.

I dont see anything in the modern forum for a Puppy proxy setup and use. Will try to find something if that is what you want for your LAN community.

arivas_2005
Posts: 37
Joined: Mon Oct 05, 2020 3:48 am

Re: How to share wifi(internet) from laptop?

Post by arivas_2005 »

Well
what I try is to pass the cable internet through eth0 and share it to several computers or mobiles in a classroom through Wi-Fi (something like the telephone routers).
With the create_ap command cell phones and PCs recognize the AP, but the internet from the eth0 wired computer is not broadcast by the AP.

Through PC1 you enter the internet with cable.

In 2 clients, they receive wifi. Clients in 2 if they recognize the wifi but the Internet signal does not pass from pc in 1 to clients in 2

Attachments
paHotsPot.png
paHotsPot.png (29.05 KiB) Viewed 1292 times
Clarity
Posts: 4066
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1704 times
Been thanked: 553 times

Re: How to share wifi(internet) from laptop?

Post by Clarity »

Hello @arivas_2005
An AP presence, as you indicate, suggests that the #2's are getting their IP addresses from a DHCP server, somewhere.

Usually, there is a DHCP server somewhere. The AP connects to that DHCP server and passes connection ability to devices which use it. All routing information is gotten from the DHCP server.

Is your phone a DHCP server while your PC is the AP? If the #2 units cannot route, then your DHCP server is not sending the info normally needed for internet access. And, as such, the #2 units are not getting the information for it telling it how to route.

AP's are relay nodes. They make no decisions except to intercept and pass-thru all LAN requests.

Does this give an indication of where the problem may be?

Please check to see if ALL #2 units can ping aI-netll other #2 units. AND check to see if the #2 units can ping the DHCP server ... not the AP... the DHCP server. In most home network cases that server is also your Gateway to the internet.

Hope this helps

EDIT:
Forgive me as I am having a little trouble understanding your physical setup you are trying to get to work. Please correct my understanding of what you are showing. Do you have

  • a Hotspot connected to your PC via a USB cable or via its Wifi?

  • If its Wifi, do you have a 2nd Wifi in the PC that your AP software is using?

  • If its USB, what is providing the DHCP services to your LAN users, both wired and wifi...since your PC is acting as an AP?

Where/what is your router in the picture below?

LAN1.jpg
LAN1.jpg (6.72 KiB) Viewed 1271 times
Clarity
Posts: 4066
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1704 times
Been thanked: 553 times

Re: How to share wifi(internet) from laptop?

Post by Clarity »

Beware: Some carrier Hotspots have a limit on the number of connections (LAN IPs) it will serve. Some are only1 while others ???.

ALSO: See this for cell-phone configuration ideas.

If you follow that, there is no need for an AP.

Hope this helps

arivas_2005
Posts: 37
Joined: Mon Oct 05, 2020 3:48 am

Re: How to share wifi(internet) from laptop?

Post by arivas_2005 »

Hello
Thanks for the quick reply.
Excuses for confusing description.
Well
I have comp.(1) with cable internet with eth0
I want to distribute signal wifi (wlan0). with/from comp.(1)
-----
From what I read, the script create_ap uses hostapd, dnmask and iproute packets.
then
script create_ap creates an AP that is seen by each celphone and other comps.
each celphone and others comp. get the ip of the comp(1)--(as AP)-- well.
this works fine.
but, internt form comp.(1) does not pass to every celphone and other comps.
That's my problem.
Then, How I do redirect the internet from comp.(1) to other comps and celphones?
I have read that make to a "nat"(eth0 nat wlan0), but I don't know how to do it
this:
......................... comp (1) .............................. other comps
internet -> eth0 -> redirect internet to - >> wlan0 - >> all clients
................................................................... celphones
my thanks

Attachments
InternetToWifi.png
InternetToWifi.png (30.8 KiB) Viewed 1231 times
Clarity
Posts: 4066
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1704 times
Been thanked: 553 times

Re: How to share wifi(internet) from laptop?

Post by Clarity »

Seems a little clearer.

  1. You have a cable company as your ISP delivering Internet service thru its device, a modem.

  2. You have a ethernet cable from the ISP's modem to your PC, you call #1.

  3. You have a wireless card in your #1.

Given that configuration, you want your PC #1 to extend internet from your PC #1 for others in your home; namely #2s.

ISP-modem-router-users.png
ISP-modem-router-users.png (28.74 KiB) Viewed 1221 times

If that is correct, what you "really" want is NOT AP software. Instead you want to make your #1 an "internet router". Doing this will allow 2 things for you:

  1. All wifi devices can ping each other and share information, internally in your home

  2. They can reach the internet thru your "router"

I am currently unaware of any PUPPY that is designed as a router OOTB and will have to look around. There are distros on Distrowatch that will turn a PC (as in your case "#1") into a router. None of which I have ever used.

Maybe someone else, here on the forum, has experience in setting up a router distro on a PC.

Hope this helps.
P.S. Your "AP" reference threw me for a loop. What you want is a router function running on a PC...not AP.

User avatar
stemsee
Posts: 788
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 188 times
Been thanked: 133 times

Re: How to share wifi(internet) from laptop?

Post by stemsee »

create_ap is the easiest way that i found to create a hotspot/bridge . I easily used my wifi card to join a network and share said network as a hotspot.

After here's a script i used to use. Depends on yad, dnsmasq, hostapd, create_ap (in fatdog repo or on github).

Code: Select all

[#!/bin/bash
# HotSpot copyright (c) 2016 Marcos M Contant
#
[ "`whoami`" != "root" ] && exec sudo -E -S ${0} "$@"
export track=/tmp/Wifi-HotSpot/
[ ! -d $track ] && mkdir -p /tmp/Wifi-HotSpot

export camino=/root/.wifi-hotspot
[ ! -d $camino ] && mkdir -p /root/.wifi-hotspot
function closehs () {
this=`yad --title="0 - 3" --entry`
for i in ${this}
do
	create_ap --stop ap"${i}"
	iw dev ap$i del
done
exit
}
export -f closehs

function checkapm (){
	pu=$(rfkill list wlan | grep yes)
if [[ ! -z "$pu" ]]; then
	echo "icon:/usr/share/pixmaps/apmd48.png" > "$track"/PIPE9
	echo "tooltip:Airplane Mode Activated" > "$track"/PIPE9
else
	echo "icon:/usr/share/pixmaps/wireless.png" > "$track"/PIPE9
	echo "tooltip:Airplane Mode De-Activated" > "$track"/PIPE9
fi
}; export -f checkapm
while sleep 1
do
	bash -c checkapm
	pu=$(rfkill list wlan | grep yes)
		if [[ -z "$pu" ]]; then
			break
		else
			exit
		fi
done

export TEXTDOMAIN=hotspot
export OUTPUT_CHARSET=UTF-8
export nets=`ls /sys/class/net | sort -r`
if [[ ! -f /usr/bin/create_ap ]]; then
	cd /usr/sbin/create_ap-master
	make install
	arch=`uname -a | grep x86_64`
	if [[ "$arch" ]]; then
	[[ ! -e /usr/lib64/libssl.so.1.0.0 ]] && ln -s /usr/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.0.0
	[[ ! -e /usr/lib64/libcrypto.so.1.0.0 ]] && ln -s /usr/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.0.0
	else
	[[ ! -e /usr/lib/libssl.so.1.0.0 ]] && ln -s /usr/lib/libssl.so.1.1 /usr/lib/libssl.so.1.0.0
	[[ ! -e /usr/lib/libcrypto.so.1.0.0 ]] && ln -s /usr/lib/libcrypto.so.1.1 /usr/lib/libcrypto.so.1.0.0
	fi
	[[ ! -f /usr/bin/create_ap ]] && yad --text="Load devx then try again
	Or do root# cd /usr/sbin/create_ap-master
	root# make install" --timeout=4
	cd /root
	[[ ! -f /usr/bin/create_ap ]] && exit
fi

version=1.2
type="wan
lan
bridge"
mytext1="$(gettext 'Hotspot Creation Tool:  Share Internet')"
mytext2="$(gettext 'SSID Hotspot Name')"
mytext3="$(gettext 'PASSWORD 8+')"
mytext4="Share from"
mytext5="Share to"
mytext6="$(gettext 'Network Type')"
mytext8="$(gettext 'Up and running.')"
mytext9="Close Tray"
mytext10="Disconnect"
mytext11="Re-Connect"
mytext12="Mobile Phone USB Tether"
mytext13="Phone disconnect"
mytext14="$(gettext 'H O T S P O T \n by stemsee ')"
mytext15="$(gettext ' up and running')"
mytext16="$(gettext 'SSID Hotspot Name')"
mytext17="Confirm"
mytext18="Password"
mytext19="HotSpot"
mytext20="User-ID"
mytext21="Can be empty"
mytext22="$CMD"
mytext23="12:34:56:78:90:AB"
mytext24="Random mac address"
mytext25="Edit mac address"
mytext26="default start"
mytext27="Save"
mytext28="02:01:02:03:04:08"
mytext29="01:23:45:67:89:ab"
mytext30="Open Browser"
mytext31="~Wifi-Connect~\n  ~2016~\n ~by stemsee~ "
mytext32="$(gettext 'Information')"
mytext33="$(gettext 'De/Activate shareInternet')"
mytext44="5ghz"
mytext45="Information"
mytext46="$(gettext 'non-MASTER mode card')"
mytext47="$(gettext 'Dependencies')"
if [ -e $HOME/.wifi-connect/hotspot ]; then
. $HOME/.wifi-connect/hotspot
hotspotguid=`cat $HOME/.wifi-connect/hotspot`
hotspot=`echo $hotspotguid | cut -f1 -d'|'`
mimi=`echo $hotspotguid | cut -f2 -d'|'`
srcdev=`echo $hotspotguid | cut -f3 -d'|'`
destdev=`echo $hotspotguid | cut -f4 -d'|'`
withit=`echo $hotspotguid | cut -f5 -d'|'`
export srcdev=$srcdev
export destdev=$destdev
export mimi=$mimi
export hotspot=$hotspot
export withit=$withit
fi

function listclients () {
	for i in ap0 ap1 ap2 ap3; do create_ap --list-clients $i ; done | yad --title="$hotspot $mimi $srcdev $destdev" --geometry=-100-100 --width=420 --height=180 --list --columns=1 --column="Connected Devices" --listen &
 exit
}
export -f listclients
function info () {
	yad --window-icon=/usr/share/pixmaps/wifi3.png \
	--title=Information --undecorted  --text \
	"Create wifi AP with or without internet: \n\n \
	1) Lan needs one wifi interface; \n use 'Share to' \
	field stating interface \n without internet \n\n 2) \
	Bridge needs two interfaces; \n eg eth0 to wlan0 \n \
	with internet \n\n 3) Wan needs two interfaces eg \n \
	wlan0 to wlan1 \n   or one if 'Ap Master' supported eg \n \
	wlan1 to wlan1 \n (one interface for internet and hotspot)"
}
export -f info
function info2 () {
	geany /usr/sbin/create_ap-master/README.md &
}
export -f info2
hotspotgui=`yad --window-icon=/usr/share/pixmaps/wifi3.png \
--image=/usr/share/pixmaps/wifi324.png --title "$mytext1" --item-separator="\n" \
--form --field="$mytext2" -entry  "$hotspot" --field="$mytext3" -entry  "$mimi" \
--field="$mytext4":CBE "$nets" --field="$mytext5":CBE "$nets" \
--field="$mytext6":CBE "$type" --field="$mytext45:BTN" "bash -c info" --field="$mytext47:BTN" "bash -c info2"`
ret=$?
[[ $ret -eq 1 ]] && exit 0
echo "$hotspotgui" > $HOME/.wifi-connect/hotspot
srcdev=`echo $hotspotgui | cut -f3 -d'|'`
destdev=`echo $hotspotgui | cut -f4 -d'|'`
mimi=`echo $hotspotgui | cut -f2 -d'|'`
hotspot=`echo $hotspotgui | cut -f1 -d'|'`
withit=`echo $hotspotgui | cut -f5 -d'|'`
export srcdev
if [ -z "$hotspot" ]; then
	exit
fi
	create_ap --stop $srcdev
	iw dev ap0 del
	#iw dev ap1 del
	#iw dev ap2 del
	#iw dev ap3 del
[[ -f /tmp/wifitrayhs ]] && exec /tmp/wifitrayhs &
wait $!
	
if [[ ! -f /tmp/wifitrayhs ]]; then
yad --notification --kill-parent --listen \
    --image=/usr/share/pixmaps/wifi324.png \
    --text="'$hotspot' '$destdev' '$srcdev' '$mimi' '$withit' '$frq'" \
    --command="bash -c listclients" \
    --menu="$hotspot $destdev!bash -c info2!/usr/share/pixmaps/wifi3.png|$mytext10!bash -c closehs!/usr/share/pixmaps/wifi324x.png|$mytext9!/tmp/wifitrayhs!/usr/share/icons/oxygen/22x22/actions/application-exit.png" &
wf2pid=$!

task='kill $pid'
echo "#!/bin/sh
pid=$wf2pid
$task
rm -f /tmp/wifitrayhs
" > /tmp/wifitrayhs
chmod 755 /tmp/wifitrayhs
fi

modprobe -v iptable_nat &
image=/usr/share/pixmaps/wifi3.png
case $withit in
wan) 
create_ap "$destdev" "$srcdev" "$hotspot" "$mimi"
;;
lan)
create_ap -n "$destdev" "$hotspot" "$mimi"
;;
bridge)
create_ap -m bridge "$destdev" "$srcdev" "$hotspot" "$mimi"
;;
esac
/code]
Last edited by stemsee on Fri Apr 23, 2021 7:10 pm, edited 1 time in total.
User avatar
rcrsn51
Posts: 1398
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 361 times

Re: How to share wifi(internet) from laptop?

Post by rcrsn51 »

@arivas: Have you identified your Puppy version or its kernel number?

Not all Puppy kernels have been built to do what you need.

The Starter Kit's kernel will do this.

Are you running a firewall on any of these machines?

Post Reply

Return to “Hardware”