IPv6 address type and operation

No. fragments and the IPv6 address prefix notation:

IPv6 has 128-bit address space is huge, for so much space, nor is it arbitrary division, but rather be divided according to the number segment bit bit

                                Address structure diagram

Global routing prefix

(# 48)

Subnet ID

(16th)

Interface ID

(# 128)

Like IPv4, the IPv6 also consists of two parts (the network and host portions), global prefix 64 (comprising a 16-bit subnet)

IPv6 writing format:

When expression and writing, the length of 128 bits (bit) of the IPv6 address is divided into eight 16-bit binary segments, each segment 16 is represented by a binary 4-bit hexadecimal, with interstage ":" (colon) separated (method of writing and its decimal IPv4 added. "" different).

    For example: 1000: 0000: 0000: 0000: 000A: 000B: 000C: 000D each segment is a 16 bit binary number with four segments hexadecimal number expressed by the inter-segment: (colon) "" an IPv6 address; wherein: each of the upper segment 0 in hexadecimal number 4 allows omitted; thus, the above IPv6 address may be abbreviated to: 1000: 0: 0: 0: a: B: C: D.

    To further simplify, the IPv6 address specification also specified, may be used in a double-colon up IPv6 address (: :) instead of a plurality of full IPv6 address 0 section closely linked hexadecimal number (because if not allowed to determine the length of the IPv6 address more than once in a double colon IPv6 address, the IPv6 address in only a predetermined specification: only be used up in a double-colon IPv6 address), so that the IPv6 address further above It can be abbreviated as: 1000 :: A: B: C: D.

    Location double colon may be used in front of the IPv6 address, an intermediate or later; for example: For 1000: 0: 0: 0: A: B: 0: 0 such an IPv6 address, can be written as 1000 :: A: B: 0: 0, may be written as 1000: 0: 0: 0: A: B ::; but it can not be written 1000 :: A: B ::.

 

Address Type:

Unicast Address : packet destination address is a unicast address is transmitted to a single interface. As load balancing, multiple devices located in a plurality of interfaces may use the same address, but the address is called anycast address.

Global unicast address (2000 :: / 3) : This is a typical routable public address, the same as in IPv4 unicast address.

Link-local address (FE80 :: / 10 ): similar to IPv4 private addresses, but also non-routable. They can be seen as a convenient tool that lets you to convene a meeting to form an interim LAN, or create a small LAN, the LAN is not connected to the Internet, but need to share files and services locally.

Unique local address (FC00 :: /. 7) : These addresses are not routed in the Internet, but is also substantially globally unique, and therefore less likely to re-use them. Only local addresses are designed to replace the local address field points, so their function is almost the same as the IPv4 private address: Support point communications over the entire field, may be routed to a plurality of local networks. Field site-local address was abolished in September 2004.

Multicast address (FF00 :: /. 8) : as for IPv4, the destination address is a multicast address packet is transmitted to all the interfaces indicated by the multicast address. This address is also sometimes referred to many addresses. IPv6 multicast address is easy to identify, which always starts with FF.

Anycast Address : the multicast address as the anycast addresses identifying a plurality of devices of the plurality of interfaces, but there is a big difference: anycast packet is transmitted to only one interface according to routing determined distance eleven nearest Interface . Special about this is that the address can be assigned a single anycast address to a plurality of interfaces. This address is called "one of the recent" address.

Special IPv6 address:

Address Meaning
0: 0: 0: 0: 0: 0: 0: 0 (: :) when equivalent IPv4 address 0.0.0.0 DHCP typically use stateful configuration, as the source address of the host.
0: 0: 0: 0: 0: 0: 0: 1 (:: 1) corresponding to the IPv4 address 127.0.0.1.
0: 0: 0: 0: 0: 0: 192.168.100.1 network supports both IPv4 and IPv6, the IPv6 address is usually written like the IPv4 address translation comes.
2000 :: / 3 unicast address global scope.
FC00 :: / 7 unique local unicast address range.
FE80 :: / 10 link-local unicast address range.
FF00 :: / 8 multicast address range.
3FFF: FFFF :: / 32 to retain and use for example when writing the document.
2001: 0088:: / 32 are reserved for example, and use the time of writing the document.
2002 :: / 16 is reserved for 6to4 tunneling techniques. 6to4 tunneling is a transition from IPv4 to IPv6 method, so that IPv6 packets can be transmitted over an IPv4 network without explicit tunnel configuration.

Some use IPv6 on the server :( first need to enable ipv6 server function, and about the same ipv4)

ipv6 routing of some operations:

View server ipv6 routing information: ip -6 route or route -6

Check to make ranking cache: ip -6 neighbor Show

Adding IPV6 address

ip -6 addr add <ipv6address>/<prefixlength> dev <interface>

ip -6 addr add 2001:0db8:0:f101::1/64 dev eth0

ifconfig <interface> inet6 add <ipv6address>/<prefixlength>

ifconfig eth0 inet6 add 2001:0db8:0:f101::1/64

添加默认路由

ip -6 route add <ipv6network>/<prefixlength> via <ipv6address>

ip -6 route add default via 2001:0db8:0:f101::1

route -A inet6 add <ipv6network>/<prefixlength> gw

route -A inet6 add default gw 2001:0db8:0:f101::1

添加策略路由

ip -6 rule add from ::1 table 111     来自::1的路由走表111

ip -6 rule add from to  ::1 table 111 去::1的路由走表111

ip -6 rule add from all iif eth1   table 111 来自eth1的路由走111

查看策略路由

ip -6 rule

ipv6iptables的一些使用:

 

 

指定ip地址

 

ip6tables -A INPUT -i sit+ -p tcp -s 2001:250:4000:2000::1/64 --dport 27017 -j ACCEPT

 

保存规则

 

service ip6tables save

 

所有ip地址

 

ip6tables -A INPUT -p tcp --dport xxx -j ACCEPT ip6tables -A INPUT -m state --state NEW -p tcp --dport xxx -j ACCEPT 

 

删除规则

 

ip6tables -D INPUT|OUTPUT|FORWARD num 

 

查看已添加的端口

 

ip6tables -L --line-numbers

 

查看当前端口状态数据包状态

 

ip6tables -vnL --line-numbers

 

Guess you like

Origin www.cnblogs.com/bbox/p/11704582.html