Skip to content

Instantly share code, notes, and snippets.

Created July 6, 2015 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/f0007a2075fa358fe74f to your computer and use it in GitHub Desktop.
Save anonymous/f0007a2075fa358fe74f to your computer and use it in GitHub Desktop.
OpenWrt IPv6
(1)网线直接连接台式机的的获取的ipv6的情况
C:\Users\Chu>ipconfig
Windows IP Configuration
PPP adapter Broadband Connection:
Connection-specific DNS Suffix . :
IPv4 Address. . . . . . . . . . . : 180.85.7.143
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . : 0.0.0.0
Wireless LAN adapter Wireless Network Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
IPv6 Address. . . . . . . . . . . : 2001:da8:6005:1fff:6d62:983e:d6df:446f
Temporary IPv6 Address. . . . . . : 2001:da8:6005:1fff:9d69:6bfc:9d1e:8b17
Temporary IPv6 Address. . . . . . : 2001:da8:6005:1fff:adbd:a4d4:1d54:d840
Link-local IPv6 Address . . . . . : fe80::6d62:983e:d6df:446f%10
IPv4 Address. . . . . . . . . . . : 100.71.84.71
Subnet Mask . . . . . . . . . . . : 255.255.224.0
Default Gateway . . . . . . . . . : fe80::9604:9cff:fed9:33e8%10
100.71.80.1
(2)网线连接到路由器上的情况。
root@OpenWrt:~# ifconfig
br-lan Link encap:Ethernet HWaddr D4:EE:07:03:3A:70
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::d6ee:7ff:fe03:3a70/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:992892 errors:0 dropped:0 overruns:0 frame:0
TX packets:1030601 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:126720861 (120.8 MiB) TX bytes:1060402682 (1011.2 MiB)
eth0 Link encap:Ethernet HWaddr D4:EE:07:03:3A:70
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:520 errors:0 dropped:12 overruns:0 frame:0
TX packets:811 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:56957 (55.6 KiB) TX bytes:72677 (70.9 KiB)
Interrupt:5
eth1 Link encap:Ethernet HWaddr D4:EE:07:03:3A:71
inet6 addr: 2001:da8:6005:1fff:d6ee:7ff:fe03:3a71/64 Scope:Global
inet6 addr: fe80::d6ee:7ff:fe03:3a71/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1026961 errors:0 dropped:278 overruns:0 frame:0
TX packets:977073 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1066500149 (1017.0 MiB) TX bytes:147077742 (140.2 MiB)
Interrupt:4
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:91 errors:0 dropped:0 overruns:0 frame:0
TX packets:91 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:9667 (9.4 KiB) TX bytes:9667 (9.4 KiB)
pppoe-wan Link encap:Point-to-Point Protocol
inet addr:180.85.7.49 P-t-P:180.85.6.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:1018766 errors:0 dropped:0 overruns:0 frame:0
TX packets:972759 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:1043094745 (994.7 MiB) TX bytes:125377652 (119.5 MiB)
wlan0 Link encap:Ethernet HWaddr D4:EE:07:03:3A:70
inet6 addr: fe80::d6ee:7ff:fe03:3a70/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:995180 errors:0 dropped:0 overruns:0 frame:0
TX packets:1033273 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:141016611 (134.4 MiB) TX bytes:1081508378 (1.0 GiB)
root@OpenWrt:~# ip -f inet6 route
default from :: via fe80::9604:9cff:fed9:33e8 dev eth1 proto static metric 1024
default from 2001:da8:6005:1fff::/64 via fe80::9604:9cff:fed9:33e8 dev eth1 proto static metric 1024
2001:da8:6005:1fff::/64 dev eth1 proto static metric 256
fded:7365:3d89::/64 dev br-lan proto static metric 1024
unreachable fded:7365:3d89::/48 dev lo proto static metric 2147483647 error -128
fe80::/64 dev br-lan proto kernel metric 256
fe80::/64 dev eth1 proto kernel metric 256
fe80::/64 dev wlan0 proto kernel metric 256
root@OpenWrt:/etc# dnsmasq -v
Dnsmasq version 2.71 Copyright (c) 2000-2014 Simon Kelley
Compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth DNSSEC
This software comes with ABSOLUTELY NO WARRANTY.
Dnsmasq is free software, and you are welcome to redistribute it
under the terms of the GNU General Public License, version 2 or 3.
root@OpenWrt:~# ping6 ipv6.google.com
PING ipv6.google.com (2404:6800:4005:80a::200e): 56 data bytes
64 bytes from 2404:6800:4005:80a::200e: seq=0 ttl=45 time=336.722 ms
64 bytes from 2404:6800:4005:80a::200e: seq=1 ttl=45 time=336.433 ms
64 bytes from 2404:6800:4005:80a::200e: seq=2 ttl=45 time=336.143 ms
64 bytes from 2404:6800:4005:80a::200e: seq=3 ttl=45 time=336.498 ms
64 bytes from 2404:6800:4005:80a::200e: seq=4 ttl=45 time=336.514 ms
64 bytes from 2404:6800:4005:80a::200e: seq=5 ttl=45 time=336.170 ms
--- ipv6.google.com ping statistics ---
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max = 336.143/336.413/336.722 ms
(3)路由器上的配置文件
/etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fded:7365:3d89::/48'
config interface 'lan'
option ifname 'eth0'
option force_link '1'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '64'
#option ip6addr '2001:DA8:6005:1FFF::2/64'
config interface 'wan'
option proto 'pppoe'
option ifname 'eth1'
option username 'xxxxx'
option password 'xxxxx'
config interface 'wan6'
option proto 'dhcpv6'
option ifname 'eth1'
option reqaddress 'try'
option reqprefix 'auto'
option dns '202.115.64.34 202.115.64.33 2001:4860:4860::8888 2001:4860:4860::8844
#option ip6addr '2001:DA8:6005:1FFF:D6EE:7FF:FE03:3A71/64'
#option ip6gw '2001:DA8:6005:1FFF::1'
config route6
option interface wan6
option source 2001:DA8:6005:1FFF::/64
option target ::/0
option gateway 2001:DA8:6005:1FFF::1
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option ports '0 1 2 3 4'
/etc/config/dhcp
config dnsmasq
option domainneeded '1'
option boguspriv '1'
option filterwin2k '0'
option localise_queries '1'
option rebind_protection '1'
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 resolvfile '/tmp/resolv.conf.auto'
config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
option ra 'hybrid'
option dhcpv6 'hybrid'
option ra_management '1'
config dhcp 'wan'
option interface 'wan'
option ignore '1'
config dhcp 'wan6'
option interface 'wan'
config odhcpd 'odhcpd'
option maindhcp '0'
option leasefile '/tmp/hosts/odhcpd'
option leasetrigger '/usr/sbin/odhcpd-update'
/etc/dhcp6s.conf
# The followings are a sample configuration to provide a DNS server address
# for every client as well as to delegate a permanent IPv6 prefix
# 2001:db8:1111::/48 to a client whose DUID is 00:01:00:01:aa:bb.
#option domain-name-servers 2001:db8::35;
#host kame {
# duid 00:01:00:01:aa:bb;
# prefix 2001:da8:6005:1fff:d6ee::/48 infinity;
#};
# The followings are a sample configuration to provide an IPv6 address
# from an address pool 2001:db8:1:2::1000-2000 for 3600[s].
# Note. You have to send an RA to fxp0; otherwise a client cannot be sure
# about the prefix-length and the default router. If you want to prevent
# stateless address configuration via RA, please set the autonomous-flag to
# OFF in your RA configuration.
interface br-lan {
address-pool pool1 86400;
};
pool pool1 {
range 2001:da8:6005:1fff::1000 to 2001:da8:6005:1fff::2000 ;
};
(4)lan端上的连接
台式机上的ipconfig /all 显示结果(通过无线连接)
C:\Users\Chu>ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : Chu-Server
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : lan
Wireless LAN adapter Wireless Network Connection:
Connection-specific DNS Suffix . : lan
Description . . . . . . . . . . . : Dell Wireless 1510 Wireless-N WLAN Mini-Card
Physical Address. . . . . . . . . : 00-26-5E-26-7C-CC
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IPv6 Address. . . . . . . . . . . : 2001:da8:6005:1fff::316(Preferred)
Lease Obtained. . . . . . . . . . : Monday, July 06, 2015 10:43:45
Lease Expires . . . . . . . . . . : Tuesday, July 07, 2015 10:43:44
IPv6 Address. . . . . . . . . . . : 2001:da8:6005:1fff:a5c7:7e6c:bd6:2d80(Preferred)
IPv6 Address. . . . . . . . . . . : fded:7365:3d89::316(Preferred)
Lease Obtained. . . . . . . . . . : Monday, July 06, 2015 10:43:48
Lease Expires . . . . . . . . . . : Tuesday, July 07, 2015 10:43:45
IPv6 Address. . . . . . . . . . . : fded:7365:3d89:0:a5c7:7e6c:bd6:2d80(Preferred)
Temporary IPv6 Address. . . . . . : 2001:da8:6005:1fff:a097:172:1aae:6d41(Preferred)
Temporary IPv6 Address. . . . . . : fded:7365:3d89:0:a097:172:1aae:6d41(Preferred)
Link-local IPv6 Address . . . . . : fe80::a5c7:7e6c:bd6:2d80%15(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.1.100(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Monday, July 06, 2015 08:22:59
Lease Expires . . . . . . . . . . : Monday, July 06, 2015 22:42:33
Default Gateway . . . . . . . . . : 192.168.1.1
DHCP Server . . . . . . . . . . . : 192.168.1.1
DHCPv6 IAID . . . . . . . . . . . : 402663006
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1A-99-A0-DE-74-D4-35-12-A3-43
DNS Servers . . . . . . . . . . . : fded:7365:3d89::1
192.168.1.1
NetBIOS over Tcpip. . . . . . . . : Enabled
Connection-specific DNS Suffix Search List : lan
树莓派的ifconfig 显示结果(通过网线连接)
eth0 Link encap:Ethernet HWaddr b8:27:eb:b7:d8:66
inet addr:192.168.1.204 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::44d8:be25:6c28:7be6/64 Scope:Link
inet6 addr: fded:7365:3d89:0:d2e9:9a1a:94c2:a506/64 Scope:Global
inet6 addr: 2001:da8:6005:1fff::1000/128 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7567 errors:0 dropped:26 overruns:0 frame:0
TX packets:6573 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:597848 (583.8 KiB) TX bytes:1020804 (996.8 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:68 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7224 (7.0 KiB) TX bytes:7224 (7.0 KiB)
wlan0 Link encap:Ethernet HWaddr e8:4e:06:25:f7:c9
inet addr:192.168.1.104 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::ac6b:85d0:7966:288e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3974 errors:0 dropped:518 overruns:0 frame:0
TX packets:193 errors:0 dropped:29 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8414378 (8.0 MiB) TX bytes:356232 (347.8 KiB)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment