Linux IPv6 Router: RADVD + DHCPv6

   2023-02-09 学习力0
核心提示:Unlike IPv4, which uses DHCP for configuration, IPv6 uses the Neighbor Discovery Protocol to configure addresses and gateways. Unfortunately, originally the protocol had no means of providing addresses of DNS servers to clients, making it n

Unlike IPv4, which uses DHCP for configuration, IPv6 uses the Neighbor Discovery Protocol to configure addresses and gateways. Unfortunately, originally the protocol had no means of providing addresses of DNS servers to clients, making it necessary to use DHCPv6 for that purpose. Modern Linux and Mac OS X machines are able to use the IPv6 Router Advertisement Options for DNS Configuration (RFC 6106), but to my knowledge, Windows clients are not able at the moment. Here’s how to configure a Linux router using radvd and the ISC DHCP daemon.

Network Configuration and Packet Forwarding

The following configuration has been tested with Ubuntu Server 12.04.2 LTS. For the purposes of this article, the /etc/network/interfaces file looks like this:

# eth0 to Internet
iface eth0 inet6 static
address 2001:db8:0:1::2
netmask 64
gateway 2001:db8:0:1::1

# eth1 to internal network
iface eth1 inet6 static
address 2001:db8:0:2::1
netmask 64

Outbound interface is eth0, and inbound interface eth1.

First, to enable IPv6 packet forwarding, put this in your /etc/sysctl.conf:

net.ipv6.conf.all.forwarding=1
And run this to make the change in the running kernel:

sudo sysctl -w net.ipv6.conf.all.forwarding=1

IPv6 Router Advertisement Daemon

Install the router advertisement daemon or radvd with:

sudo apt-get install radvd

Create file /etc/radvd.conf and put your internal interface and prefix there:

interface eth1
{
    AdvSendAdvert on;
    prefix 2001:db8:0:2::/64
    {
    };
};

You can now start the daemon with

sudo service radvd start

That will enable router advertisements on the internal interface. See example configuration files under /usr/share/doc/radvd/examples. See also manual pages for radvd(8) and radvd.conf(5) for more information. The radvdump(8) is a useful tool for watching live router advertisement traffic.

The RDNSS and DNSSL Options

Below is an example radvd.conf which also advertises DNS servers with RDNSS and DNS search path with DNSSL, both of which are specified in RFC 6106. This will work with Linux and Mac OS X clients, but unfortunately Windows does not seem to support it.

interface eth1
{
    AdvSendAdvert on;
    MinRtrAdvInterval 3;
    MaxRtrAdvInterval 10;

    prefix 2001:db8:0:1::/64
    {
    };

    RDNSS 2001:db8:0:1::a 2001:db8:0:1::b
    {
        AdvRDNSSLifetime 10;
    };

    DNSSL koo.fi
    {
        AdvDNSSLLifetime 10;
    };
};

Restart radvd.

DHCPv6

To support Windows, we must install a DHCPv6 compliant DHCP server, such as a recent version of the ISC DHCP daemon:

sudo apt-get install isc-dhcp-server

Create file /etc/dhcp/dhcpd6.conf and put something like this in there:

ddns-update-style none;

default-lease-time 7200;
max-lease-time 86400;

subnet6 2001:db8:0:2::/64 {
    range6
    2001:db8:0:2::1000
    2001:db8:0:2::1fff;

    option dhcp6.name-servers
    2001:db8:0:1::a,
    2001:db8:0:1::b;

    option dhcp6.domain-search
    "koo.fi";
}

We configured a pool of 4096 addresses here (::1000-1fff), plus DNS servers and search path.

Start the dhcpv6 server:

sudo service isc-dhcp-server6 start

If it fails, see /var/log/syslog for error messages. Finally, if everything went ok, add to default runlevels:

sudo update-rc.d isc-dhcp-server6 defaults

Now you should be able to get an IPv6 address and DNS servers with a DHCP client. 


原文地址:

http://koo.fi/blog/2013/03/20/linux-ipv6-router-radvd-dhcpv6/

 
反对 0举报 0 评论 0
 

免责声明:本文仅代表作者个人观点,与乐学笔记(本网)无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
    本网站有部分内容均转载自其它媒体,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责,若因作品内容、知识产权、版权和其他问题,请及时提供相关证明等材料并与我们留言联系,本网站将在规定时间内给予删除等相关处理.

  • 【强转】QEMU+GDB调试linux内核全过程
    【强转】QEMU+GDB调试linux内核全过程
    昨天更新了一篇名为《QEMU+GDB调试linux内核全过程》[link][https://blog.csdn.net/weixin_37867857/article/details/88138432]的博客,发现排版比较混乱,而且思维也比较混乱。咋一看下来简直是惨不忍睹,而且会给读者在安装过程中一种云里雾里的感觉,加上
    03-08
  • Linux下Bochs,NASM安装和使用 linux bom
    Linux下Bochs,NASM安装和使用 linux bom
    以Ubuntu为例,先更新一下:sudo apt-get updatesudo apt-get upgrade然后安装Bochs环境:sudo apt-get install build-essential xorg-dev libgtk2.0-dev安装NASMNASM官网下载,这以nasm-2.14.02.tar.gz为例:用tar zxvf nasm-2.14.02.tar.gz解压后编译安装cd
    03-08
  • 把玩Alpine linux(一):安装
    把玩Alpine linux(一):安装
    导读Alpine Linux是一个面向安全应用的轻量级Linux发行版。它采用了musl libc和busybox以减小系统的体积和运行时资源消耗,同时还提供了自己的包管理工具apk。Alpine 的内核都打了grsecurity/PaX补丁,并且所有的程序都编译为Position Independent Executabl
    03-08
  • 日志审计与分析实验三(rsyslog服务器端和客户端配置)(Linux日志收集)
    日志审计与分析实验三(rsyslog服务器端和客户
     Linux日志收集一、实验目的:1、掌握rsyslog配置方法2、配置rsyslog服务收集其他Linux服务器日志:C/S架构:客户端将其日志上传到服务器端,通过对服务器端日志的查询,来实现对其他客户端的日志进行集中管理;下面实现就是通过两套机器来实现,(server:19
    03-08
  • Linux学习系列--如何在Linux中进行文件的管理
    Linux学习系列--如何在Linux中进行文件的管理
    文件在常见的Linux的文件系统中,经常使用能了解到的文件管理系统是分为多个文件夹进行管理的。如何查看文件路径 pwd ,在文件目录中,会有一个点(.)代表的是当前目录,两个点(..)代表的是当前目录的上层目录在Linux下,所有以点开始的文件都是“隐藏文件
    03-08
  • [JetBrains] 我想在 Linux 上使用 macOS 键绑定!
    [JetBrains] 我想在 Linux 上使用 macOS 键绑定
    很高兴认识你,我的名字是kitakkun。我最近开始实习,是工程界的新手。顺便说一句,这是我的第一篇文章。你最喜欢的操作系统是什么?视窗?苹果系统?还是Linux?我将它们全部用于不同的目的,但感觉就像 macOS ≒ LinuxWindows。一两个月前,我最喜欢 Linux
    03-08
  • linux 配置Socks51
    linux 配置Socks51
    ***大家耳熟能详,但是socks用到的人比较少,那什么是socks呢?请看第二段或者百度百科,socks分别有4和5两个版本,现在5为主流。工作中经常用***访问国外,但是同时国内的速度又慢了,让人很纠结,实际上这个时候可以考虑使用socks。指定某一个程序使用国外s
    02-10
  • linux下如何单独编译设备树? linux设备树是什
    答: make vendor/device_name.dtb  如: make freescale/fsl-1043a-rdb.dtb
    02-10
  • linux下mysql开启远程访问权限及防火墙开放3306端口
    linux下mysql开启远程访问权限及防火墙开放3306
    开启mysql的远程访问权限默认mysql的用户是没有远程访问的权限的,因此当程序跟数据库不在同一台服务器上时,我们需要开启mysql的远程访问权限。主流的有两种方法,改表法和授权法。相对而言,改表法比较容易一点,个人也是比较倾向于使用这种方法,因此,这
    02-10
  • 移植linux3.7到nuc900系列开发板遇到的问题
    通过移植学习linux新版本内核,大概了解一下内核变化。记录一下移植过程中遇到的问题或值得注意的地方。1,添加一款arm9芯片的支持首先修改\arch\arm\tools\mach-types文件添加一行w90p950evbMACH_W90P950EVBW90P950EVB同目录下的脚本文件在编译内核时会根据
    02-10
点击排行