分享一个 OpenWrt IPv6 的配置
配置
修改 /etc/config/dhcp
config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
option ra_management '1'
option ra 'hybrid'
option dhcpv6 'hybrid'
option ndp 'hybrid'
config dhcp 'wan6'
option interface 'wan6'
option dhcpv6 'hybrid'
option ra 'hybrid'
option ndp 'hybrid'
option master '1' # 这里 wan6 配置 master
上面配置中的 lan 部分,可以通过 luci web 页面配置,配置如下:
修改配置完成后重启网络服务 /etc/init.d/network restart
即可在lan侧获得 IPv6 地址
如上配置IPv6 混合模式/也可以配成中继模式(relay)。
注:此时光猫没有做任何修改,还是NAT 路由模式,并没有要求改成桥接!
环境
- OpenWrt 路由器
root@FriendlyWrt:/etc/config# cat /etc/os-release
NAME="OpenWrt"
VERSION="19.07.1"
ID="openwrt"
ID_LIKE="lede openwrt"
PRETTY_NAME="OpenWrt 19.07.1"
VERSION_ID="19.07.1"
HOME_URL="https://openwrt.org/"
BUG_URL="https://bugs.openwrt.org/"
SUPPORT_URL="https://forum.openwrt.org/"
BUILD_ID="r10911-c155900f66"
OPENWRT_BOARD="rockchip-rk3328/generic"
OPENWRT_ARCH="aarch64_cortex-a53"
OPENWRT_TAINTS="no-all"
OPENWRT_DEVICE_MANUFACTURER="OpenWrt"
OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/"
OPENWRT_DEVICE_PRODUCT="Generic"
OPENWRT_DEVICE_REVISION="v0"
OPENWRT_RELEASE="OpenWrt 19.07.1 r10911-c155900f66"
root@FriendlyWrt:/etc/config#
- OpenWrt 路由 wan 口
eth0 Link encap:Ethernet HWaddr 0A:E8:68:C2:40:98
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: 2409:8a31:6d1:68b0:8e8:68ff:fec2:4098/64 Scope:Global
inet6 addr: 2409:8a31:6d1:68b0:ae8:68ff:fec2:4098/128 Scope:Global
inet6 addr: fe80::8e8:68ff:fec2:4098/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1192037 errors:0 dropped:1 overruns:0 frame:0
TX packets:710177 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1401239337 (1.3 GiB) TX bytes:254127234 (242.3 MiB)
Interrupt:28
- LAN 下PC信息
[lester lester]# cat /etc/os-release
NAME="Manjaro Linux"
ID=manjaro
ID_LIKE=arch
BUILD_ID=rolling
PRETTY_NAME="Manjaro Linux"
ANSI_COLOR="32;1;24;144;200"
HOME_URL="https://manjaro.org/"
DOCUMENTATION_URL="https://wiki.manjaro.org/"
SUPPORT_URL="https://manjaro.org/"
BUG_REPORT_URL="https://bugs.manjaro.org/"
LOGO=manjarolinux
[lester lester]#
- PC 网卡信息
wlp10s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.120 netmask 255.0.0.0 broadcast 10.255.255.255
inet6 2409:8a31:6d1:68b0:65a7:8d57:2055:99fa prefixlen 64 scopeid 0x0<global>
inet6 fe80::24ba:e920:bad:43be prefixlen 64 scopeid 0x20<link>
ether b4:b6:76:19:9b:64 txqueuelen 1000 (Ethernet)
RX packets 122635 bytes 113290495 (108.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 102489 bytes 43813224 (41.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[lester lester]# ping 240c::6666
PING 240c::6666(240c::6666) 56 比特的数据
64 比特,来自 240c::6666: icmp_seq=1 ttl=54 时间=240 毫秒
64 比特,来自 240c::6666: icmp_seq=2 ttl=54 时间=17.6 毫秒
^C
--- 240c::6666 ping 统计 ---
已发送 2 个包, 已接收 2 个包, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 17.606/129.016/240.427/111.410 ms
[lester lester]#