前段时间弄了一个我家云,准备整一个轻量 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
我家云只有一个网口,所以我加了一个支持 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:
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
##
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
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;
};
};
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 ,
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
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!
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.