Author Topic: SOLVED How do I share wifi internet with non-wifi machine?  (Read 2180 times)

Offline Jimbo

  • Full Member
  • ***
  • Posts: 134
Re: How do I share wifi internet with non-wifi machine?
« Reply #30 on: November 24, 2012, 06:56:08 PM »
Sorry, forgot the route -n bit! :-\

Output for that is:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.1.0.1        0.0.0.0         UG    10     0        0 eth0
10.0.0.0        0.0.0.0         255.0.0.0       U     10     0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
169.254.0.0     0.0.0.0         255.255.0.0     U     10     0        0 eth0

Will now do the other things you told me to and post again.  Your post said to do the route -n command on the desktop, but I'm guessing that the other commands apply to the laptop.  Please correct me if I'm wrong.

Offline Jimbo

  • Full Member
  • ***
  • Posts: 134
Re: How do I share wifi internet with non-wifi machine?
« Reply #31 on: November 24, 2012, 06:59:29 PM »
Output from the commands on the laptop is:

[root@localhost us]# echo 1 > /proc/sys/net/ipv4/ip_forward
[root@localhost us]# /sbin/iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
[root@localhost us]# iptables -t nat -L -v
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 1 packets, 153 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 RETURN     tcp  --  any    any     anywhere             anywhere            tcp dpt:http owner UID match squid

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    1   153 MASQUERADE  all  --  any    eth0    anywhere             anywhere           
    0     0 MASQUERADE  all  --  any    eth0    anywhere             anywhere   

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6208
Re: How do I share wifi internet with non-wifi machine?
« Reply #32 on: November 24, 2012, 07:29:07 PM »

yap,the "route" one on the desktop,the other on the laptop.

nothing seem to be wrong,the desktop should be able to go online if the laptop can.
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline Jimbo

  • Full Member
  • ***
  • Posts: 134
Re: How do I share wifi internet with non-wifi machine?
« Reply #33 on: November 24, 2012, 09:10:17 PM »
When the desktop first connected to the laptop it took a looong time for it to connect but when it did I got the connection
Icon in the system tray, but then Firefox would not connect to any website, until I reset the firewall.

That's where I seem to be at the moment, with the exception that it doesn't take a long time for the desktop to connect to the laptop.  I have tinkered with the firewall, but if Ramchu could explain what he meant by "reset the firewall" that may help.  How?  On which machine?  One or both?

In desperation I tried "Share the internet connection with other local machines" in PCC, but that consistently stops the laptop from accessing the internet, even though the netapplet says it's connected.  No pages load.  Only becomes available again when sharing is switched off.

Who would think that something that should be simple, and that I would think lots of people would want to do, would be so hard?

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6208
Re: How do I share wifi internet with non-wifi machine?
« Reply #34 on: November 24, 2012, 10:42:25 PM »
Who would think that something that should be simple, and that I would think lots of people would want to do, would be so hard?

I actually have this as one of those things i consider "trivial" and there are numerous posts i have done that explains exactly how to do it.Somebody at some point mentioned the GUI way so i laid back waiting for the GUI solution to be provided,but the GUI way seem to be broken.

Starting from afresh,this is how i would have said you should do:

On your laptop
1.Run these commands as root to allow traffic to flow btw the two interfaces you have
Quote
echo 1 > /proc/sys/net/ipv4/ip_forward
/sbin/iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE

You only need those two commands.
The first one configures the computer to allow traffic to flow from one interface to another.
The second one "hides" traffic from your desktop computer as it leaves your laptop on its way to your router.

The two commands above effectively make your laptop a router connected to two networks,192.168.1.0/24 and 10.10.10.0/24.The first command allows traffic to flow btw the two interfaces and the second one "hides" traffic from 10.10.10.0/24 when it travels to your router on its way to the internet.

on eth0.
This is the interface that takes you online,configure it to allow your laptop to go online and make sure you can go online.

on eth1.
This is the interface that will be facing your desktop.
Configure it to have the following network properties
IP address: 10.10.10.10
netmask:   255.255.255.0

If you configure it using PCC,ignore the error if complain about anything.

On your desktop.
Give the interface the following network properties
IP address: 10.10.10.20
netmask: 255.255.255.0
gateway: 10.10.10.10
DNS: 8.8.8.8

The above is all you need to do to go online from your desktop.If you can not,then either you are making mistakes or there is a configuration in your computer that is blocking something.I suspect the "reset" your firewall may refer to this.A firewall setting that is blocking something.

kjpetrie pretty much said the same thing,he just put his solution in a script.

Quote
Chain OUTPUT (policy ACCEPT 1 packets, 153 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 RETURN     tcp  --  any    any     anywhere             anywhere            tcp dpt:http owner UID match squid
The above line in your output is concerning.It basically redirects outgoing traffic back to the computer I assume because squid wants to do something with it.Squid is not necessary for what you are trying to do and it could be the source of the problem you are having.

The above may also explain why you cant go online when you set up network sharing.Your internet traffic is redirected back to your computer.
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline Jimbo

  • Full Member
  • ***
  • Posts: 134
Re: How do I share wifi internet with non-wifi machine?
« Reply #35 on: November 24, 2012, 11:17:27 PM »
And just like that - it works.  Perfectly. :D  No need to do anything with squid, firewall or anything.  Just entered what you said, and there I was, connected.
Wish I understood it, but am very, very, very happy.
Thank you very much indeed!!
Can this be made a sticky or a wiki or something?

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6208
Re: SOLVED How do I share wifi internet with non-wifi machine?
« Reply #36 on: November 24, 2012, 11:40:57 PM »

I once said i was going to write an article in the magazine about this but somebody suggested a "better GUI" way so i did not.I think i will write one this time and submit it since the GUI way doesnt seem to work consistently.
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6208
Re: SOLVED How do I share wifi internet with non-wifi machine?
« Reply #37 on: November 24, 2012, 11:46:43 PM »
If you want the changes to survive reboots, open "/etc/sysctl.conf" with a text editor as root and add the following line:
Quote
net.ipv4.ip_forward = 1
First make sure the line does not exist,if it does exist and the option is "0",change it to "1".

open the terminal and then run this command to save the IP table rule that masquerade your desktop computer traffic.

Quote
service iptables save

Now go to pcc services section and make sure "iptables" is set to start at boot time and you are good.
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline YouCanToo

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 5324
  • Location: Lebanon, OR., USA
    • Spreading the word.......
Re: How do I share wifi internet with non-wifi machine?
« Reply #38 on: November 25, 2012, 02:02:05 PM »
And just like that - it works.  Perfectly. :D  No need to do anything with squid, firewall or anything.  Just entered what you said, and there I was, connected.
Wish I understood it, but am very, very, very happy.
Thank you very much indeed!!
Can this be made a sticky or a wiki or something?

I will get it written up and put it in the wiki.




Be sure to visit the NEW Knowledge Base


Linux is user-friendly- it's just picky who its friends are!

Offline parnote

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 4439
  • The truth is out there ... PCLinuxOS!
Re: SOLVED How do I share wifi internet with non-wifi machine?
« Reply #39 on: November 26, 2012, 12:15:20 PM »

I once said i was going to write an article in the magazine about this but somebody suggested a "better GUI" way so i did not.I think i will write one this time and submit it since the GUI way doesnt seem to work consistently.

Yay, muungwana! I love it when you submit articles to the magazine! Seriously!
PCLinuxOS Magazine Chief Editor

Linux Registered User #485009

In a world without walls, who needs Windows?

PCLinuxOS Wiki: Contribute tips/tricks/how-to's!

Offline pclinmike

  • Hero Member
  • *****
  • Posts: 637
  • I Only 'Clean' Windows !.
Re: SOLVED How do I share wifi internet with non-wifi machine?
« Reply #40 on: January 18, 2013, 04:30:32 PM »

I once said i was going to write an article in the magazine about this but somebody suggested a "better GUI" way so i did not.I think i will write one this time and submit it since the GUI way doesnt seem to work consistently.

Yay, muungwana! I love it when you submit articles to the magazine! Seriously!

+1
Michael.
From South-Derbyshire, England.U.K.Earth.

I Normally Do A Search Before I Post A New Question !.

Thanks to all who replied to my posts.

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6208
Re: SOLVED How do I share wifi internet with non-wifi machine?
« Reply #41 on: January 18, 2013, 06:58:26 PM »

i already submitted the article
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline pclinmike

  • Hero Member
  • *****
  • Posts: 637
  • I Only 'Clean' Windows !.
Re: SOLVED How do I share wifi internet with non-wifi machine?
« Reply #42 on: January 19, 2013, 05:48:22 AM »
Michael.
From South-Derbyshire, England.U.K.Earth.

I Normally Do A Search Before I Post A New Question !.

Thanks to all who replied to my posts.