Wiki source code of IPv6

Last modified by Jean Franco on 2022/06/27 21:35

Show last authors
1 == Enabling IPv6 ==
2
3 To enable IPv6 networking on a machine:
4
5 * Edit file '##/etc/sysconfig/network##' and add line
6 *:
7
8 {{{
9 }}}
10
11 *
12 *:
13 *:: NETWORKING_IPV6=yes
14 *:
15 * Edit file '##/etc/sysconfig/network-scripts/ifcfg-eth<n>##' and add line
16 *:
17
18 {{{
19 }}}
20
21 *
22 *:
23 *:: IPV6INIT=yes
24 *:
25
26 Note: Once you enable IPv6 on node it is automatically configured for auto-configuration. To disable auto-configuration on IPv6 enabled node, we need to use '##IPV6_AUTOCONF=no##' option in either '##/etc/sysconfig/network##' (global) or in interface configuration file (per interface).
27
28
29
30 == Configuring temporary static IPv6 addresses ==
31
32 To configure temporary static IPv6 addresses which will cease to exist if machine or network is restarted, use:
33
34 {{{ifconfig eth0 add <ipv6_address>/<netmask>
35 }}}
36
37 command. Note that we can add any number of IP addresses using this technique as in IPv6 same interface can be assigned more than one IP address.
38
39
40
41 == Removing IPv6 address assigned to a interface ==
42
43 Address prefixes learned via router will slowly get deferred and their valid lifetime would decrease, and eventually they will get removed automatically. However if we have added some address (temporary or permanent) statically then to remove it we can use:
44
45 {{{ifconfig eth0 del <ipv6_address>/<netmask>
46 }}}
47
48 * Note that if we remove some address that was learned via router, then it is possible that the address gets added again on next router advertizement message. To really ensure that address does not get added again we have to disable auto-configuration ('##sysctl net.ipv6.conf.{all|<interface>}.autoconf = 0##') or ignore all router advertisements ('##sysctl net.ipv6.conf.{all|<interface>}.accept_ra = 0 ##').
49
50
51
52 == Configuring permanent static IPv6 addresses ==
53
54 To configure permanent static IPv6 addresses on a machine which would remain even if network service is restarted:
55
56 * First enable IPv6 on machine
57 * Then edit file '##/etc/sysconfig/network-scripts/ifcfg-eth<n>##' and add lines
58 *:
59
60 {{{
61 }}}
62
63 *
64 *:
65 *:: IPV6ADDR=<ipv6_address1_without_quotes>
66 *:: IPV6ADDR_SECONDARIES="<ipv6_address2> <ipv6_address3> <ipv6_address4>"
67 *:
68
69 Note that multiple IPv6 addresses can be defined in single IPV6ADDR_SECONDARIES option each separated from one another using space.
70
71
72
73 == Disabling auto-configuration of addresses via router discovery/advertisements ==
74
75 By default nodes learn prefixes through router solicitation and advertisement messages and configure an address for each prefix learned via such messages. This also allows hosts to configure routes through which they can send packets to nodes which are not on same link.
76
77
78 === Disabling auto-configuration on all interfaces ===
79
80 To disable auto-configuration on complete node (all interfaces), edit file '##/etc/sysconfig/network##' and add option
81
82 {{{IPV6_AUTOCONF=no
83 }}}
84
85 We can also use sysctl to disable auto-configuration using:
86
87 {{{sysctl net.ipv6.conf.all.autoconf=0
88 }}}
89
90
91 === Disabling auto-configuration on particular interface ===
92
93 To disable auto-configuration on particular interface, edit interface configuration file '##/etc/sysconfig/network-scripts/ifcfg-eth<n>##' and add line:
94
95 {{{IPV6_AUTOCONF=no
96 }}}
97
98 We can also disable auto-configuration on particular interface using sysctl as:
99
100 {{{sysctl net.ipv6.conf.<interface_name>.autoconf=0
101 }}}
102
103
104
105
106 = Basic network service test commands =
107
108 == Pinging hosts using their link-local addresses ==
109
110 To ping a host using its link-local address we can use:
111
112 {{{ping6 -I eth<n> <link_local_address_of_remote_node>
113 }}}
114
115 Note that we need to specify interface to be used as node will have one IPv6 link local address (fe80::/10) on each interface. Hence there is no way for node to know which interface should be used to send ping requests as it has IP address in that range on all interfaces.
116
117
118 == Pinging all nodes or all routers multicast address ==
119
120 To ping all nodes on a link we can use:
121
122 {{{ping6 -I eth<n> ff02::1
123 }}}
124
125 To ping all nodes on a routers we can use:
126
127 {{{ping6 -I eth<n> ff02::2
128 }}}
129
130 Note that same as in case of pinging link local addresses, here also we need to explicitly specify which interface should be used to send the ping request to multicast addresses as multicast requests can be sent via any interface and there wont be any default route configured to send multicasts.
131
132
133
134
135 = Informational commands =
136
137 == Seeing neighbour hardware address cache ==
138
139 We can see learned MAC addresses through ICMPv6 using command:
140
141 {{{ip neigh show
142 }}}
143
144 This command will show MAC addresses learned via both IPv4 and IPv6. To just see mac addresses learned via IPv4 we can use:
145
146 {{{arp -a -n
147 }}}
148
149 and to see MAC addresses learned via IPv6 we can use
150
151 {{{ip -6 neigh show
152 }}}
153
154
155
156 == Seeing IPv6 address valid and preferred lifetimes ==
157
158 We can see list of IP addresses assigned to a node (or to a particular interface of a node) using
159
160 {{{ip addr show [<interface>]
161 }}}
162
163 instead of using '##ifconfig [<interface>]##'. The advantage of using '##ip addr show##' command over '##ifconfig##' command is that it will also show valid and preferred lifetime of all IPv6 addresses assigned to the node (or particular interface of node) which is not available in '##ifconfig##' output.
164
165
166
167 == Seeing IPv6 routing table ==
168
169 We can use command
170
171 {{{ip -6 route show
172 }}}
173
174 to see IPv6 routing table.
175
176 If you wnat to use route command then use:
177
178 {{{route -6 -n
179 }}}
180
181 to see IPv6 routes.
182
183
184 == Resolving IPv6 addresses using nslookup ==
185
186 By default '##nslookup##' only sends and accepts IPv4 DNS queries and replies. In order to make '##nslookup##' also request and process IPv6 queries and responses we can use:
187
188 {{{nslookup -type=any <domain_name> [<DNS_server_IP>]
189 }}}
190
191 format so that even IPv6 responses are displayed.
192
193 Instead of nslookup you can also use:
194
195 {{{dig -t any @<DNS> <domain_name>
196 }}}
197
198 to resolve IPv6 addresses. The DNS specified should be configured to respond with AAAA records.
Maila Networks