How to share eth Internet through wifi?

Message
Author
undorik
Posts: 14
Joined: Sat 21 Jun 2014, 11:04

#16 Post by undorik »

tempestuous wrote:OK, just run -

Code: Select all

depmod
undorik wrote: I've run only depmod... and nothing happened.
already run.

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#17 Post by tempestuous »

undorik wrote:I've run only depmod... and nothing happened.
"Nothing" means that the command ran successfully. So now you're ready to proceed.
When you boot up, lsmod should show that Puppy has automatically loaded the b43 (and ssb) module.
If so, you're ready to set up hostapd, starting with -

Code: Select all

ifconfig eth0 down
ifconfig wlan0 down
iwconfig wlan0 mode Master
Since you have a manually assigned IP address, the dhcpcd stuff is not applicable to your situation. Instead, do -

Code: Select all

ifconfig br0 192.168.0.xx broadcast 192.168.0.255 netmask 255.255.255.0
route add default gw 192.168.0.1 br0
I'm assuming your router's internal IP address is 192.168.0.1

undorik
Posts: 14
Joined: Sat 21 Jun 2014, 11:04

#18 Post by undorik »

Hello :)

something else wrong

Image

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#19 Post by tempestuous »

I did some more reading here -
http://wireless.kernel.org/en/users/Doc ... on/hostapd
and it appears that the iwconfig command that changes the mode to "master" is outdated and unnecessary.
The hostapd application should do the mode-changing. So here's what I suggest:
Configure your /etc/hostapd.conf file, or just leave it if you're happy with the default SSID of "Puppy_Hotspot" and PSK passphrase "woof1234".
Now just go ahead and run the hostapd command -

Code: Select all

hostapd /etc/hostapd.conf -dd
If this appears to run OK, without any "failure" messages, then it has probably worked. But before you can test, you need to bridge the newly configured wifi interface to the ethernet interface, with these commands -

Code: Select all

ifconfig eth0 down
ifconfig eth0 0.0.0.0 up
modprobe bridge
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 wlan0
ifconfig br0 192.168.0.xx broadcast 192.168.0.255 netmask 255.255.255.0
route add default gw 192.168.0.1 br0
Now see if you can connect to this wifi hotspot with some other wifi device.

undorik
Posts: 14
Joined: Sat 21 Jun 2014, 11:04

#20 Post by undorik »

Hooray! Thank you very much!
Probably it is working!
I see my wifi spot in list!!!

br0 was already created and wlan0 already added btw.

And there is another issue :) my phone stuck in "getting IP address" state.
I have only one IP from my ISP and there is no dhcp.

If I chose (phone settings) auto assign DLNA IP I've got stupid 169.254.0.0/16 and connect to wifi successful but internet obviously dosn't work.
Probably I should setup some routing... any suggestions?

undorik
Posts: 14
Joined: Sat 21 Jun 2014, 11:04

#21 Post by undorik »

Maybe it will be clear with numbers.
My ISP gave me
IP 10.184.92.x/22
GW 10.184.92.1
and couple DNS.

I have to add android phone to wifi. I may setup static address there.
What address should I use for it? I see in wlan0 settings 0.0.0.0/24
so what GW should I use for phone?
I suspect that I also should add route in puppy

BTW why both eth0 and wlan0 have 0.0.0.0?

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#22 Post by tempestuous »

undorik wrote:BTW why both eth0 and wlan0 have 0.0.0.0?
0.0.0.0 is an invalid IP address. It means that your device has no IP address.
In my (outdated) instructions, 0.0.0.0 is used to clear any preexisting addresses, ready for configuration.

undorik wrote:Probably it is working!
I see my wifi spot in list!!!
That's great. Since my original instructions are wrong, I will need to test this setup, myself, and update the instructions.

undorik wrote:my phone stuck in "getting IP address" state.
...
I have only one IP from my ISP and there is no dhcp.
...
My ISP gave me
IP 10.184.92.x/22
Ah, this is a problem. My instructions assume that your ethernet connection to the internet is via a router, but I suspect your situation is different - you have some form of modem with a single ethernet connection, right? Can you tell us the exact brand/model?

Without a router, only one device can connect to the internet at the same time. Your Puppy computer grabs the IP address (10.184.92.x/22) so your Android phone cannot connect.

Solution 1:
Configure your Puppy computer to act as a router. This is probably how your hotspot configuration works under Windows, and it's what I talked about in the 2nd part of the "Puppy as a wifi access point" thread.
Unfortunately I don't know how to set this up - all I know is that it involves the "iptables" application.

Solution 2:
Buy a router! Or get a throwaway model from your neighbours.
Or buy a combined modem/router if you don't like the idea of having 2 separate devices taking up bench space.

undorik
Posts: 14
Joined: Sat 21 Jun 2014, 11:04

#23 Post by undorik »

Thank you for your help.
tempestuous wrote: Ah, this is a problem. My instructions assume that your ethernet connection to the internet is via a router, but I suspect your situation is different - you have some form of modem with a single ethernet connection, right? Can you tell us the exact brand/model?
Exact situation: Cold and snowy Russia, old 9-story building with 7 flats per floor :) and cunning ISP which for some reason give IP (no pppoe/dsl etc.). Probably ISP binds IP (or mac) with billing.
tempestuous wrote: Without a router, only one device can connect to the internet at the same time. Your Puppy computer grabs the IP address (10.184.92.x/22) so your Android phone cannot connect.
I can't understand in our scheme how bridge is working.
ISP -> Ethernet cable -> puppy laptop ( with internet access and 0.0.0.0 address) -> logical bridge with static 10.184.92.x/22 -> wifi without IP (?)

In such situation only ISP router may give me IP for wifi?
Is there a chance maybe to grant private IP to wifi and then make a route to the bridge?
May be use NAT somehow...
tempestuous wrote: Solution 2:
Buy a router!
I agree that it would be the easiest way :)

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#24 Post by tempestuous »

undorik wrote:ISP -> Ethernet cable -> puppy laptop ( with internet access and 0.0.0.0 address) -> logical bridge with static 10.184.92.x/22 -> wifi without IP (?)
Yes, that's correct.

undorik wrote:May be use NAT somehow...
Yes, that's effectively turning your Puppy computer into a router. Puppy would treat the ethernet interface as WAN (10.184.92.x), then create a separate LAN at the wifi interface (192.168.0.x). There are various HOWTO's on the internet, such as -
http://www.cyberciti.biz/tips/linux-as- ... e-etc.html
or you could maybe use a gui which I just found on the Puppy forum here -
http://www.murga-linux.com/puppy/viewtopic.php?t=37520
If you choose to go down this path, I think (??) that bridge-utilities becomes unnecessary, so you would probably need to comment-out the "bridge=br0" line in /etc/hostapd.conf

I still think a hardware router would be easier! A 10 year old Netgear router would do! I find these left out on the street!

Post Reply