Set DNS in UT
-
@stan the DNS resolves website names (like example.com) to IP addresses (like 1.1.1.1). Using a custom set dns is usually better than the one provided by ISP, because it is probably faster. Some DNS providers also offer some privacy protections, traffic encryption, phishing protections, website blacklisting, parental control, stats, ...
-
@Capsia that sound very useful i'm now watching this thread thank you very much
-
I've changed this thread to Watching - I too would like a way.
BTW - I'd opt for:
CloudFlare:1.1.1.1, 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001
-
Ubuntu Touch does the same as Ubuntu - it uses all the magic from NetworkManager to listen for dhcp and configure the DNS according to the responses. So the question is a more general one - how you would do it on Ubuntu Desktop?
-
@Flohack yes please how ?
-
@Flohack On Ubuntu desktop I've changed DNS with the tool nm-connection-editor in Unity or in the Gnome settings. I've tried to set DNS using nmcli both on desktop and on UT.
The results:
Desktop was able to set DNS for ethernet and wireless network correctly
UT: changed DNS for wireless successfully but unable to change it in gsm mobile networkThe following error occurred when attempting to save connection settings:
Failed to save '/222071071843368/context1' (628f4269-3a24-7858-e4b0-3765d485ecda) connection: Connection is read-only
-
@Capsia said in Set DNS in UT:
UT: changed DNS for wireless successfully but unable to change it in gsm mobile network
The following error occurred when attempting to save connection settings:
[...]Just guessing: maybe the root file system has to write-enabled to save this?
-
@adeliepenguin said in Set DNS in UT:
Just guessing: maybe the root file system has to write-enabled to save this?
I've tried to do it with root in rw and I've got the same results.
Also tried using sudo.The commands I've used:
nmcli c modify 628f4269-3a24-7858-e4b0-3765d485ecda ipv4.dns "208.67.222.222, 208.67.220.220" nmcli c modify 628f4269-3a24-7858-e4b0-3765d485ecda ipv4.ignore-auto-dns yes
Get network ID with:
nmcli c
-
@Capsia I didn't know about nmcli so far. Thanks! Network-manager has been a mystery to me. I also would like to set my own dns. I haven't found a solution yet but wanted to mention what I found: I get the same as you (connection is read-only even with root r/w). I gues this is not a lack of permissions, but a feature. The command
nmcli -p con show f651d7ab-521b-e3e9-f9fa-721e2b64ec45
lists the connection as read-only (mobile data / gsm). Maybe there's a nmcli command to make it writable. I didn't find one so far. (I'm desperately missing man pages in UbuntuTouch; didn't manage to install them in libertine, either.)
-
@adeliepenguin said in Set DNS in UT:
I gues this is not a lack of permissions, but a feature
This is probably because the gsm connection isn't managed by the NetworkManager.
I think it is managed by ofono, but I might be wrong. -
@adeliepenguin said in Set DNS in UT:
[nmcli ...]
lists the connection as read-only (mobile data / gsm). Maybe there's a nmcli command to make it writable. I didn't find one so far.(The following also applies to mobile data only, not WLAN.)
In case anyone is interested: The command would be
nmcli c m f651d7ab-521b-e3e9-f9fa-721e2b64ec45 connection.read-only no
But it does not have the desired effect. The output is "Error: failed to modify connection.read-only: the property can't be changed."
From the nmcli docu:
Key Name: read-only
Value Type: boolean
Default Value: FALSE
Value Description: FALSE if the connection can be modified using the provided settings service's D-Bus interface with the right privileges, or TRUE if the connection is read-only and cannot be modified.I've done some reading, and I'm quite sure now the read-only property was set intentionally. I found lots of tutorials, but all the places where configs and connections should be stored are empty on my device. (I haven't used wifi so far, so that left no traces, either.) Since a phone has a built-in gsm connection, I suppose this connection has been pre-defined with a default config in UT, not expecting that anybody would want to modify it. (Just upgraded to RC66 today, no difference.)
From what I learned, it's really network-manager who is in charge here. It has a plug-in to talk to ofono for modem use, and eventually delegates DNS to dnsmasq (local DNS service). Setting a custom DNS server would be done exactly with the commands @Capsia posted - if this was allowed.
BTW, I especially liked this tutorial (albeit it did not help me in the end):
https://www.redhat.com/sysadmin/becoming-friends-networkmanager -
Maybe a dumb question, but have you run those commands with:
$ sudo
?
-
@Giiba you're right, one should try everything before giving up. I re-tried with sudo and root r/w, but it made no difference. (According to its docs, nmcli should be run as a user.)
I wonder how the image for OTA updates is being made. Are there any docs on this? I used to run a LTSP server with disk-less clients and also made some custom live DVDs, so I'm not afraid of the read-only root file system. But configuring either of those was fairly easy, since in the end, it was just a directory tree with a nearly vanilla Linux, plus some clever scripts (pre-written) to wrap it up. I suppose there are more stages required for UbuntuTouch, cross-compiling at the very least.
What about generating one's own image of UbuntuTouch? I know it would involve a high risk of bricking my device, so I'd probably not do it, but I'm really curious here. -
@adeliepenguin said in Set DNS in UT:
but all the places where configs and connections should be stored are empty on my device.
The configs for wifi networks are stored in:
/userdata/system-data/etc/NetworkManager/system-connections
I think they are here because /userdata won't be overwritten with ota update
Ofono configs:
/userdata/system-data/var/lib/ofono
There are no configs for gsm network in the NetworkManager directory. I think, this is because gsm networks are read-only in NM
https://www.redhat.com/sysadmin/becoming-friends-networkmanager
@adeliepenguin Thanks, very nice tutorial
-
so any success on setting up the DNS
-
@stan Yes and no, I've set correctly the DNS for Wi-Fi networks, but can't edit the settings for cellular data.
For wireless you can find the commands I've used above.
Maybe it could be part of the settings app in the future.