domenica 10 ottobre 2010

Come condividere internet con altri computer linux


Visto che abito in un condominio in città vivo immerso nelle onde elettromagnetiche di una trentina di  reti wirelles il che mi porta a riflettere sull'insensatezza della cosa.
Al di la degli effetti sulla salute mi sembra poco sensato pagare 10 reti in 10 invece che pagarne in 10 una. A meno di non essere fanatici del download.... e salvo trovare il tempo per poi utilizzare tutto quello che si è scaricato, di non essere disoccupati ed analfabeti, o avere una banda ridicola, per gli usi più comuni, navigare, scaricare la posta e chattare, una rete condivisa basta ed avanza. 

Io in casa non ho linea telefonica,  e quindi non vale la pena stipulare un contratto per l'adsl,  le reti hg3 sono ancora troppo costose per i miei gusti e sopratutto non possono essere utilizzate da più persone contemporaneamente (se siamo in 2 bisogna fare a turno).
Una buona soluzione sarebbe condividere le spese di una delle 30 reti che ho interno, almeno 5 con un livello di segnale alto. 
Per quanto sembri incredibile non ci sono ancora riuscito, perchè i vicini contattati non hanno voluto, e di alcune reti con buon segnale non ho ancora trovato il proprietario. 

In compenso c'è una rete libera senza password molto molto debole a cui riesco a connettermi solo affacciato alla finestra e non sempre, ma quando ci riesco va più che bene per scaricare la posta e dare un occhio al sito di repubblica....
Unico neo la scomodità della posizione... ed il freddo. Visto che ho un vecchio desktop, residuato degli esperimenti di gioventù, abituato al "tuning" spinto con con un paio di schede di rete ed una wirelles pci,  in un momento di follia d'arredamento ho spostato il fisso sotto la finestra ed ho lasciato penzolare fuori l'antenna per un 50cm con grande beneficio del segnale.... 
Ovvio che stare accovacciati sotto la finstra a scrivere con la tastiera sulle ginocchia non è il massimo e visto che sia la scheda di rete del e6400 sia quella del desktop sono duplex mi sono chiesto se fosse possibile utilizzare la connessione del desktop sul mio laptop.
Detto fatto google "share wifi desktop laptop ubuntu 10.04 -windows" e dopo alcuni minuti di ricerca ecco il post giusto semplice e corredato da foto.

Lo quoto tutto per timore che lo rimuovano, ma per il momento lo trovate qui su linuxers humans and aliens l'autore è shredder12 che ringrazio.


How to share Internet with other computers in Linux


This is a common issue among all the computer users. I read a lot of how tos and tutorials available on Internet and finally came up with the following tutorial. This was performed on a system running Ubuntu 9.04 but similar steps (with some modification) can be taken to do the same on different distros.
In my case, I wanted to share connection between my Laptop and Desktop. The Laptop accessed Internet through wireless on eth1 interface and I shared it with the Desktop by creating a small wired network.

Installation

Perform the following steps on the computer which has access to Internet.
1. Open a terminal (Applications -> Accessories -> Terminal) and type the following commands to install a dhcp3-server and firestarter.
[shredder12]$ sudo apt-get install dhcp3-server firestarter
 dhcp3-server is the package to create a dhcp server on the machine
 Firestarter is a program with graphical frontend to manage your firewall.
[shredder12]$ sudo gedit /etc/default/dhcp3-server 
2. Change the line 
INTERFACES=""
to,
INTERFACES="eth0"
I used eth0 because I wanted to provide connection to every machine connected to the main computer through this interface. 
3. Now, we need to create a connection on eth0 interface. Go to System -> Preferences -> Network Connections (in other distros this can be done using network manager or wicd). Then click on the "add" button. Assign a name of your choice to this connection.
4. Check the option of "connect automatically" then click the IPv4 settings tab and select the manual method. Use these network settings.
Address: 10.0.0.1
Netmask: 255.255.255.0
Gateway: 0.0.0.0
and check the option "available to all users" ( in case you have more than one user).
So, our dhcp server is configure and now we need to configure our firewall using Firestarter.
5. Go to Applications->Internet->Firestarter
You will be prompted for password (enter it). Click on the preferences and select the network settings.
Look at the image and do a similar configuration in your firestarter.
Choose the interface which provides you internet access (for me its eth1) and the one through which you want to share Internet (for me its eth0) and fill them accordingly.
Use a similar configuration as shown in the image, in your firestarter.
Now, to check if your dhcp server is working properly enable the firewall. If the status of Firestarter changes to active this means things are working properly.

Points to be considered

1. So, Now whenever you want to start your jst do
[shredder12]$  sudo /etc/init.d/dhcp3-server restart
even though it will be restarted automatically at boot up.
2.  All the other machines for whom our computer is acting as a gateway will be on a completely different subnet from ours. If you don't want this then you should be look for bridging.
3. In order to activate the connection we need to connect to the eth0 network ( in our case it is "shared internet connection"), one can do this by left clicking on the network manager icon on the right top corner of the display and choosing the option.
4. "shared internet connection" is not the default connection. If you haven't changed that setting already then the default connection should be auto eth0. 
P.S.: This how to was written considering the system to be ubuntu 9.04 but similar steps can be taken (with slight modifications) to do the same on any linux based system.

Nessun commento:

Posta un commento