Configuring the distribution of l2tp Internet in Ubuntu via wi-fi for iPhone and iPod Touch

    image
    I bought myself on the occasion of iPod Touch 2G. Such a good toy, well, I won’t sing praises of Apple products once again, it’s banal :) The thing is, I didn’t manage to set up wi-fi Internet distribution for him for a long time, I had to take a steam bath with iTunes setup on a virtual machine under VirtualBox. Now, finally, the problem is resolved. So let's go!

    Bridgehead preparation

    So, I have a laptop with internet configured through xl2tpd . The configuration guide can be taken, for example, from here .
    In order for the Internet to be distributed, you need to add in the start section of the connection activation script /etc/init.d/xl2tpd several lines (after adding routes via route -n ):
    echo 1> / proc / sys / net / ipv4 / ip_forward
    iptables -F
    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    iptables -t nat -I POSTROUTING -o ppp0 -j MASQUERADE
    iptables -I FORWARD -p tcp - -tcp-flags SYN, RST SYN -j TCPMSS --clamp-mss-to-pmtu

    Here eth0 is an interface that looks to the Internet. The iptables commands described raise NAT and organize the distribution of the Internet. Instead of these commands, if desired, you can install and configure the firehol package, it is somewhat easier to understand.
    Now install the wireless-tools:

    $sudo apt-get install wireless-tools

    I have a wi-fi adapter Intel Corporation PRO / Wireless 3945ABG in my laptop , which is normally detected by ubuntu and does not require dancing with a tambourine when setting up. The interface is wlan0 .

    Now we will pound this whole thing for convenience in / etc / network / interfaces (the channel will be suspended at boot):
    auto wlan0
    iface wlan0 inet static
    address 192.168.0.1
    netmask 255.255.255.0
    wireless-mode ad-hoc
    wireless-channel 1
    wireless-rate auto
    wireless-essid BigBrother

    Well, you can already act (if you are too lazy to reboot): Everything is fine, but I have to register IPs manually. Let's fix this annoying oversight: Open the file / etc / default / dhcp3-server and put the necessary interface there: Well, and finally: It looks like this for me:

    $sudo ifconfig wlan0 up
    $sudo iwconfig wlan0 mode ad-hoc channel 1 essid BigBrother




    $sudo apt-get install dhcp3-server



    INTERFACES="wlan0"



    sudo gedit /etc/dhcp3/dhcpd.conf


    ddns-update-style ad-hoc;
    default-lease-time 3600;
    max-lease-time 9000;
    authoritative;
    log-facility local7;

    #DNS server of the Internet provider.
    option domain-name-servers 213.234.192.8, 85.21.192.3;

    # description of the subnet in which we will issue the addresses
    subnet 192.168.0.0 netmask 255.255.255.0 {
    range 192.168.0.2 192.168.0.255;
    option routers 192.168.0.1;
    option broadcast-address 192.168.0.0;
    }

    Now you can start:

    $sudo /etc/init.d/dhcp3-server restart

    Sometimes the DHCP server may give an error at startup - then try manually creating an empty folder / etc / ltsp , it helps sometimes. In any case, the panacea is rebooting.

    Now you can try searching the network on your iPod - in the Settings -> Wi-Fi section. If our network with the name "BigBrother" is not visible - restart the iPod. We are connected - and voila! The Internet is heard with a bang.

    If anyone helped, I will be glad. I also always listen to criticism and consider :) Thank you for your attention.

    Also popular now: