Internet sharing in Ubuntu using an access point

Internet sharing in Ubuntu

Hi,
these days I had to deal with an interesting network configuration, where I wanted to share the internet conection between a computer and a laptop using an access point and two classic network cards. Both, the PC and the laptop are using Ubuntu!

Let start with the internet provider. The connection to the internet was made through a PPP connection, wich I managed to establish and save, using the pppoeconfig tool, as you can see in the picture above.

The access point was the next thing I configured. I set it to ask a password when connecting to the wireless network, and next, to manage it’s clients IP addresses using DHCP. Then I restarted the AP.

I set the eth1 to take it’s IP address from DHCP, and reconnected the the cable between eth1 and AP.

I verified the laptop, and it found now my wireless network. I successfully connected to the AP on my laptop. But, I had no connection to the internet, although the pings between my Ubuntu boxes were working.

I reconfigured the DHCP settings with the DNS from PC’s /etc/resolv.conf and rechecked default gateway to PC’s IP address. Still no internet connection on laptop.

I start googling, and I must say that so far, nor this or even this articles helped me out much. But, I found this article on our Romanian Ubuntu and Kiwi Forums, witch somehow suited my needs.

I wrote the file with the iptables configuration and added it to /etc/network/interfaces. I also launched #echo 1 > /proc/sys/net/ipv4/ip_forward and added the line net.ipv4.ip_forward = 1 to /etc/sysctl.conf.

I rebooted both machines, and the AP.
Now, the moment of truth! I gained Internet connection on my laptop, but only partially!!!
This means that I can access only some websites, and can connect only to limited hosts. More than that, the old websites sometimes are not accessible as been before!
If anyone can offer us a better solution, I would gladly try it and post here the updates!
Thank you in advance.

Updates:
After a chat with Cristi, he gave me the idea to make an intermediate DNS server between the AP and it’s clients. So I’ve installed dnsmasq on the PC, and changed AP DNS server settings to use the PC IP address.
Guess what? We finally obtained a full featured network with Internet connection between its workstations!!!

P.S.: Credits go to Cristi and Sebastian Ivan!

5 thoughts on “Internet sharing in Ubuntu using an access point

  1. Well, I thought It will be fun, as you mentioned already…
    And btw, we installed two ubuntu on two pc, and made those desktops look like on a mac… That rocks =]
    w00t!

  2. Am si eu o intrebare
    am 31 de ani, experienta de user desktop pe linux.
    am un router Linksys WRT54GL (linux)
    doua computere pe linux Ubuntu 8.04
    am facut reteaua pe Samba, dar depind de legatura la RDS, daca cade… cele doua computere de pe LAN local nu se mai vad. cum pot face ca prin router ele sa se vada in continuare? adica sa nu depinda LAN-ul neaparat de WAN? Se poate? sau trebuie sa le mai pun la fiecare cate o placa de retea si sa le leg direct?

  3. Eu nu m-am prins care-i arhitectura retelei pe care o aveti.
    Adica ii WAN (RDS)->Router(AP)->PC-uri ?
    Daca e asa, atunci folositi un PC(ii zicem master) cu 2 placi la fel cum am in poza, la care conectati Routerul si ala va fi si server DHCP. Routerul va routa tot traficul prin master care va face parte si el din reteaua locala.

    Nu trebuie sa aveti treaba cu SAMBA, acesta e doar un server pentru partajare fisiere retea. Ce-i important e configurarea router-ului corect!

    Bafta!

Lasă un răspuns

Adresa ta de email nu va fi publicată. Câmpurile necesare sunt marcate *

*

Poți folosi aceste etichete HTML și atribute: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>