3porxy IPv4 to IPv6

Стоит задача настроить http proxy с рандомной выдачей IPv6 адресов каждому пользователю. Использовать будем 3proxy

Шаг 1. Подготавливаем сервер и обновляем ядро:

После установки debian jessie8 установится с 3-м ядром, в котором нет требуемой опции bind().
Обновление ядра требуется для установки net.ipv6.ip_nonlocal_bind = 1 которую мы сделаем на следующем шаге.
Эта опция доступна начиная с ядра 4.3

Добавим бэкпорты в репозиторий

И выполним команду

Найдем требуемое ядро.

Обновление ядра для IPv6 прокси
Установим 4.5 ядро

Перезагрузим сервер

После перезагрузки проверяем, что ядро обновилось

Проверка версии ядра для настройки прокси IPv6

Шаг 2. Скачиваем и компилируем последнюю версию ndppd
ndppd это NDP Proxy Daemon. Более подробно об этом протоколе можно почитать в этой статье или же на странице ndppd

Создаем конфигурационный файл в любимом текстовом редакторе, например mcedt:

Конфигурация

Запускаем:

Шаг 3. На следующем этапе скачиваем и устанавливаем 3proxy

Шаг 4. Создаем файл ip.list с нужным количеством ipv6 адресов сгенерированных в случайном порядке.

Для этого скачиваем скрипт генерации файла ip.list

Для сети с маской /48

Для сети с маской /64

В скрипте устанавливаем:

Количество ipv6 адресов которые нужно сгенерировать:
MAXCOUNT=1000

Префикс нашей сети

network=2a07:14c0:0:8006

Устанавливаем права на выполнение

Генерируем список ipv6 адресов в файл ip.list

Шаг 5. Создаем конфигурационный файл 3proxy с помощью скрипта генерации конфигурационного файла 3proxy.

Прокси с одним пользователем и разные ipv6 адреса каждый на своем порте. Начиная с порта 30000 для каждого адреса из ip.list будет установлен свой порт.

Создаем конфигурационный файл и запускаем 3proxy

Шаг 8.Изменения в конфигурацию ядра, файл /etc/sysctl.conf

Применить изменения

Шаг 9. Настройка сети

Добавить адрес на eth0
ip -6 addr add 2a08:14c0:100:200::2/64 dev eth0

Добавить маршрут по умолчанию на etho

И прикрепить нашу сеть к lo

Все, прокси работает. Для проверки можно в браузере настроить работу с прокси
Адреса 185.118.66.204:30001-31000

Шаг 10. Добавление в автозагрузку
Файл /etc/rc.local приведите к виду

Узнать DUID

Тестирование IPv6

How to configure the DHCPv6 client

We will use dhclient.

You’ll need to edit the following file /etc/dhcp/dhclient6.conf :

You will have to adapt the interface name (eth0) and the DUID, available in your console.
Start your DHCPv6 client at boot

Once the client is configured, you’ll need to create a new SystemD service.

Create the following file, adapting the interface name (eth0) and the DUID /etc/systemd/system/dhclient.service:

Then, enable it for every reboot: systemctl enable dhclient.service.
Configure the Network on Ubuntu 16 & Debian 8

The following commands have to be used as root or with sudo

Start by editing /etc/network/interfaces as follow:

You’ll need to replace eno1 with the proper interface name.
With Debian & old versions of Ubuntu, it’s usually eth0.
Alternate configuration without SystemD

If you don’t use SystemD to start your services, you can configure your /etc/network/interfaces as follow:

Still adapting your interface name (eno1) to your needs, as well as the IPv6 address and the Netmask.
Configure the Network on CentOS 7

The following commands have to be used as root or with sudo

After configuring your dhclient and SystemD, you’ll need to edit /etc/sysconfig/network-scripts/ifcfg-eth0:

Once done with the configuration, you can reboot your server to check that the service & the configuration are correctly applied at the boot!

You will need to allow in your firewall 546/UDP Incoming & 547/UDP Outgoing.

Test your configuration

Launch the dhclient with the following command:

To check your IPv6 connectivity, you can use the PING command:

ping6 ipv6.google.com

Debug

If the configuration is not working for you, check your interface name with the following command:

The examples are given for eth0/eno1, if your main interface have a different name, you’ll need to modify it in all of your configurations files.
Traffic limitation of your client

In certain cases, some DHCPv6 clients may unfortunately sends several requests per second (especially dchp6c).

This triggers blocking of your servers network port by our automatic protection, as it will be seen as a source of an UDP flood.

To avoid this problem, we invite you to limit the traffic sent from your dhclient6 directly in your firewall configuration.

Following an example for IPTABLES :

In Rescue mode

To test the IPv6 on your server in rescue mode, reboot the server in rescue mode with the “Ubuntu 14 — Trusty” mode. The dhclient is already available on it.

Create the file which will contain your DUID with the help of the above documentation. You can find your DUID in your console.

First, add the IPv6 address to your network interface:

/sbin/ifconfig <interface> inet6 add IPV6ADDRESS/PREFIXLENGH

After, start the dhclient:

Then you can try to ping6:
5 2 голоса
Рейтинг статьи
Опубликовано в рубрике Unix
Звёзд: 1Звёзд: 2Звёзд: 3Звёзд: 4Звёзд: 5 (1 оценок, среднее: 5,00 из 5)
Загрузка...
Подписаться
Уведомить о
guest
0 комментариев
Межтекстовые Отзывы
Посмотреть все комментарии