📜 ⬆️ ⬇️

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

image
I bought myself on the occasion of the iPod Touch 2G. Not a bad toy, well, I will not once again sing the praises of Apple products, this is already commonplace :) The fact is that I couldn’t manage to distribute the Internet via wi-fi for him for a long time, I had to steam with the iTunes setting on a virtual machine under VirtualBox. Now, finally, the problem is solved. So let's go!

Preparation of the bridgehead

So, I have a laptop with internet configured via xl2tpd . A setup guide can be taken, for example, from here .
In order for the Internet to be heard, it is necessary to add several lines to the start section of the activation script of the /etc/init.d/xl2tpd connection (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 the NAT and organize the distribution of the Internet. Instead of these commands, if you wish, 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 an Intel Corporation PRO / Wireless 3945ABG wi-fi adapter in my laptop, which is normally determined by the ubuntu and does not require tambourine tricks when setting up. The interface is wlan0 .
')
Now we’ll pound the whole thing for convenience in / etc / network / interfaces (the channel will be fixed at boot time):
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):

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


Everything is fine, only you have to manually register IPs. Fix this annoying misstep:

$sudo apt-get install dhcp3-server

Open the / etc / default / dhcp3-server file and push the necessary interface there:

INTERFACES="wlan0"

And finally:

sudo gedit /etc/dhcp3/dhcpd.conf

It looks like this to me:
ddns-update-style ad-hoc;
default-lease-time 3600;
max-lease-time 9000;
authoritative;
log facility local7;

#DNS server internet provider.
option domain-name-servers 213.234.192.8, 85.21.192.3;

# description of the subnet in which we will issue 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 run:

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

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

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

If someone helped - I will be glad. Criticism, too, always listen and consider :) Thank you for your attention.

Source: https://habr.com/ru/post/57589/


All Articles