Difference between revisions of "Enable IPv6"
(sixxs.net link typo, remove --setloglevel & mention FD01... is OK) |
(Basic updates) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:HOWTO]] | [[Category:HOWTO]] | ||
− | + | {{Note box|Starting in 0.25, MythTV allows users the '''option''' of connecting | |
− | to <code>mythbackend</code> via IPv6 for | + | to <code>mythbackend</code> via IPv6. |
+ | To be clear, enabling IPv6 isn't required for successful | ||
+ | operation of MythTV. | ||
+ | }} | ||
− | This Wiki shows how to activate IPv6. | + | This Wiki shows how to activate IPv6. It is |
− | part of | + | part of significant changes in the way |
+ | MythTV binds to sockets which should be | ||
+ | transparent to users. | ||
==IPv6 Configuration== | ==IPv6 Configuration== | ||
Interfaces typically have multiple IPv6 addresses. | Interfaces typically have multiple IPv6 addresses. | ||
For help picking the right one, see | For help picking the right one, see | ||
− | [[#Which IPv6 address should be used?]]. | + | [[#Which IPv6 address should be used?|Which IPv6 address should be used?]]. |
+ | |||
If IPv6 is known to be working, just complete the following. | If IPv6 is known to be working, just complete the following. | ||
− | Otherwise, see [[# | + | Otherwise, see [[#Basics|Basics]]. |
Stop all frontends and backends. | Stop all frontends and backends. | ||
− | Using <code>mythtv-setup</code> on the master backend, go to the General page | + | Using <code>mythtv-setup</code> on the master backend, go to the General page and enter the |
− | address of choice | + | address of choice. |
+ | |||
+ | If never activated, the configuration will likely be similar to this: | ||
+ | |||
+ | <pre> | ||
+ | Local Backend | ||
+ | IP address: 192.168.1.123 | ||
+ | IPv6 address: ::1 | ||
+ | |||
+ | Master Backend | ||
+ | IP address: 192.168.1.123 | ||
+ | </pre> | ||
+ | |||
+ | Change it to look like this: | ||
− | |||
<pre> | <pre> | ||
− | IPv6 address: fd01:a:b:1::123 | + | Local Backend |
+ | IP address: 192.168.1.123 | ||
+ | IPv6 address: fd01:a:b:1::123 | ||
+ | |||
+ | Master Backend | ||
+ | IP address: fd01:a:b:1::123 | ||
</pre> | </pre> | ||
− | + | The existing IPv4 address shouldn't be removed. | |
+ | |||
+ | The convention that requires both Local Backend and Master Backend addresses | ||
+ | to be the same in order for a backend to be considered a master backend still applies. | ||
+ | It has been expanded to allow for the Master Backend address to equal either the | ||
+ | Local IPv4 '''or''' IPv6 Backend address. | ||
+ | |||
+ | Some (non MythTV) programs require their IPv6 | ||
addresses enclosed in brackets (<code>[]</code>) or the | addresses enclosed in brackets (<code>[]</code>) or the | ||
addition of a trailing percent sign and Zone Index | addition of a trailing percent sign and Zone Index | ||
(e.g. <code>%eth0</code>.) Neither of these should be used | (e.g. <code>%eth0</code>.) Neither of these should be used | ||
− | with MythTV. | + | with MythTV. Note that that the Zone Index on a backend |
+ | may not be the same as the one used on a frontend, e.g. | ||
+ | eth0 and enp4s0 etc. | ||
Use <code>mythtv-setup</code> to configure any slave | Use <code>mythtv-setup</code> to configure any slave | ||
backends with their own IPv6 addresses. | backends with their own IPv6 addresses. | ||
− | Restart the backend(s) | + | Restart the backend(s). |
− | |||
==Which IPv6 address should be used?== | ==Which IPv6 address should be used?== | ||
Line 43: | Line 74: | ||
Note that even though ULAs are global addresses, no self | Note that even though ULAs are global addresses, no self | ||
− | respecting router will pass them out on the internet. | + | respecting router will pass them out on the internet, |
+ | much like IPv4 Private Network addresses (e.g. 192.168.1.123.) | ||
Use a search engine and look for: 'Unique Local Address generator' | Use a search engine and look for: 'Unique Local Address generator' | ||
− | to find a site that will create ULAs correctly | + | to find a site that will create ULAs correctly like |
− | + | [http://www.sixxs.net/tools/grh/ula/ this], for example. | |
For details on constructing ULAs see | For details on constructing ULAs see | ||
Line 55: | Line 87: | ||
<code>2001:db8::1</code>) configured '''only''' if it is | <code>2001:db8::1</code>) configured '''only''' if it is | ||
necessary to run MythTV from a frontend/slave over the | necessary to run MythTV from a frontend/slave over the | ||
− | + | Internet. | |
Site Local (<code>fec0::/10</code>) addresses were deprecated in 2004. | Site Local (<code>fec0::/10</code>) addresses were deprecated in 2004. | ||
− | Host (::1) addresses are | + | Host (::1) addresses are only useful for a stand alone system. Per a comment on #mythtv-users (7/8/2012,) |
− | + | using ::1 will break [[AirTunes/AirPlay]]. | |
Since all Link Local addresses have the same prefix | Since all Link Local addresses have the same prefix | ||
(<code>fe80::/10</code>), they require a Zone Index | (<code>fe80::/10</code>), they require a Zone Index | ||
− | (e.g. <code>%eth0</code>) for routing | + | (e.g. <code>%eth0</code>) for routing. These addresses |
− | be | + | can be ignored by checking <code>Listen on Link-Local addresses </code> |
− | + | in <code>mythtv-setup</code>. | |
To list currently assigned IPv6 addresses, type: | To list currently assigned IPv6 addresses, type: | ||
− | <code>ifconfig | + | <code>ifconfig | grep inet6</code> |
<pre> | <pre> | ||
+ | inet6 addr: ::1/128 Scope:Host | ||
inet6 addr: fe80::222:22ff:fe22:2222/64 Scope:Link | inet6 addr: fe80::222:22ff:fe22:2222/64 Scope:Link | ||
inet6 addr: fd01:a:b:1::123/64 Scope:Global | inet6 addr: fd01:a:b:1::123/64 Scope:Global | ||
Line 76: | Line 109: | ||
</pre> | </pre> | ||
− | In the above, the | + | In the above, the 3rd address is probably the best choice. |
It is also probably one that must be assigned manually. | It is also probably one that must be assigned manually. | ||
Line 91: | Line 124: | ||
</pre> | </pre> | ||
− | Back to [[#IPv6 Configuration]] | + | Back to [[#IPv6 Configuration|IPv6 Configuration]] |
− | == | + | ==Basics== |
Verify that IPv6 is active on each MythTV host. | Verify that IPv6 is active on each MythTV host. | ||
Line 111: | Line 144: | ||
If the above fails, see the following section. | If the above fails, see the following section. | ||
− | Back to [[#IPv6 Configuration]] | + | Back to [[#IPv6 Configuration|IPv6 Configuration]] |
==What if there's a problem== | ==What if there's a problem== | ||
Line 123: | Line 156: | ||
net.ipv6.conf.eth0.disable_ipv6 = 0 | net.ipv6.conf.eth0.disable_ipv6 = 0 | ||
</pre> | </pre> | ||
+ | |||
+ | It may also be desirable to change | ||
+ | <pre> | ||
+ | net.ipv6.conf.all.use_tempaddr | ||
+ | </pre> | ||
+ | from ''2'' to ''0'' to prevent selection of | ||
+ | temporary addresses. | ||
*Some distributions keep these options in files under <code>/etc/sysctl.d</code>. | *Some distributions keep these options in files under <code>/etc/sysctl.d</code>. | ||
Line 128: | Line 168: | ||
*Be sure any firewalls have been adjusted to accept the IPv6 addresses being used. | *Be sure any firewalls have been adjusted to accept the IPv6 addresses being used. | ||
+ | <!-- | ||
*MySQL connections are currently selected by the hostname information in config.xml and mysql.txt files. Unless a version of MySQL that supports IPv6 is being used, no changes are required. | *MySQL connections are currently selected by the hostname information in config.xml and mysql.txt files. Unless a version of MySQL that supports IPv6 is being used, no changes are required. | ||
*If there are entries in <code>/etc/hosts</code> (etc.), for both IPv4 and IPv6 addresses that have the same hostname (which is perfectly legal,) make sure the host's preferences pick IPv4 first. <code>/etc/gai.conf</code> may exist and control this. | *If there are entries in <code>/etc/hosts</code> (etc.), for both IPv4 and IPv6 addresses that have the same hostname (which is perfectly legal,) make sure the host's preferences pick IPv4 first. <code>/etc/gai.conf</code> may exist and control this. | ||
+ | --> | ||
+ | *If the MythTV configuration is correct, but no IPv6 traffic is seen during, for example recording playback, Master Backend Override may be enabled in <code>mythtv-setup</code> General section and the Master Backend IP address is still set to an IPv4 address. | ||
+ | |||
+ | *It may take longer for a system to configure addresses on its ethernet interfaces. This could prevent the backend from binding to those addresses and, for example, prevent remote frontend access. Failures like this will show up as critical errors in the backend logs Use tools supplied by the distribution to guarantee interface configuration is complete before starting the backend. | ||
− | Back to [[#IPv6 Configuration]] | + | Back to [[#IPv6 Configuration|IPv6 Configuration]] |
==Tools and sample output== | ==Tools and sample output== | ||
+ | {{Warning box|The output of some tools and in logfiles may expose IPv6 addresses. | ||
+ | Some addresses contain a modified MAC address or globally addressable IPv6 addresses. | ||
+ | When posting output to a public form, consider camouflaging them.}} | ||
+ | |||
+ | Additional IPv6 information is available in the logfiles created by <code>mythbackend</code> | ||
+ | and <code>mythfrontend</code> if the <code>--loglevel debug</code> | ||
+ | option is used. | ||
+ | |||
+ | <pre> | ||
+ | sudo mythbackend --user mythtv --quiet \ | ||
+ | --logpath /tmp --loglevel debug | ||
+ | </pre> | ||
+ | |||
+ | IPv6 addresses in the logs don't follow the | ||
+ | convention that allows consecutive 0:0s to be represented by ::. | ||
+ | The address used in this page: <code>fd01:a:b:1::123</code> | ||
+ | will appear as <code>fd01:a:b:1:0:0:0:123</code>. | ||
+ | This is not a problem, only a convention used by the underlying | ||
+ | <code>Qt</code> code. | ||
These examples are all from a host with <code>mythbackend</code> | These examples are all from a host with <code>mythbackend</code> | ||
− | running and IPv6 configured. MySQL is running and using IPv4. | + | running and IPv6 configured. MySQL is running and using IPv4 |
+ | (it can run IPv6 too.) | ||
Obviously, these tools can be run on frontends and slave backends. | Obviously, these tools can be run on frontends and slave backends. | ||
− | |||
− | |||
− | |||
− | |||
To make sure <code>mythbackend</code> and <code>mysqld</code> | To make sure <code>mythbackend</code> and <code>mysqld</code> | ||
are listening for connections: | are listening for connections: | ||
− | <code>sudo netstat - | + | <code>sudo netstat -Wpant | egrep '3306|6543'</code> |
When the backend is running, but no slave backends/frontends are connected, expect: | When the backend is running, but no slave backends/frontends are connected, expect: | ||
Line 157: | Line 218: | ||
tcp6 0 0 ::1:6543 :::* LISTEN 26961/mythbackend | tcp6 0 0 ::1:6543 :::* LISTEN 26961/mythbackend | ||
</pre> | </pre> | ||
− | With one frontend connected and playing a recording, expect: | + | With one remote frontend connected and playing a recording, expect: |
<pre> | <pre> | ||
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1384/mysqld | tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1384/mysqld | ||
Line 176: | Line 237: | ||
could be blocking access. | could be blocking access. | ||
− | <code>nmap | + | <code>nmap -p 6543 -6 --reason someHostNameOrIp</code> |
− | The expected response | + | The expected response should contain lines like this: |
<pre> | <pre> | ||
PORT STATE SERVICE REASON | PORT STATE SERVICE REASON | ||
− | |||
6543/tcp open mythtv syn-ack | 6543/tcp open mythtv syn-ack | ||
</pre> | </pre> | ||
− | + | Back to [[#IPv6 Configuration|IPv6 Configuration]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | Back to [[#IPv6 Configuration]] |
Latest revision as of 17:08, 4 February 2017
Note: Starting in 0.25, MythTV allows users the option of connecting
to mythbackend
via IPv6.
To be clear, enabling IPv6 isn't required for successful
operation of MythTV.
This Wiki shows how to activate IPv6. It is part of significant changes in the way MythTV binds to sockets which should be transparent to users.
Contents
IPv6 Configuration
Interfaces typically have multiple IPv6 addresses. For help picking the right one, see Which IPv6 address should be used?.
If IPv6 is known to be working, just complete the following.
Otherwise, see Basics.
Stop all frontends and backends.
Using mythtv-setup
on the master backend, go to the General page and enter the
address of choice.
If never activated, the configuration will likely be similar to this:
Local Backend IP address: 192.168.1.123 IPv6 address: ::1 Master Backend IP address: 192.168.1.123
Change it to look like this:
Local Backend IP address: 192.168.1.123 IPv6 address: fd01:a:b:1::123 Master Backend IP address: fd01:a:b:1::123
The existing IPv4 address shouldn't be removed.
The convention that requires both Local Backend and Master Backend addresses to be the same in order for a backend to be considered a master backend still applies. It has been expanded to allow for the Master Backend address to equal either the Local IPv4 or IPv6 Backend address.
Some (non MythTV) programs require their IPv6
addresses enclosed in brackets ([]
) or the
addition of a trailing percent sign and Zone Index
(e.g. %eth0
.) Neither of these should be used
with MythTV. Note that that the Zone Index on a backend
may not be the same as the one used on a frontend, e.g.
eth0 and enp4s0 etc.
Use mythtv-setup
to configure any slave
backends with their own IPv6 addresses.
Restart the backend(s).
Which IPv6 address should be used?
The most likely choice is a Unique Local Address (ULA.) Use ULA's if all access to the backend will be within a LAN.
Note that even though ULAs are global addresses, no self respecting router will pass them out on the internet, much like IPv4 Private Network addresses (e.g. 192.168.1.123.)
Use a search engine and look for: 'Unique Local Address generator' to find a site that will create ULAs correctly like this, for example.
For details on constructing ULAs see RFC 4193.
MythTV must have a globally routeble IPv6 address (e.g.
2001:db8::1
) configured only if it is
necessary to run MythTV from a frontend/slave over the
Internet.
Site Local (fec0::/10
) addresses were deprecated in 2004.
Host (::1) addresses are only useful for a stand alone system. Per a comment on #mythtv-users (7/8/2012,) using ::1 will break AirTunes/AirPlay.
Since all Link Local addresses have the same prefix
(fe80::/10
), they require a Zone Index
(e.g. %eth0
) for routing. These addresses
can be ignored by checking Listen on Link-Local addresses
in mythtv-setup
.
To list currently assigned IPv6 addresses, type:
ifconfig | grep inet6
inet6 addr: ::1/128 Scope:Host inet6 addr: fe80::222:22ff:fe22:2222/64 Scope:Link inet6 addr: fd01:a:b:1::123/64 Scope:Global inet6 addr: 2001:db8::123/64 Scope:Global
In the above, the 3rd address is probably the best choice. It is also probably one that must be assigned manually.
If the desired address doesn't exist, use the configuration tool provided with the host's distribution to add it.
Entries in /etc/hosts
(DHCP, router etc.) are optional. The following
is an example for one host:
192.168.1.123 masterbe.local masterbe fd01:a:b:1::123 masterbe.local masterbe 2001:db8::123 masterbe.local masterbe
Back to IPv6 Configuration
Basics
Verify that IPv6 is active on each MythTV host.
If ssh
, for example, is known to work, a simple
test (run from the master backend) is:
for HOST in <list all frontend and slave backends here> do ssh -6 $HOST hostname done
If the test works for all frontends and slave backends, IPv6 can be added to MythTV.
If the above fails, see the following section.
Back to IPv6 Configuration
What if there's a problem
- Make sure IPv6 hasn't been disabled either system wide or for the interface MythTV will use. Type:
sysctl -a 2> /dev/null | grep "ipv6.*disable"
net.ipv6.conf.all.disable_ipv6 = 0 net.ipv6.conf.default.disable_ipv6 = 0 net.ipv6.conf.lo.disable_ipv6 = 0 net.ipv6.conf.eth0.disable_ipv6 = 0
It may also be desirable to change
net.ipv6.conf.all.use_tempaddr
from 2 to 0 to prevent selection of temporary addresses.
- Some distributions keep these options in files under
/etc/sysctl.d
.
- Be sure any firewalls have been adjusted to accept the IPv6 addresses being used.
- If the MythTV configuration is correct, but no IPv6 traffic is seen during, for example recording playback, Master Backend Override may be enabled in
mythtv-setup
General section and the Master Backend IP address is still set to an IPv4 address.
- It may take longer for a system to configure addresses on its ethernet interfaces. This could prevent the backend from binding to those addresses and, for example, prevent remote frontend access. Failures like this will show up as critical errors in the backend logs Use tools supplied by the distribution to guarantee interface configuration is complete before starting the backend.
Back to IPv6 Configuration
Tools and sample output
Warning: The output of some tools and in logfiles may expose IPv6 addresses. Some addresses contain a modified MAC address or globally addressable IPv6 addresses. When posting output to a public form, consider camouflaging them.
Additional IPv6 information is available in the logfiles created by mythbackend
and mythfrontend
if the --loglevel debug
option is used.
sudo mythbackend --user mythtv --quiet \ --logpath /tmp --loglevel debug
IPv6 addresses in the logs don't follow the
convention that allows consecutive 0:0s to be represented by ::.
The address used in this page: fd01:a:b:1::123
will appear as fd01:a:b:1:0:0:0:123
.
This is not a problem, only a convention used by the underlying
Qt
code.
These examples are all from a host with mythbackend
running and IPv6 configured. MySQL is running and using IPv4
(it can run IPv6 too.)
Obviously, these tools can be run on frontends and slave backends.
To make sure mythbackend
and mysqld
are listening for connections:
sudo netstat -Wpant | egrep '3306|6543'
When the backend is running, but no slave backends/frontends are connected, expect:
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1198/mysqld tcp 0 0 192.168.1.123:6543 0.0.0.0:* LISTEN 26961/mythbackend tcp 0 0 127.0.0.1:6543 0.0.0.0:* LISTEN 26961/mythbackend tcp6 0 0 fd01:a:b:1::123:6543 :::* LISTEN 26961/mythbackend tcp6 0 0 ::1:6543 :::* LISTEN 26961/mythbackend
With one remote frontend connected and playing a recording, expect:
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1384/mysqld tcp 0 0 192.168.1.123:6543 0.0.0.0:* LISTEN 26961/mythbackend tcp 0 0 127.0.0.1:6543 0.0.0.0:* LISTEN 26961/mythbackend tcp 0 0 192.168.1.123:3306 192.168.1.234:56538 ESTABLISHED 1384/mysqld tcp 0 0 192.168.1.123:3306 192.168.1.234:56601 ESTABLISHED 1384/mysqld tcp 0 0 192.168.1.123:6543 192.168.1.234:42760 ESTABLISHED 26961/mythbackend tcp 0 0 192.168.1.123:6543 192.168.1.234:42761 ESTABLISHED 26961/mythbackend tcp 0 0 192.168.10.204:3306 192.168.1.234:56532 ESTABLISHED 1384/mysqld tcp6 0 0 fd01:a:b:1::123:6543 fd01:a:b:1::456:36345 ESTABLISHED 26961/mythbackend tcp6 0 0 fd01:a:b:1::123:6543 fd01:a:b:1::456:36346 ESTABLISHED 26961/mythbackend tcp6 0 0 ::1:6543 :::* LISTEN 26961/mythbackend
If installed, nmap
may help diagnose the reason
that a connection fails. For example, a firewall
could be blocking access.
nmap -p 6543 -6 --reason someHostNameOrIp
The expected response should contain lines like this:
PORT STATE SERVICE REASON 6543/tcp open mythtv syn-ack
Back to IPv6 Configuration