Can't share Internet with Wifi
Hi everybody,
I've got 2 computers with Ubuntu Dapper installed on them. The first one is a desktop (PC1) connected to internet via ppp0 and has a Wifi PCI card. The second is a laptop (PC2) with a wifi integrated card. I want to share Internet using wifi. My /etc/network/interfaces on PC1 looks like this : ########################################## # The loopback network interface auto lo iface lo inet loopback auto wlan0 iface wlan0 inet static address 192.168.1.1 netmask 255.255.255.0 pre-up /sbin/iwpriv wlan0 wireless_mode Master wireless_channel 9 wireless-essid Home iface eth0 inet static address 192.168.2.1 netmask 255.255.255.0 auto eth0 ##################################### And the one on PC2 looks like this : ##################################### auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.2.2 netmask 255.255.255.0 gateway 192.168.2.1 #auto eth1 #iface eth1 inet dhcp #auto eth2 #iface eth2 inet dhcp auto ath0 iface ath0 inet static address 192.168.1.2 netmask 255.255.255.0 gateway 192.168.1.1 wireless_mode Managed wireless-essid Home ###################################### The command iwlist ath0 scan on the laptop detects the network, but when I try to ping one of the computers, it fails on both senses. I've desactivated all the firewalls, and the problem is still persistent. Can any one help me on that? Thank you! |
I would venture to say that you need to set up the internet connected pc as a nat router, with iptables.
|
If it is you who set the static ip address on both computers, I think they need to be both 192.168.1.X or both 192.168.2.X, not one 192.168.1.X and the other one 192.168.2.X.
|
Melsync :
The addresses are different because they are not the same. 192.168.1.x is for wireless and 192.168.2.x is for cable ethernet. I hope I'm not wrong on that... geden : Can you explain me more? I've copied this script (found in a tutorial) in /etc/network/if-pre-up.d/ But I thaught that it was useless. And I also wanted to remove iptables to be sure that there was no firewall blocking the ping. Is this script ok? (Sorry for the french comments) #!/bin/sh # /etc/network/if-pre-up.d/iptables-start # # Initialise les règles de filtrage iptables # D'après http://people.via.ecp.fr/~alexis/for...ables-start.sh ##### # Remise à zéro des règles iptables -F iptables -t nat -F # # Politiques par défaut # ##### # Accepte les connexions entrantes iptables -P INPUT ACCEPT # Accepte les connexions destinées à être forwardées iptables -P FORWARD ACCEPT # Accepte les connexions sortantes iptables -P OUTPUT ACCEPT # # Règles de filtrage # ##### # Pas de filtrage iptables -A INPUT -j ACCEPT # # Règles pour le partage de connexion (le NAT) # ##### # Le système fait serveur NAT ; l'interface extérieure est ppp0 iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE # Si la connexion que vous partagez est une connexion ADSL, vous # serez probablement confronté au fameux problème du MTU. En résumé, # le problème vient du fait que le MTU de la liaison entre votre # fournisseur d'accès et le serveur NAT est un petit peu inférieur au # MTU de la liaison Ethernet qui relie le serveur NAT aux machines qui # sont derrière le NAT. Pour résoudre ce problème : iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS -o ppp0 --clamp-mss-to-pmtu # # Règles de port forwarding # ##### # Décommentez la ligne suivante pour que les requêtes TCP reçues sur # le port 80 de l'interface eth0 soient forwardées à la machine dont # l'IP est 192.168.0.3 sur son port 80 (la réponse à la requête sera # forwardée au client) #iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination 192.168.0.3:80 |
Quote:
Try Quote:
|
Melsync :
I think that the addresses are not the problem.. I've changed them but still not working. Can anyone tell me if the architecture adopted is right? A computer connected to the Internet as "Master" and the laptop as "Managed". Is there a way to know if my PCI Wifi card can act as a Master? Thank you! |
All times are GMT -5. The time now is 07:00 AM. |