首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >IPv6网络在Linux路由器上失败

IPv6网络在Linux路由器上失败
EN

Server Fault用户
提问于 2020-05-24 10:27:36
回答 1查看 730关注 0票数 0

IPv6在ARMBIAN路由器

上失败

我有一个扶手盒(RK3328板+ 1GB DDR3 + 8GB eMMC)。这个盒子只有一个网卡,并且充当一个linux一体机路由器.IPv4网络正常工作,但IPv6失败。

我使用IPv6作为我的家庭路由器,成功地获得了/64的OpenWrt前缀。

我读了很多页,包括:

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的交换机连接ARMBIAN盒。ARMBIAN盒上eth0的两个子网:

  • eth0.1,充当局域网接口;
  • eth0.2,充当广域网接口;

My配置

  • /etc/网络/接口
代码语言:javascript
运行
复制
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

## 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

## WAN
auto  eth0.2
iface eth0.2 inet static
        vlan-raw-device eth0
        up ip link set eth0.2 promisc on
        address 192.168.1.2
        netmask 255.255.255.0
iface eth0.2 inet ppp
        pre-up ip link set dev eth0.2 up
        provider ct0
        post-down ip link set dev eth0.2 down
  • /etc/sysctl.conf
代码语言:javascript
运行
复制
##
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 6/dhcp6c.conf
代码语言:javascript
运行
复制
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;
  };
};
  • 购买力平价
代码语言:javascript
运行
复制
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 ,

命令的

输出

  • IP命令
代码语言:javascript
运行
复制
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 72657sec 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 43sec hoplimit 64 pref medium
default via fe80::b638:6ff:febe:11 dev ppp0 proto ra metric 1024  expires 1750sec pref medium
  • fgrep pppd /var/log/messages
代码语言:javascript
运行
复制
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:38:06:be:00: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:38:06:BE:00: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.
  • Ping和tcpdump
代码语言:javascript
运行
复制
root@Chainedbox:~# ping6 -c 4 240c::6666
PING 240c::6666(240c::6666) 56 data bytes

--- 240c::6666 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3078ms

root@Chainedbox:~# ping6 fe80::6040:7862:123a:a789
connect: Invalid argument

root@Chainedbox:~# ping6 fe80::b638:06ff:febe:0011
connect: Invalid argument

当ping6 240 C::6666时,我得到以下输出:

代码语言:javascript
运行
复制
root@Chainedbox:~# tcpdump -i eth0.2 -p ip6
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0.2, link-type EN10MB (Ethernet), capture size 262144 bytes
18:03:43.439708 IP6 Chainedbox > 240c::6666: ICMP6, echo request, seq 69, length 64
18:03:44.463572 IP6 Chainedbox > 240c::6666: ICMP6, echo request, seq 70, length 64
18:03:45.474450 IP6 gateway > Chainedbox: ICMP6, neighbor solicitation, who has Chainedbox, length 32
18:03:45.474546 IP6 Chainedbox > gateway: ICMP6, neighbor advertisement, tgt is Chainedbox, length 24
18:03:45.487595 IP6 Chainedbox > 240c::6666: ICMP6, echo request, seq 71, length 64
18:03:46.511676 IP6 Chainedbox > 240c::6666: ICMP6, echo request, seq 72, length 64
18:03:47.535667 IP6 Chainedbox > 240c::6666: ICMP6, echo request, seq 73, length 64
18:03:48.559677 IP6 Chainedbox > 240c::6666: ICMP6, echo request, seq 74, length 64
18:03:49.583682 IP6 Chainedbox > 240c::6666: ICMP6, echo request, seq 75, length 64
18:03:50.607680 IP6 Chainedbox > 240c::6666: ICMP6, echo request, seq 76, length 64
18:03:51.447910 IP6 gateway > ip6-allnodes: ICMP6, router advertisement, length 24

有人能帮忙吗?谢谢!

EN

回答 1

Server Fault用户

发布于 2021-06-20 14:54:44

连接链接本地地址时,必须指定接口:fe80::6040:7862:123a:a789不明确.

试一试

代码语言:javascript
运行
复制
ping fe80::6040:7862:123a:a789%eth0.1

其中,eth0.1是您试图与ping连接的设备的接口。

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/1018453

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档