V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
DopaminePlz
V2EX  ›  路由器

ARMBIAN 作为路由器配置 IPv6 网络失败

  •  
  •   DopaminePlz · 2020-05-24 14:11:22 +08:00 · 451 次点击
    这是一个创建于 1645 天前的主题,其中的信息可能已经有所发展或是发生改变。

    ARMBIAN 作为路由器配置 IPv6 网络失败

    IPv6 fails on ARMBIAN ROUTER

    前段时间弄了一个我家云,准备整一个轻量 NAS,结果老是掉盘,于是想弄成一个单臂软路由。IPv4 、科学上网及 VPN 服务器都成功了,可是 IPv6 网络却失败,请大佬帮一下忙。

    I have a RK3328 box with armbian running on it. The box has only one NIC, and acts as a linux one-armed router. IPv4 network works normally, but IPv6 fails.

    我参考了很多 PO 文,包括但不限于:

    I had read a lots of pages, including:

    https://help.ubuntu.com/community/ADSLPPPoE

    http://www.routereflector.com/2016/10/enabling-ipv6-via-pppoe-on-a-telecom-italia-tim-link/

    https://wiki.archlinux.org/index.php/IPv6_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)

    https://vk5tu.livejournal.com/37206.html

    https://blog.affien.com/archives/2015/05/28/setup-ubuntu-ipv4ipv6-router-for-vlan-tagged-pppoe-internet-connection/comment-page-1/

    VLAN 划分 (VLAN division)

    我家云只有一个网口,所以我加了一个支持 VLAN 的交换机,划分了两个 VLAN 。

    There is only on NIC, so I connect the ARMBIAN box with a switch that support VLAN. The two subnet of eth0 on ARMBIAN box:

    • eth0.1, LAN interface ;
    • eth0.2, WAN interface;

    主要配置 (My configurations)

    • /etc/network/interfaces
    source /etc/network/interfaces.d/*
    auto lo
    iface lo inet loopback
    
    auto eth0
    #allow-hotplug eth0
    iface eth0 inet static
            address 192.168.80.1
            netmask 255.255.255.0
    iface eth0 inet dhcp
    #iface eth0 inet manual
    iface eth0 inet6 manual
            pre-up echo 0 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6
            post-up ip -6 addr flush eth0
    
    
    ## LAN
    auto  eth0.1
    iface eth0.1 inet static
            vlan-raw-device eth0
            address 192.168.8.1
            netmask 255.255.255.0
            post-up ip route del 192.168.8.0/24
            post-up ip route add 192.168.8.0/24 dev eth0.1
    iface eth0.1 inet6 dhcp
            post-up sysctl -w net.ipv6.conf.eth0/1.disable_ipv6=0
            post-up /sbin/sysctl -w net.ipv6.conf.eth0/1.forwarding=2
            post-up /sbin/sysctl -w net.ipv6.conf.eth0/1.accept_ra=2
    
    
    ## WAN
    auto  eth0.2
    iface eth0.2 inet ppp
            vlan-raw-device eth0
            provider ct0
            pre-up /sbin/ip link set dev eth0.2 up
            post-up ip link set eth0.2 promisc on
            post-up sysctl -w net.ipv6.conf.eth0/2.disable_ipv6=0
            post-up sysctl -w net.ipv6.conf.eth0/2.forwarding=2
            post-up sysctl -w net.ipv6.conf.eth0/2.accept_ra=2
            post-down /sbin/ip link set dev eth0.2 down
            #post-down poff ct0
    iface eth0.2 inet static
            address 192.168.1.2
            netmask 255.255.255.0
    
    • /etc/sysctl.conf
    ##
    net.ipv4.ip_forward=1
    
    ##
    net.ipv4.tcp_keepalive_time = 5
    net.ipv4.tcp_keepalive_probes = 2
    net.ipv4.tcp_keepalive_intvl = 1
    net.ipv4.tcp_tw_recycle = 1
    net.ipv4.tcp_tw_reuse = 1
    
    ##
    fs.file-max = 1000000
    net.core.default_qdisc=fq
    net.ipv4.tcp_congestion_control=bbr
    ##
    
    ##
    net.ipv6.conf.all.disable_ipv6 = 0
    net.ipv6.conf.default.disable_ipv6 = 0
    net.ipv6.conf.ppp0.disable_ipv6 = 0
    net.ipv6.conf.eth0/1.disable_ipv6 = 0
    net.ipv6.conf.eth0/2.disable_ipv6 = 0
    net.ipv6.conf.eth0.disable_ipv6 = 0
    
    #net.ipv6.conf.all.forwarding=2
    #net.ipv6.conf.default.forwarding=2
    net.ipv6.conf.ppp0.forwarding=2
    net.ipv6.conf.eth0/2.forwarding=2
    net.ipv6.conf.eth0/1.forwarding=2
    
    #net.ipv6.conf.all.accept_ra=2
    #net.ipv6.conf.default.accept_ra=2
    net.ipv6.conf.ppp0.accept_ra=2
    net.ipv6.conf.eth0/2.accept_ra=2
    net.ipv6.conf.eth0/1.accept_ra=2
    
    net.ipv6.conf.default.use_tempaddr=2
    net.ipv6.conf.all.use_tempaddr=2
    
    • /etc/wide-dhcpv6/dhcp6c.conf
    profile default
    {
      request domain-name-servers;
      request domain-name;
      script "/etc/wide-dhcpv6/dhcp6c-script";
    };
    interface ppp0 {
      # Request a prefix delegation
      send ia-pd 1;
    };
    id-assoc pd 1 {
      prefix-interface eth0 {
        # 8 bits for subnetting
        sla-len 0;
        # Our subnet is VLAN 1
        sla-id 1;
        # Our interface has address ...::1
        ifid 1;
      };
    };
    
    • PPP
    root@Chainedbox:~# cat /etc/ppp/options
    lock
    noauth
    persist
    
    lcp-echo-interval 1
    lcp-echo-failure 10
    maxfail 0
    holdoff 5
    
    +ipv6 ipv6cp-use-ipaddr
    
    root@Chainedbox:~# cat /etc/ppp/peers/ct0
    # Minimalistic default options file for DSL/PPPoE connections
    debug
    noipdefault
    defaultroute
    replacedefaultroute
    connect /bin/true
    hide-password
    #lcp-echo-interval 30
    #lcp-echo-failure 4
    noauth
    persist
    mtu 1508
    mru 1508
    persist
    #maxfail 0
    #holdoff 20
    noaccomp
    default-asyncmap
    bsdcomp 15
    deflate 15
    plugin rp-pppoe.so eth0.2
    user "***@163.gd"
    usepeerdns
    unit 0
    ipv6 ,
    

    IPv6 表现 (Outputs of commands)

    • IP command
    root@Chainedbox:~# ip -6 a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
        inet6 ::1/128 scope host
           valid_lft forever preferred_lft forever
    4: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
        inet6 fe80::c489:7aff:fe80:5b6f/64 scope link
           valid_lft forever preferred_lft forever
    13: eth0.2@eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 state UP qlen 1000
        inet6 fe80::c489:7aff:fe80:5b6f/64 scope link
           valid_lft forever preferred_lft forever
    17: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 state UNKNOWN qlen 3
        inet6 fe80::6040:7862:123a:a789/10 scope link
           valid_lft forever preferred_lft forever
    root@Chainedbox:~# ip -6 r
    dead:beef:1::/64 dev eth0.1 proto kernel metric 256  expires 86085sec pref medium
    fe80::/10 dev ppp0 metric 1  pref medium
    fe80::/10 dev ppp0 proto kernel metric 256  pref medium
    default via fe80::1 dev eth0.2 proto ra metric 1024  expires 44sec hoplimit 64 pref medium
    
    • fgrep pppd /var/log/messages
    May 24 11:51:44 Chainedbox pppd[24622]: PPP session is 19294
    May 24 11:51:44 Chainedbox pppd[24622]: Connected to b6:*:11 via interface eth0.2
    May 24 11:51:44 Chainedbox pppd[24622]: Using interface ppp0
    May 24 11:51:44 Chainedbox pppd[24622]: Connect: ppp0 <--> eth0.2
    May 24 11:51:44 Chainedbox pppd[24622]: Remote message: Authentication success,Welcome!
    May 24 11:51:44 Chainedbox pppd[24622]: PAP authentication succeeded
    May 24 11:51:44 Chainedbox pppd[24622]: peer from calling number  b6:*:11 authorized
    May 24 11:51:44 Chainedbox pppd[24622]: local  LL address fe80::f520:5e18:07c0:1690
    May 24 11:51:44 Chainedbox pppd[24622]: remote LL address fe80::b638:06ff:febe:0011
    May 24 11:51:44 Chainedbox pppd[24622]: local  IP address 116.21.137.6
    May 24 11:51:44 Chainedbox pppd[24622]: remote IP address 116.21.136.1
    May 24 11:51:44 Chainedbox pppd[24622]: primary   DNS address 202.96.128.86
    May 24 11:51:44 Chainedbox pppd[24622]: secondary DNS address 202.96.134.133
    May 24 12:16:50 Chainedbox pppd[24622]: Terminating on signal 15
    May 24 12:16:50 Chainedbox pppd[24622]: Connect time 25.1 minutes.
    May 24 12:16:50 Chainedbox pppd[24622]: Sent 3861757 bytes, received 3819488 bytes.
    May 24 12:16:50 Chainedbox pppd[24622]: Connection terminated.
    May 24 12:16:50 Chainedbox pppd[24622]: Connect time 25.1 minutes.
    May 24 12:16:50 Chainedbox pppd[24622]: Sent 3861757 bytes, received 3819488 bytes.
    May 24 12:16:50 Chainedbox pppd[30775]: Plugin rp-pppoe.so loaded.
    May 24 12:16:50 Chainedbox pppd[30802]: pppd 2.4.7 started by root, uid 0
    May 24 12:16:50 Chainedbox pppd[30802]: PPP session is 20763
    May 24 12:16:50 Chainedbox pppd[30802]: Connected to b6:*:11 via interface eth0.2
    May 24 12:16:50 Chainedbox pppd[30802]: Using interface ppp0
    May 24 12:16:50 Chainedbox pppd[30802]: Connect: ppp0 <--> eth0.2
    May 24 12:16:50 Chainedbox pppd[30802]: Remote message: Authentication success,Welcome!
    May 24 12:16:50 Chainedbox pppd[30802]: PAP authentication succeeded
    May 24 12:16:50 Chainedbox pppd[30802]: peer from calling number  b6:*:11 authorized
    May 24 12:16:50 Chainedbox pppd[30802]: local  LL address fe80::6040:7862:123a:a789
    May 24 12:16:50 Chainedbox pppd[30802]: remote LL address fe80::b638:06ff:febe:0011
    May 24 12:16:50 Chainedbox pppd[30802]: local  IP address 116.21.137.6
    May 24 12:16:50 Chainedbox pppd[30802]: remote IP address 116.21.136.1
    May 24 12:16:50 Chainedbox pppd[30802]: primary   DNS address 202.96.128.86
    May 24 12:16:50 Chainedbox pppd[30802]: secondary DNS address 202.96.134.133
    May 24 12:16:50 Chainedbox pppd[24622]: Exit.
    

    谢谢。

    Thanks!

    3 条回复    2020-05-24 22:21:13 +08:00
    shikkoku
        1
    shikkoku  
       2020-05-24 21:35:15 +08:00
    我建议你还是换 OPENWRT
    DopaminePlz
        2
    DopaminePlz  
    OP
       2020-05-24 21:49:51 +08:00 via Android
    @shikkoku Openwrt 有 IPv6 的,不过升级的话要重新刷机,也挺麻烦。另外,怎么说也是 Debian 类的系统应用多一些,也新一些吧?
    shikkoku
        3
    shikkoku  
       2020-05-24 22:21:13 +08:00
    WAN 口要配置 DHCPv6PD 都不知道要怎么配。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1005 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 19:01 · PVG 03:01 · LAX 11:01 · JFK 14:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.