You are not logged in.

#1 2010-09-23 21:59:58

BaconPie
Member
Registered: 2010-08-11
Posts: 209

Sharing Ethernet connection over Wifi

I'm too far away from the router in this house to get a decent connection so I bought an Ethernet cable and am connecting that way. The only problem is that I also have a laptop and a phone which I SSH into a fair bit. Not only that but I'd like to get an internet connection working on both of them.

I followed this guide: http://jwalanta.blogspot.com/2010/02/in … cs-in.html

and ran the following commands:

$ sudo iwconfig wlan0 mode ad-hoc
$ sudo iwconfig wlan0 essid adhocwifi
$ sudo iwconfig wlan0 key 12g4dp7b
$ sudo ifconfig wlan0 192.168.0.1

Then on my phone I connected to my wifi network with the following settings:
IP Address: 192.168.0.2
Subnet Mask: 255.255.255.0
Router: 192.168.0.1 (It's an iPhone so this is actually the default gateway)
DNS: 8.8.8.8

and the option for 'Search Domains' I left blank.

I can ping my phone from my computer.

I then ran the following commands:

$ sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

The only problem now is, I can't get any internet on my phone. I tried www.google.com and that timed out. I also tried 173.194.37.104 in case it was a DNS thing, but still, timed out.

Anyone done this before? What am I doing wrong? (I'm totally new to this by the way)

Thanks

Offline

#2 2010-09-23 22:17:36

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Sharing Ethernet connection over Wifi

Offline

Board footer

Powered by FluxBB