Author Topic: Internet Sharing  (Read 1600 times)

Offline pclinmike

  • Hero Member
  • *****
  • Posts: 638
  • I Only 'Clean' Windows !.
Internet Sharing
« on: January 19, 2013, 06:31:24 AM »
Edit...# uname -a
Linux localhost.localdomain 2.6.38.8-pclos3.bfs #1 SMP PREEMPT Fri Jul 8 18:01:30 CDT 2011 i686 i686 i386 GNU/Linux
Edit...
update.
Put the latest kernel in
# uname -a
Linux localhost.localdomain 3.2.18-pclos1.bfs #1 SMP PREEMPT Tue May 22 04:05:24 CEST 2012 i686 i686 i386 GNU/Linux
Fully Updated KDE System
-------------------------------------------------------------------------------------------------------------------------------------

Having read lots of posts I still cannot get this to work !.

The aim is to set a system up for my daughter at uni to share the internet from her 'Ethernet' connected laptop to her 'iphone' via 'wifi' in her room and no one else !.

So I'm setting up at home a test to sort out the system and when it's ready set her laptop up from home via 'Teamviewer'

The set up using her old 'Acer' laptop connected to the internet via an 'Ethernet Rj45 cable' = eth0

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1F:16:A9:AA:4B  
          inet addr:192.168.0.164  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1901 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2097 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:865125 (844.8 KiB)  TX bytes:302154 (295.0 KiB)
          Interrupt:16

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:100 (100.0 b)  TX bytes:100 (100.0 b)

wlan0     Link encap:Ethernet  HWaddr 00:24:2C:A2:73:7B  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
---------------------------------------------------------------------------------------------

The laptop wireless card (to act as an 'Access Point' to re-transmit the internet ) = wlan0


# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11bgn  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated  Tx-Power=17 dBm  
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          
-----------------------------------------------------------------------------------------------

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     5      0        0 eth0
link-local      *               255.255.0.0     U     5      0        0 eth0
default         smoothwall-fire 0.0.0.0         UG    5      0        0 eth0

------------------------------------------------------------------------------------------------

In my setup test I'm trying to pick up the 'Wifi' from the laptop on a usb dongle connected to a test machine.

I can get on the internet on the laptop OK but the laptop in not sending out a 'ssid' so I cannot connect to it.

I have configured PCC> Security and >Internet-sharing.

I can not see any place to configure the 'Access point' ssid , security key eg 'wpa-psk' ip address etc.

Can 'iwconfig' be used to configure above ?.

Or the /etc/wlan file settings ?.

Any help please.

Edit... Note that I have the firewall 'On' and a 'ssh' port open in the firewall on the laptop for an automatic backup system.

Just installed 'hostapd'  trying to follow..http://www.pclinuxos.com/forum/index.php/topic,91991.0.html

Part of
# iw list
Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * WDS
                 * monitor
                 * mesh point
                 * Unknown mode 8
                 * Unknown mode 9

# /usr/sbin/hostapd  /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Line 15: invalid/unknown driver 'nl80211'
1 errors found in configuration file '/etc/hostapd/hostapd.conf'
« Last Edit: January 25, 2013, 09:59:01 AM by pclinmike »
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 pclinmike

  • Hero Member
  • *****
  • Posts: 638
  • I Only 'Clean' Windows !.
Re: Internet Sharing
« Reply #1 on: January 19, 2013, 06:55:28 PM »
update.
Put the latest kernel in
# uname -a
Linux localhost.localdomain 3.2.18-pclos1.bfs #1 SMP PREEMPT Tue May 22 04:05:24 CEST 2012 i686 i686 i386 GNU/Linux

But still get this error
#  /usr/sbin/hostapd  /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Line 15: invalid/unknown driver 'nl80211'
1 errors found in configuration file '/etc/hostapd/hostapd.conf'

Did a 'google' search for above error and found lots of people having same problems but no answers.
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 Yankee

  • Hero Member
  • *****
  • Posts: 1514
  • In theory, theory=practice, in practice ???
Re: Internet Sharing
« Reply #2 on: January 19, 2013, 07:09:20 PM »
The aim is to set a system up for my daughter at uni to share the internet from her 'Ethernet' connected laptop to her 'iphone' via 'wifi' in her room and no one else !.

I don't think that's possible.

An internet gateway usually requires the signal to
proceed from the gateway, not the laptop.   Can't
do 2 things at once.

My gateway could do this whole building, but the
recipients would have to be configure thru the gateway.
ASUS EeePc 900HA netbook  1.6 Ghz Atom CPU  1GB RAM
160 GB internal HD    Seagate 250 GB USB portable drive 
Intel ‎Mobile 945GSE Integrated Graphics Controller
Atheros AR242x/AR542x Wireless Network Adapter
Intel (N10/ICH7 Family) High Definition Audio
Dynex 5-Button Wired Optical Mouse
LXDE

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6266
Re: Internet Sharing
« Reply #3 on: January 19, 2013, 08:09:52 PM »

i am the guy who set up that howto.From what i remember, the "hostapd" package in the repository did not have "nl80211" driver build in and i had to build the program from source to have the driver.I made a package request at the same time to have the build rebuild with the driver but it looks like that didnt happen as you dont seem to have it.
.. 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: 6266
Re: Internet Sharing
« Reply #4 on: January 19, 2013, 08:19:54 PM »
The aim is to set a system up for my daughter at uni to share the internet from her 'Ethernet' connected laptop to her 'iphone' via 'wifi' in her room and no one else !.

I don't think that's possible.


Its possible and i have done it,twice.

At one point,i had the same setup he wants.My computer had a wired interface connected to the router and a wireless one and i set it up so that other computers could connect to my computer over the wireless interface and go online through it.

At another point,i had two wireless interfaces and i got internet from one interface and rebroadcast it through the second wireless interface using instructions in the link provided.

Possibilities are endless once you understand the basics of how things work  :D
.. 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 Yankee

  • Hero Member
  • *****
  • Posts: 1514
  • In theory, theory=practice, in practice ???
Re: Internet Sharing
« Reply #5 on: January 20, 2013, 10:51:14 AM »
and i set it up so that other computers could connect to my computer over the wireless interface and go online through it.

I didn't know there was software that could do that, an internet gateway
becoming a full wireless network hub.   Have to see it once I guess.

I couldn't hook up an iPhone to it today, but could have over 200 computers
wirelessly logged in at the same time.

thanks for the response.

Y
ASUS EeePc 900HA netbook  1.6 Ghz Atom CPU  1GB RAM
160 GB internal HD    Seagate 250 GB USB portable drive 
Intel ‎Mobile 945GSE Integrated Graphics Controller
Atheros AR242x/AR542x Wireless Network Adapter
Intel (N10/ICH7 Family) High Definition Audio
Dynex 5-Button Wired Optical Mouse
LXDE

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6266
Re: Internet Sharing
« Reply #6 on: January 20, 2013, 11:19:54 AM »

Yankee, can you clarify?
are you saying you managed to have hostapd going and other computers expect the iphone could connect to it?

start hostapd from the command and its logs should be informative on why the iphone failed
.. 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 Yankee

  • Hero Member
  • *****
  • Posts: 1514
  • In theory, theory=practice, in practice ???
Re: Internet Sharing
« Reply #7 on: January 20, 2013, 04:25:33 PM »

Yankee, can you clarify?
are you saying you managed to have hostapd going and other computers expect the iphone could connect to it?

start hostapd from the command and its logs should be informative on why the iphone failed

No, I haven't tried it.   I'm confusing an internet gateway with what looks like
wireless network software.   A iPhone should need a cell phone signal.

I'll try hostapd next time I need something like that.

thanks for the response and info.


Y
ASUS EeePc 900HA netbook  1.6 Ghz Atom CPU  1GB RAM
160 GB internal HD    Seagate 250 GB USB portable drive 
Intel ‎Mobile 945GSE Integrated Graphics Controller
Atheros AR242x/AR542x Wireless Network Adapter
Intel (N10/ICH7 Family) High Definition Audio
Dynex 5-Button Wired Optical Mouse
LXDE

Offline pclinmike

  • Hero Member
  • *****
  • Posts: 638
  • I Only 'Clean' Windows !.
Re: Internet Sharing
« Reply #8 on: January 20, 2013, 05:48:49 PM »
@ yankee My system uses basic networking systems as long as you have at least two network cards in your machine computer, you can use one to connect to the network/internet and use the other to re-distribute it to another network/internet connection.
In my case I'm using the 'Ethernet' connection to receive the internet and it's re-distributed from the WiFi card and it will have a security key to enter on the iPhone when it connects to the WiFi signal from the laptop (else 800 other students will be using it ).

I Have Had The System Working  ;D on a test machine using the internet sharing from the laptop, so I know it will work.

 I did not use 'hostapd' to configure the WiFi card Because we still do not seem to have the correct drivers yet in PCLinux  >:(

I used 'iwconfig to set up the wireless card.
« Last Edit: February 01, 2013, 07:07:45 PM by pclinmike »
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 Yankee

  • Hero Member
  • *****
  • Posts: 1514
  • In theory, theory=practice, in practice ???
Re: Internet Sharing
« Reply #9 on: January 22, 2013, 04:54:36 PM »
I wonder what you call that type of network configuration.
Peer-to-peer ?
ASUS EeePc 900HA netbook  1.6 Ghz Atom CPU  1GB RAM
160 GB internal HD    Seagate 250 GB USB portable drive 
Intel ‎Mobile 945GSE Integrated Graphics Controller
Atheros AR242x/AR542x Wireless Network Adapter
Intel (N10/ICH7 Family) High Definition Audio
Dynex 5-Button Wired Optical Mouse
LXDE

Offline pclinmike

  • Hero Member
  • *****
  • Posts: 638
  • I Only 'Clean' Windows !.
Re: Internet Sharing
« Reply #10 on: January 23, 2013, 04:20:04 AM »
I wonder what you call that type of network configuration.
Peer-to-peer ?


http://en.wikipedia.org/wiki/Peer-to-peer
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 kjpetrie

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 4035
Re: Internet Sharing
« Reply #11 on: January 23, 2013, 05:10:49 AM »
If I understand correctly, she has a wired router without wifi and you therefore want to use her laptop as a second router with wifi to broadcast a signal for her smart phone. Is that right? In that case, you don't need any special applications or drivers because the necessary functionality is already in the kernel. The Linux kernel contains routing software which is controlled by iptables. I believe it can even filter by MAC code, thus restricting access to the one device. Read up about iptables and using it for packet forwarding. You will eventually need to write a script to start the forwarding on every boot or put it into the appropriate firewall rules configuration file. (Sorry, I'm a bit hazy about that, but if you read around you'll find what you need.)
-----------
KJP
-----------------------------------------------------------
PClos64 RC1 on Intel D945GCLF2 motherboard (Atom 330), 2GB DDR2 RAM, Maxtor STM325031, HL-DT-ST DVDRAM GSA-H42N, Amilo LSL 3220T monitor. Also Acer 5810TG (with custom kernel) and Asus eeePC 2G surf

Offline pclinmike

  • Hero Member
  • *****
  • Posts: 638
  • I Only 'Clean' Windows !.
Re: Internet Sharing
« Reply #12 on: January 23, 2013, 06:07:48 AM »
My daughter in her private halls of residents has only a RJ45 Ethernet connection from the halls network system (WiFi signal from the uni is poor in the halls as with the cellular network or mobile network for her phone) .

So >Ethernet>eth0> laptop> Ad-Hoc network settings to WiFi wireless card (plus setting up Firewall first and internet sharing in PCC ) > WiFi acts as an Access Point to re-send out the internet WiFi signal to her iPhone.

I'm still testing this out at home on my 'test' machines and her old laptop, I have removed 'Hostapd' and 'MadWiFi' I had installed via 'Synaptic', using a 'Terminal' I have been using 'iwconfig' to configure the wireless card and I will put more detail on at a later date.

Also in a Terminal su to root/password, use these commands to set up 'iptables'     (Firewall)

echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE  


service iptables save
service iptables restart


To check
chkconfig --list iptables
 iptables -L


see  ...  http://linuxconfig.org/collection-of-basic-linux-firewall-iptables-rules
Because I do not have an 'iPhone' to help with my testing I use a Usb WiFi dongle to pick up the WiFi signal on a test machine across the room and can surf the internet ok.

I may just use a WPA-PSK key instead of the phones 'Mac' code as I will be setting this up for her at arms length via 'Teamviewer'
« Last Edit: January 24, 2013, 10:06:54 AM by pclinmike »
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 pclinmike

  • Hero Member
  • *****
  • Posts: 638
  • I Only 'Clean' Windows !.
Re: Internet Sharing
« Reply #13 on: January 24, 2013, 02:22:13 PM »
The 'iPtables' Changes Do Not Seem To Be Surviving A Re-Boot :(
I use
# echo 1 > /proc/sys/net/ipv4/ip_forward
# iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE  

# service iptables save
Saving current rules to /etc/sysconfig/iptables:                                                                    
# service iptables restart
Applying iptables firewall rules:
#

What am I doing wrong having never done this before !
« Last Edit: January 24, 2013, 02:25:11 PM by pclinmike »
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.

AndrzejL

  • Guest
Re: Internet Sharing
« Reply #14 on: January 24, 2013, 03:03:59 PM »
Internet connection sharing is super simple:

Quote
Internet Connection Sharing

PCLinuxOS can be set up as a DHCP server / router using PCLinuxOS's Control Center (PCC). The following is a brief summary of how I did it; hopefully as time permits this this can be expanded to include more details and screenshots.

   1. Open PCC and delete all network interfaces to be sure that we are not using with old configurations.
   2. Connect one ethernet card (eth0) on your PCLOS DHCP server / router box directly to your internet modem and configure the connection; this can also be a ppp style usb connection commonly used for cellular and dsl modems. Don't move on until you have a working connection to the internet.
   3. Next use PCC to set up the personal firewall; at the last dialog box, make sure it is set to only protect the internet facing connection (eth0 or ppp0 in this example); other non internet facing interfaces should be unchecked in the last firwall configuration dialog so that the firewall allows them to be used for internet connection sharing (ICS). Having at least one protected and one unprotected interface will force a shorewall configuration that allows for ICS to be set up using PCC. If this is not configured correctly you will get an error from PCC's ICS wizard about netowrk interfaces not being configured properly.
   4. Back at PCC again, use the 'share internet connection' wizard to configure ICS.. make sure to select eth1, or your LAN facing network card to use for ICS; default settings should work just fine, but toward the end of the configuration wizard I did un-check the box for setting up a caching proxy server (squid) to keep the setup uncomplicated.
   5. Make sure there are not any other DHCP servers on the same local network.. either unplug your existing router if you have one, or turn off it's DHPC server from it's configuration page.
   6. Assuming your LAN facing connection is connected to a switch with other PC's, now go to the other PCs on the local network and reset their network connections so that they will now pick up new IP's from your PCLOS DHCP server.

Thats it.. it worked for me! ..if you set up the personal firewall to include intrusion detection, port scanning, etc you will get pop-up notifications and logging provided by the default network monitor in the task bar. ..head on over to the Shields-up website and initiate a port scan of your system and see how it fairs!


Been using this method for years.

3G USB dongle is my ppp0 internet facing device,

eth0 is my LAN facing device.

ppp0 is on dhcp from my ISP (there is no way this could be changed)

eth0 is set during the sharing process to be 192.168.0.1

It's setup (192.168.0.1) to be my DNS server (bind is needed and will be installed during process of setup) and no dhcp is used.

All clients are static IP 192.168.0.10x 255.255.255.0 gateway 192.168.0.1 dns 192.168.0.1)

I am using dns caching for bind described on this forum to speed up requests

I am using squid with my own config file http://pastebin.com/cJw4Ldec to allow transparent proxy (again on 192.168.0.1) on port 3128 and non-transparent (configurable in clients) on 3129...

My eth0 is rj45eted to my Linksys router which is setup to forward the network requests (bridge mode only) and is configured as 192.168.0.2 255.255.255.0 gateway 192.168.0.1 dns 192.168.0.1 and to the router I am plugging in via rj45 (or wireless network) my client machines and configuring (as mentioned above) to be static IP (makes the things soooo much easier...)

Simple...

The only thing I find challenging in your config is to turn the wifi card into accesspoint but it should be simple too.

http://guzik.net.pl/blog/2012/09/archlinux-jako-bezprzewodowy-router/

I know that the language barrier can be a difficulty with the link above but then google translate can help and beside this You can see commands and paths to files and you can take note of the app used to start the accesspoint which I hope can be (or at least should be) in the repo.

Edit: just to make things easier:

He is using app called "hostapd"

and this is his conf:

Code: [Select]
/etc/hostapd/hostapd.conf
Code: [Select]
interface=wlan0
driver=nl80211
ssid=NameOfTheNetworkYouWant
country_code=PL
wpa=2
wpa_passphrase=PasswordToTheNetwork

Change the country_code, interface and ssid and wpa_passphrase to reflect Your needs.

He mentions that the rest of the settings can be left as default.

So You got all You need. Have fun and good luck.

Regards.

Andrzej
« Last Edit: January 24, 2013, 03:37:05 PM by AndrzejL »