Подключение FreeBSD к интернету ipv6

В начале 80-х годов казалось, что доступных IP-адресов хватит на долгое время (256 в 4 степени, примерно чуть более 4 миллиардов). Однако быстрое развитие и прогресс в науке и технике указали на неверность этого утверждения. В 1992 г. для решения проблем иссякания адресного пространства и сопутствующих вопросов и проблем Интернет-сообщество выдвинуло ряд предложений. Анализ этих предложений привёл к выдвижению нового протокола ipv6 c IP-адресами в 128 бит. Это позволило увеличить количество доступных адресов в 65000 раз.

Последняя стабильная версия FreeBSD — 7.2 содержит в своём ядре GENERIC ipv6 от группы KAME, но необходимо его включить, добавив в /etc/rc.conf строку ipv6_enable=»YES» — это позволит работать вашему компьютеру как обычному узлу в сети (формально — клиенту).

На сегодняшний день мне не известно ни одного провайдера использующего ipv6 совместно с ipv4, однако, существуют так называемые «туннельные брокеры» у которых можно получить подключение ipv6. Конечно качество подобного сетевого подключения будет зависеть от вашего текущего провайдера, так как оба подключения будут существовать в одной физической среде.

Gogo6.com это социальная сеть для профессионалов и заинтересованных ipv6. На этом сайте можно скачать программу-клиент для подключения к интернету ipv6. После регистрации вы можете использовать полученные имя пользователя и пароль для подключения, тогда вам будет доступен префикс (при анонимном подключении предоставляется один адрес) и вы сможете подключить через настроенный роутер все ваши устройства вплоть до кофеварки и холодильника предоставив им реальный внешний IP-адрес =).
В портах уже содержится клиентская программа. Начнём с её установки. Не забудьте обновить порты. 

cd /usr/ports/net/gateway6
 make install clean

Конфигурационный файл расположился в /usr/local/etc и называется gw6c.conf, тамже есть и пример этого файла gw6c.conf.sample . Для анонимного подключения никаких настроек выполнять не требуетсяи можно запустить клиента, предварительно добавив gateway6_enable=»YES» в /etc/rc.conf:

/usr/local/etc/rc.d/gateway6 start

Вы увидите на экране что-то вроде этого:

/usr/local/etc/rc.d/gateway6 start
 Starting gateway6.
 Gateway6 Client v5.0-RELEASE build Oct 30 2009-23:47:51
 ).ceived a TSP redirection message from broker anon.freenet6.net (1200 Redirection
 The broker redirection list is [ anon-sydney.freenet6.net, anon-amsterdam.freenet6.net, anon-montreal.freenet6.net ].
 The optimized broker redirection list is [ anon-amsterdam.freenet6.net, anon-montreal.freenet6.net, anon-sydney.freenet6.net ].
 Connection to anon-amsterdam.freenet6.net established.

Соединение успешно установлено. Посмотрите состояние сетевых интерфейсов:

ifconfig -a
 fxp0: flags=8843 metric 0 mtu 1500
 	options=2009
 	ether 00:02:b3:49:0b:44
 	inet6 fe80::202:b3ff:fe49:b44%fxp0 prefixlen 64 scopeid 0x1
 	inet 10.255.0.4 netmask 0xfffffff0 broadcast 10.255.0.15
 	inet6 2001:5c0:1506:1400:202:b3ff:fe49:b44 prefixlen 64 autoconf
 	media: Ethernet autoselect (100baseTX )
 	status: active
 plip0: flags=108810 metric 0 mtu 1500
 lo0: flags=8049 metric 0 mtu 16384
 	inet6 ::1 prefixlen 128
 	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
 	inet 127.0.0.1 netmask 0xff000000
 tun1: flags=8051 metric 0 mtu 1280
 	inet6 fe80::202:b3ff:fe49:b44%tun1 prefixlen 64 scopeid 0x4
 	inet6 2001:5c0:1400:a::1d9 --> 2001:5c0:1400:a::1d8 prefixlen 128
 	Opened by PID 5859

Попробуйте проверить соединение:

ping6 www.kame.net
 PING6(56=40+8+8 bytes) 2001:5c0:1400:a::1d9 --> 2001:200:0:8002:203:47ff:fea5:3085
 16 bytes from 2001:200:0:8002:203:47ff:fea5:3085, icmp_seq=0 hlim=50 time=332.378 ms
 16 bytes from 2001:200:0:8002:203:47ff:fea5:3085, icmp_seq=1 hlim=50 time=321.960 ms
 16 bytes from 2001:200:0:8002:203:47ff:fea5:3085, icmp_seq=2 hlim=50 time=310.444 ms
 16 bytes from 2001:200:0:8002:203:47ff:fea5:3085, icmp_seq=3 hlim=50 time=312.224 ms
 16 bytes from 2001:200:0:8002:203:47ff:fea5:3085, icmp_seq=4 hlim=50 time=308.619 ms
 ^C
 --- www.kame.net ping6 statistics ---
 5 packets transmitted, 5 packets received, 0.0% packet loss
 round-trip min/avg/max/std-dev = 308.619/317.125/332.378/8.911 ms

Если соединение не установилось или вы не видите появления выделенного интерфейса tun, то возможно вы отключили поддержку этих интерфейсов при пересборке ядра.

Если вы желаете использовать ipv6 не только на этой машине, но и развернуть в локальной сети (FreeBSD — роутер), то потребуется аккаунт с действительным именем пользователя и паролем полученными, как говорилось ранее, на gogonet.gogo6.com и изменение настроек клиента и системы (настройка машин в сети в статье не рассматривается).

Добавьте в /etc/rc.conf переменную ipv6_gateway_enable=»YES» для включения возможности пересылки пакетов между интерфейсами.
Установите демона, который будет отвечать за автоматическое конфигурирование машин в сети путём отправки «объявлений маршрутизатора»:

cd /usr/ports/net/radvd
 make install clean

Отредактируйте /usr/local/etc/gw6c.conf определив следующие параметры:

#-----------------------------------------------------------------------------
# $Id: gw6c.conf.in,v 1.5 2007/05/09 13:41:32 cnepveu Exp $
#-----------------------------------------------------------------------------##########################      READ ME!      ################################
#
# Welcome to the Gateway6 Client configuration file.
# In order to use the client, you need to modify the 'userid', 'passwd' and
# 'server' parameters below depending on which of these situations applies:
#
# 1. If you created a Freenet6 account, enter your userid and password below.
#    Change the server name to "broker.freenet6.net" and auth_method to 'any'.
# 2. If you would like to use Freenet6 without creating an account,
#    do not make any modifications and close this file.
# 3. If this software was provided by your ISP, enter the userid, password and
#    server name provided by your ISP below.
#

########################## BASIC CONFIGURATION ################################

#
# User Identification and Password:
#   Specify your user name and password as provided by your ISP or Freenet6.
#   If you plan to connect anonymously, leave these values empty.
#   NOTE: Change auth_method option if you are using a username/password.
#
#   userid=
#   passwd=
#
userid=myregname
passwd=myregpassword

#
# Gateway6 Server:
#   Specify a Gateway6 server name or IP address (provided by your ISP or
#   Freenet6). An optional port number can be added; the default port number
#   is 3653.
#
#   Examples:
#     server=hostname # FQDN
#     server=A.B.C.D  # IPv4 address
#     server=[X:X::X:X] # IPv6 address
#     server=hostname:port_number
#     server=A.B.C.D:port_number
#     server=[X:X::X:X]:port_number
#
#   Freenet6 account holders should enter broker.freenet6.net, otherwise use
#   anon.freenet6.net. Your ISP may provide you with a different server name.
#
#server=anon.freenet6.net
server=broker.freenet6.net

#
# Authentication Method:
#
#  auth_method=<{anonymous}|{any|passdss-3des-1|digest-md5|plain}>
#
#   anonymous:      Sends no username or password
#
#   any:            The most secure method will be used.
#   passdss-3des-1: The password is sent encrypted.
#   digest-md5:     The password is sent encrypted.
#   plain:          Both username and password are sent as plain text.
#
# Recommended values:
#   - any:          If you are authenticating a username / password.
#   - anonymous:    If you are connecting anonymously.
#
#auth_method=anonymous
auth_method=any

########################## ROUTING CONFIGURATION ##############################
# Use these parameters when you wish the client to act as a router and provide
# IPv6 connectivity to IPv6-capable devices on your network.

#
# Local Host Type:
#   Change this value to 'router' to enable IPv6 advertisements.
#
#   host_type=
#
host_type=router

#
# Prefix Length:
#   Length of the requested prefix. Valid values range between 0 and 64 when
#   using V6*V4 tunnel modes, and between 0 and 32 when using V4V6 tunnel mode.
#
#   prefixlen=
#
prefixlen=64

#
# Advertisement Interface Prefix:
#   Name of the interface that will be configured to send router advertisements.
#   This is an interface index on Windows (ex: 4) and a name on Linux
#   and BSD (ex: eth1 or fxp1).
#
#   if_prefix=
#
if_prefix=fxp0 #Здесь имя интерфейса который смотрит в сеть подключаемую к ipv6

#
# DNS Server:
#   A DNS server list to which the reverse prefix will be delegated. Servers
#   are separated by the colon(:) delimiter.
#
#   Example: dns_server=ns1.domain:ns2.domain:ns3.domain
#
dns_server=

######################### ADVANCED CONFIGURATION ##############################

#
# Gateway6 Client Installation Directory:
#   Directory where the Gateway6 Client will be installed. This value has been
#   set during installation.
#
gw6_dir=/usr/local

#
# Auto-Retry Connect and Delay:
#   The time lapse, in seconds, between each reconnection in the case of a
#   timeout.
#
#   auto_retry_connect=
#   retry_delay=
#
#   Recommended values: "yes" and 30
#
auto_retry_connect=yes
retry_delay=30

#
# Keepalive Feature and Message Interval:
#   Indicates if and how often the client will send data to keep the tunnel
#   active.
#
#   keepalive=
#   keepalive_interval=
#
#   Recommended values: "yes" and 30
#
keepalive=yes
keepalive_interval=30

#
# Tunnel Encapsulation Mode:
#   v6v4:    IPv6-in-IPv4 tunnel.
#   v6udpv4: IPv6-in-UDP-in-IPv4 tunnel (for clients behind a NAT).
#   v6anyv4: Lets the broker choose the best mode for IPv6 tunnel.
#   v4v6:    IPv4-in-IPv6 tunnel.
#
#   Recommended value: v6anyv4
#
tunnel_mode=v6anyv4

#
# Tunnel Interface Name:
#   The interface name assigned to the tunnel. This value is O/S dependent.
#
#   if_tunnel_v6v4 is the tunnel interface name for v6v4 encapsulation mode
#   if_tunnel_v6udpv4 is the tunnel interface name for v6udpv4 encapsulate mode
#   if_tunnel_v4v6 is the tunnel interface name for v4v6 encapsulation mode
#
#   Default values are set during installation.
#
if_tunnel_v6v4=gif0
if_tunnel_v6udpv4=tun1
if_tunnel_v4v6=gif0

#
# Local IP Address of the Client:
#   Allows you to set a specific address as the local tunnel endpoint.
#
#   client_v4=
#   client_v6=
#     auto: The Gateway6 Client will find the local IP address endpoint.
#
#   Recommended value: auto
#
client_v4=auto
client_v6=auto

#
# Script Name:
#   File name of the script to run to install the tunnel interface. The
#   scripts are located in the template directory under the client
#   installation directory.
#
#   template=
#
#   Default value is set during installation.
#
template=freebsd

#
# Proxy client:
#   Indicates that this client will request a tunnel for another endpoint,
#   such as a Cisco router.
#
#   proxy_client=
#
#   NOTE: NAT traversal is not possible in proxy mode.
#
proxy_client=no

############################ BROKER REDIRECTION ###############################

#
# Broker List File Name:
#   The 'broker_list' directive specifies the filename where the broker
#   list received during broker redirection will be saved.
#
#   broker_list=
#
broker_list=tsp-broker-list.txt

#
# Last Server Used File Name:
#   The 'last_server' directive specifies the filename where the address of
#   the last broker to which a connection was successfully established will
#   be saved.
#
#   last_server=
#
last_server=tsp-last-server.txt

#
# Always Use Last Known Working Server:
#   The value of the 'always_use_same_server' directive determines whether the
#   client should always try to connect to the broker found in the
#   'last_server' directive filename.
#
#   always_use_same_server=
#
always_use_same_server=no

#################################### LOGGING ##################################

#
# Log Verbosity Configuration:
#   The format is 'log_=level', where possible values for
#   'destination' are:
#
#   - console  (logging to the console [AKA stdout])
#   - stderr   (logging to standard error)
#   - file     (logging to a file)
#   - syslog   (logging to syslog [Unix only])
#
#   and 'level' is a digit between 0 and 3. A 'level' value of 0 disables
#   logging to the destination, while values 1 to 3 request increasing levels
#   of log verbosity and detail. If 'level' is not specified, a value of 1 is
#   assumed.
#
#   Example:
#     log_file=3   (Maximal logging to a file)
#     log_stderr=0 (Logging to standard error disabled)
#     log_console= (Minimal logging to the console)
#
#   - Default configuration on Windows platforms:
#
#     log_console=0
#     log_stderr=0
#     log_file=1
#
#   - Default configuration on Unix platforms:
#
#     log_console=0
#     log_stderr=1
#     log_file=0
#     log_syslog=0
#
#log_console=
#log_stderr=
#log_file=
log_syslog=3 #Лог подключения передаётся в системный журнал

#
# Log File Name:
#   When logging to file is requested using the 'log_file' directive, the name
#   and path of the file to use may be specified using this directive.
#
#   log_filename=
#
log_filename=gw6c.log

#
# Log File Rotation:
#   When logging to file is requested using the 'log_file' directive, log file
#   rotation may be enabled. When enabled, the contents of the log file will
#   be moved to a backup file just before it reaches the maximum log file size
#   specified via this directive.
#
#   The name of the backup file is the name of the original log file with
#   '.' inserted before the file extension. If the file does not
#   have an extension, '.' is appended to the name of the original
#   log file. The timestamp specifies when the rotation occurred.
#
#   After the contents of the log file have been moved to the backup file, the
#   original file is cleared, and logging resumes at the beginning of the file.
#
#   log_rotation=
#
log_rotation=yes

#
# Log File Rotation Size:
#   The 'log_rotation_size' directive specifies the maximum size a log file may
#   reach before rotation occurs, if enabled. The value is expressed in
#   kilobytes.
#
#   log_rotation_size=<16|32|128|1024>
#
log_rotation_size=32

#
# Syslog Logging Facility [Unix Only]:
#   When logging to syslog is requested using the 'log_syslog' directive, the
#   facility to use may be specified using this directive.
#
#   syslog_facility=
#
syslog_facility=USER

# end of gw6c.conf
#

Запустите клиента:

/usr/local/etc/rc.d/gateway6 start

Включите клиентские машины и через некоторое время они автоматически настроятся на работу c ipv6 получив глобальные адреса.
Например моя настольная машина с Linux настроилась так:

root@desktop:~$ ifconfig
 eth0	Link encap:Ethernet  HWaddr 00:1e:8c:ba:08:b2
 	inet addr:192.168.0.5  Bcast:192.168.0.255  Mask:255.255.255.0
 	inet6 addr: 2001:5c0:1305:1400:21e:8cff:feba:8b2/64 Диапазон:Общий
 	inet6 addr: fe80::21e:8cff:feba:8b2/64 Диапазон:Ссылка
 	ВВЕРХ BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 	RX packets:83448341 errors:0 dropped:0 overruns:0 frame:0
 	TX packets:160075647 errors:0 dropped:0 overruns:0 carrier:0
 	коллизии:0 txqueuelen:1000
 	RX bytes:5562323610 (5.5 GB)  TX bytes:235674947084 (235.6 GB)
 	Прервано:252 Base address:0xe000

Где:

  • fe80::21e:8cff:feba:8b2 — локальный канальный адрес
  • 2001:5c0:1305:1400:21e:8cff:feba:8b2 — глобальный адрес

Если по автоматической настройки не происходит (касается клиентской машины c FreeBSD) то необходимо проверить включен ли приём объявлений маршрутизатора. Это выполняется установкой sysctl:

sysctl net.inet6.ip6.accept_rtadv=1

Если ваша машина имеет графический интерфейс и настройка ipv6 выполнена успешно, то перейдите на www.kame.net и вы увидете танцующую черИпашку =)
Исаточник  http://www.unixcomp.net/content/9-podklyuchenie-freebsd-k-internetu-ipv6

Запись опубликована в рубрике *Сети, FreeBSD. Добавьте в закладки постоянную ссылку.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Я не спамер This plugin created by Alexei91