OpenWRT支持ipv6有两种情况,一种是有ipv6-PD地址的(一般对应光猫桥接,路由器拨号的情况),反之就是没有ipv6-PD地址(一般对应自动获取ip)

有IPv6-PD地址的情况

luci界面配置要点:

  • “网络”-“接口”-“LAN”-“DHCP服务器”-“IPv6设置”
    “RA服务”和“DHCPv6服务”都是服务器模式,“NDP 代理”设置为“混合模式”,通告的IPv6 DNS服务器填两个“2400:3200::1”、“2400:3200:baba::1”。
  • “网络”-“接口”-“LAN”-“DHCP服务器”-“IPv6 RA 设置”
    “启用 SLAAC”打钩,“RA标记”只选一个“其他配置”。
  • “网络”-“接口”-“全局网络选项”
    “IPv6 ULA 前缀”全部删掉,留空。
  • “网络”-“接口”-“WAN”-“高级设置”
    “获取ipv6地址”选择“自动”。
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    #/etc/config/network

    config interface 'loopback'
    option device 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

    config globals 'globals'
    option packet_steering '1'

    config device
    option name 'br-lan'
    option type 'bridge'
    list ports 'eth1'
    option promisc '1'

    config device
    option name 'eth1'
    option macaddr '76:1d:0b:98:e3:55'

    config interface 'lan'
    option device 'br-lan'
    option proto 'static'
    option ipaddr '192.168.0.1'
    option netmask '255.255.255.0'
    option ip6assign '64'

    config device
    option name 'eth0'
    option macaddr '76:1d:0b:98:e3:54'

    config interface 'wan'
    option device 'eth0'
    option proto 'pppoe'
    option username 'your_username'
    option password 'your_password'
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    #/etc/config/dhcp
    config dnsmasq
    option domainneeded '1'
    option boguspriv '1'
    option filterwin2k '0'
    option localise_queries '1'
    option rebind_protection '0'
    option rebind_localhost '1'
    option local '/lan/'
    option domain 'lan'
    option expandhosts '1'
    option nonegcache '0'
    option authoritative '1'
    option readethers '1'
    option leasefile '/tmp/dhcp.leases'
    option nonwildcard '1'
    option localservice '0'
    option ednspacket_max '1232'
    option filter_aaaa '0'
    option filter_a '0'
    option port '53'
    option dns_redirect '1'
    option allservers '1'
    option min_ttl '3600'
    option dnsforwardmax '10000'
    option localuse '1'
    option noresolv '1'
    list server '127.0.0.1#7874'
    option cachesize '0'

    config dhcp 'lan'
    option interface 'lan'
    option start '100'
    option limit '150'
    option leasetime '12h'
    option dhcpv4 'server'
    option ra 'server'
    option force '1'
    option ndp 'hybrid'
    list dns '2400:3200::1'
    list dns '2400:3200:baba::1'
    list ra_flags 'other-config'
    option dhcpv6 'server'

    config dhcp 'wan'
    option interface 'wan'
    option ignore '1'

    config odhcpd 'odhcpd'
    option maindhcp '0'
    option leasefile '/tmp/hosts/odhcpd'
    option leasetrigger '/usr/sbin/odhcpd-update'
    option loglevel '4'

无IPv6-PD地址的情况

luci界面配置要点:

  • “网络”-“接口”-“LAN”-“DHCP服务器”-“IPv6设置”
    “RA服务”、“DHCPv6服务”和“NDP 代理”都是中继模式。
  • “网络”-“接口”-“全局网络选项”
    “IPv6 ULA 前缀”全部删掉,留空。
  • “网络”-“接口”-“WAN”-“高级设置”
    “获取ipv6地址”选择“自动”。
  • “网络”-“接口”-“WAN”-“DHCP服务器”-“IPv6设置”
    “指定的主接口”打钩。

DDNS设置

我想要ipv6主要是想要公网ip,这当然需要DDNS。设置的时候ip地址来源选择“网络”,ipv6地址对应一个虚拟动态接口,在我这里叫“wan_6”。