maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   N900 disable ipv6 (https://talk.maemo.org/showthread.php?t=98888)

Malakai 2017-02-09 21:40

N900 disable ipv6
 
Hello,

So, I seem to find some infos about how to enable ipv6 on the N900 but not on how to completely disable it.
I don't use ipv6 and sometimes the dns queries are slow because an ipv6 is first looked for before asking for an ipv4.
And also because I would rather use ipv4 only (I understand the usefulness of ipv6 but I never completely understood how it worked).

I've tried :
Code:

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1

but it doesn't seem to work.

Any ideas?

sicelo 2017-02-10 07:13

Re: N900 disable ipv6
 
are you sure about ipv6??? N900 isn't really IPv6-friendly by default. it is possible to use IPv6 on it after a lot of 'sweat'

So I think it's most likely you have a completely different problem/cause for your slowness, not IPv6.

What is in your resolv.conf files (in /etc and /var/run) ... remove any IPv6 nameservers if you have them. Do you get any IPv6 addresses assigned to your connections?

Malakai 2017-02-10 16:01

Re: N900 disable ipv6
 
No ipv6, at least on grps, on wlan I have an ipv6 when connected at home but my network doesn't have ipv6 so I suppose it is a local ipv6 (as said I don't understand much of ipv6), and I'm not at home now to get the ip.

Code:

gprs0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
          inet addr:10.127.47.xxx  P-t-P:10.127.47.xxx  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP  MTU:1400  Metric:1
          RX packets:2371 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1700 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10
          RX bytes:2679790 (2.5 MiB)  TX bytes:120760 (117.9 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:16436  Metric:1
          RX packets:5935 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5935 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:381592 (372.6 KiB)  TX bytes:381592 (372.6 KiB)

phonet0  Link encap:UNSPEC  HWaddr 15-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
          UP POINTOPOINT RUNNING NOARP  MTU:4000  Metric:1
          RX packets:73866 errors:0 dropped:0 overruns:0 frame:0
          TX packets:26775 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:29760428 (28.3 MiB)  TX bytes:1859874 (1.7 MiB)

When I do a nslookup I get also ipv6 address.

Code:

Server:    127.0.0.1
Address 1: 127.0.0.1 N900

Name:      google.com
Address 1: 216.58.214.238 bud02s24-in-f14.1e100.net
Address 2: 2a00:1450:400d:807::200e bud02s22-in-x0e.1e100.net

In /etc/resolv.conf I have 127.0.0.1 and in /var/run/resolv,conf.gprs0 I have 2 nameservers but only ipv4 addresses.

When activating dnsmasq log-queries I get a lot of querie[AAAA] before getting querie[A], so it is looking first for an ipv6 before asking for an ipv4.

As stated before, I don't really understand how ipv6 works and therefore I would rather disable it, as for now it is not really needed (don't have ipv6 enabled on any of my other devices and they work as they should).

Any idea how to avoid any interaction with ipv6 on the N900?

Malakai 2017-02-11 11:31

Re: N900 disable ipv6
 
On my home wlan I get this ipv6 :

Code:

inet6 addr: fe80::5e57:c8ff:fe5d:df13/64 Scope:Link
But as mentioned I don't have ipv6 on my home network, so I don't know what this ipv6 is referring to.

On an nslookup of google.com I get :

Code:

Server:    127.0.0.1
Address 1: 127.0.0.1 N900

Name:      google.com
Address 1: 216.58.214.238 bud02s24-in-f14.1e100.net
Address 2: 2a00:1450:4016:803::200e muc03s08-in-x0e.1e100.net

So the same ipv4 but a different ipv6.....?

sixwheeledbeast 2017-02-13 19:14

Re: N900 disable ipv6
 
You can disable ipv6 in about:config within MicroB.

v6 is enabled on most modern stuff now to aid transition to v6.
I assume you have a router that is v6 compatible at home?
The address you are getting is link-local fe80

Malakai 2017-02-13 21:16

Re: N900 disable ipv6
 
Quote:

Originally Posted by sixwheeledbeast (Post 1523430)
You can disable ipv6 in about:config within MicroB.

I would like to disable ipv6 on all maemo, not only on the browser, as the issues I get are not only related to the browser.

Quote:

Originally Posted by sixwheeledbeast (Post 1523430)
v6 is enabled on most modern stuff now to aid transition to v6.

Yes, but for now I disabled it on my router, access points, laptop, desktop, servers, etc, as ipv6 had weird issues on some devices.

Quote:

Originally Posted by sixwheeledbeast (Post 1523430)
I assume you have a router that is v6 compatible at home?

Yes, but ipv6 is disabled and on my ISP config page I set not to be assigned with an ipv6.

Quote:

Originally Posted by sixwheeledbeast (Post 1523430)
The address you are getting is link-local fe80

How can I prevent it from enabling such an address and thus disable ipv6?

sicelo 2017-02-13 21:36

Re: N900 disable ipv6
 
https://wiki.debian.org/DebianIPv6#How_to_turn_off_IPv6
https://wiki.archlinux.org/index.php/IPv6#Disable_IPv6

sixwheeledbeast 2017-02-13 22:06

Re: N900 disable ipv6
 
For you to get AAAA queries something on the router must be allowing v6 connections.
I would say if you are only having issues at home then it's the router you need to play with.

pali 2017-02-14 19:22

Re: N900 disable ipv6
 
Some notes from my side:

1) Stock kernel does not support IPv6, so by default there is no way to open/bind IPv6 socket

2) Basically all default Maemo 5 applications have disabled IPv6 support, so they do not try to open/bind IPv6 socket (even you have kernel with IPv6 support)

3) Disabling IPv6 support can be achieved by sysctl which you already wrote. When disable_ipv6=1 then *no* userspace application is able to open/bind IPv6 socket. Kernel acts same as if IPv6 support was disabled at compile time.

4) Asking DNS server for AAAA record has nothing and absolutely nothing with IPv6 support. You can ask for AAAA record of some hostname via IPv6 DNS socket and also via *IPv4* DNS socket. POSIX applications uses getaddrinfo() function (see man 3 getaddrinfo) which is supposed to do DNS lookups.

5) Router has nothing allowing IPv6 connections and AAAA queries. Those are two different things which has nothing in common. DNS is application protocol (layer 7) and IPv6 is network protocol (layer 3).

6) DNS resolving does not have to be slow "because of IPv6". You can ask (and system libraries probably do it) for ANY address for some host and you get both IPv4 and IPv6 address.

7) IPv6 Link-Local address cannot be used for making "internet" connection and IIRC connect() is not possible.

So... In IPv4-only network there should be absolutely no penalty with enabled IPv6 support in kernel or applications.

Problem can be in IPv4-only network which advertise IPv6 availabilty (which is non-working). But simple disabling IPv6 in kernel fixes it.

So if you are seeing some problems even after disabling IPv6 then it is probably not IPv6 related.

Malakai 2017-02-15 15:43

Re: N900 disable ipv6
 
Thanks pali for the clarifications, really instructive.

Quote:

Originally Posted by pali (Post 1523482)
1) Stock kernel does not support IPv6, so by default there is no way to open/bind IPv6 socket

I installed kernel power on my N900.

Quote:

Originally Posted by pali (Post 1523482)
2) Basically all default Maemo 5 applications have disabled IPv6 support, so they do not try to open/bind IPv6 socket (even you have kernel with IPv6 support)

Good to know. This means that only dnsmasq makes queries for AAAA addresses.

Quote:

Originally Posted by pali (Post 1523482)
3) Disabling IPv6 support can be achieved by sysctl which you already wrote. When disable_ipv6=1 then *no* userspace application is able to open/bind IPv6 socket. Kernel acts same as if IPv6 support was disabled at compile time.

Where can I add the disable_ipv6=1 to disable ipv6 at boot, as Maemo doesn't seem to have /etc/sysctl.conf.

Quote:

Originally Posted by pali (Post 1523482)
4) Asking DNS server for AAAA record has nothing and absolutely nothing with IPv6 support. You can ask for AAAA record of some hostname via IPv6 DNS socket and also via *IPv4* DNS socket. POSIX applications uses getaddrinfo() function (see man 3 getaddrinfo) which is supposed to do DNS lookups.

That explains why I see AAAA queries even if I don't have an ipv6 address. The queries are made through ipv4. My question would now be how to prevent dnsmasq from querying ipv6? Tried to search for it on the web with no real success.

Quote:

Originally Posted by pali (Post 1523482)
5) Router has nothing allowing IPv6 connections and AAAA queries. Those are two different things which has nothing in common. DNS is application protocol (layer 7) and IPv6 is network protocol (layer 3).

When getting home I will try to see if other devices query the router for ipv6 addresses or only ipv4.

Quote:

Originally Posted by pali (Post 1523482)
6) DNS resolving does not have to be slow "because of IPv6". You can ask (and system libraries probably do it) for ANY address for some host and you get both IPv4 and IPv6 address.

I was believing that because on dnsmasq logs I always see AAAA queries and then A queries, but if you say that there is no impact on DNS resolution then I believe you :)

Quote:

Originally Posted by pali (Post 1523482)
7) IPv6 Link-Local address cannot be used for making "internet" connection and IIRC connect() is not possible.

Seems logical.

Quote:

Originally Posted by pali (Post 1523482)
So... In IPv4-only network there should be absolutely no penalty with enabled IPv6 support in kernel or applications.

Problem can be in IPv4-only network which advertise IPv6 availabilty (which is non-working). But simple disabling IPv6 in kernel fixes it.

So if you are seeing some problems even after disabling IPv6 then it is probably not IPv6 related.

Can't say that I have a real problem now, just wanted to be sure that it is deactivated and that it couldn't produce problems in a future specific situation, like my N900 connecting to an ipv6 network (I wouldn't want to have an ipv6 address in this situation ; only ipv4).

So to resume :
Where can I add the disable_ipv6=1 to disable ipv6 at boot, as Maemo doesn't seem to have /etc/sysctl.conf.
How to prevent dnsmasq from querying ipv6?

Thanks.

pali 2017-02-15 21:16

Re: N900 disable ipv6
 
Quote:

Originally Posted by Malakai (Post 1523511)
My question would now be how to prevent dnsmasq from querying ipv6?

I have no idea if something is even possible. dnsmasq is caching dns forwarder (with some support for also master authoritative dns server) and its responsibility is to forward every one valid dns query (A or MX or AAAA or SRV or TXT ...). Dropping or rejecting queries is strictly against what such software is doing.

Quote:

Originally Posted by Malakai (Post 1523511)
I was believing that because on dnsmasq logs I always see AAAA queries and then A queries, but if you say that there is no impact on DNS resolution then I believe you :)

That depends on application and how good/poor is written. Yes, nobody can prevent or reject application behaviour if it first send DNS packet to ask for AAAA, wait for big timeout and after that new packet for A. But I hope that such applications are not there... You can also send separate packets in parallel...

Quote:

Originally Posted by Malakai (Post 1523511)
Can't say that I have a real problem now, just wanted to be sure that it is deactivated and that it couldn't produce problems in a future specific situation, like my N900 connecting to an ipv6 network (I wouldn't want to have an ipv6 address in this situation ; only ipv4).

Do you have particular reason why to disable IPv6? I think now it is time to start enabling it and be ready for it as giant CGNs are more and more used in IPv4 world.

Quote:

Originally Posted by Malakai (Post 1523511)
Where can I add the disable_ipv6=1 to disable ipv6 at boot, as Maemo doesn't seem to have /etc/sysctl.conf.

That is quite tricky in Maemo...

Normally it should be done into kernel cmdline, but on N900 you need either recompile kernel or boot via usb from computer (where you can specify cmdline). So no go.

Another option is to use sysctl.conf, which is not read on Maemo. So no go.

So last option is to call it manually and because Maemo does not support SysV init scripts (Maemo has removed this support from upstart init daemon) you cannot even use /etc/init.d/ and /etc/rc*.d/.

You need to create your own upstart script which will be executed on device bootup. You need to run sysctl or write to /proc/sys/... For that you need to already have mounted procfs. procfs is mounted by /etc/init.d/rcS called by upstart script /etc/event.d/rcS. So you need to create upstart script which will be called after rcS is finished. This can be achieved by specifying "start on stopped rcS" in your upstart script.

Something like this should work:

/etc/event.d/disable_ipv6
Code:

start on stopped rcS
script
sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1
end script

But it is untested. So you probably need to debug...

Malakai 2017-02-16 13:24

Re: N900 disable ipv6
 
Thanks for all your answers.

Quote:

Originally Posted by pali (Post 1523528)
Do you have particular reason why to disable IPv6?

As I said I don't understand it and if things tend to work better without something I don't understand, then I try to disable it.
Now just for one scenario I encountered : while being connected to a wlan which provided ipv6 addresses (which I didn't notice at first) I connected to my home network through vpn (ipv4 only) with all traffic being redirected through the vpn. But as I had an ipv6 address some traffic was going directly to the Internet (which was bad) and some (ipv4) through my vpn server. That was on my Debian laptop. Since then I completely disabled ipv6 on the laptop and would like to do the same on my N900 to not be in the same situation in the future.
Also ipv6 caused a lot of trouble on some webapps that I use on a Debian VM ; disabling ipv6 made all the trouble go away. So for me it is better to disable ipv6 than letting it active and try to debug a problem not knowing if ipv6 has something to do with it.

When I will not have a choice and have to use ipv6 in the future I will do my best to understand it, but it is not a priority for me right now.

Will try your /etc/event.d/disable_ipv6 script.

Malakai 2017-02-17 10:51

Re: N900 disable ipv6
 
I activated log-queries on my router (as it runs dnsmasq too) and monitored queries from my devices.

From my laptop, only ipv4 queries are made (even if weirdly I have an ipv6 address on my wlan0 interface on Debian, but I guess it's a local address).

From the N900 there are ipv6 queries first (which gets a valid response or a nodata response) and then ipv4 queries. The N900 also queries some PTR records.....

I don't have an ipv6 network at hand (on which I know ipv6 works) to test stuff, so for now it will have to wait until I get access to one.

Thanks for your answers.


All times are GMT. The time now is 10:45.

vBulletin® Version 3.8.8