UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Set DNS in UT

    Scheduled Pinned Locked Moved Support
    18 Posts 6 Posters 2.1k Views 8 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • flohackF Offline
        flohack
        last edited by

        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?

        My languages: πŸ‡¦πŸ‡Ή πŸ‡©πŸ‡ͺ πŸ‡¬πŸ‡§ πŸ‡ΊπŸ‡Έ

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          stan @flohack
          last edited by

          @Flohack yes please how πŸ™‚ ?

          1 Reply Last reply Reply Quote 0
          • C Offline
            Capsia
            last edited by

            @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 network

            The following error occurred when attempting to save connection settings:

            Failed to save '/222071071843368/context1' (628f4269-3a24-7858-e4b0-3765d485ecda) connection: Connection is read-only
            
            adeliepenguinA 1 Reply Last reply Reply Quote 0
            • adeliepenguinA Offline
              adeliepenguin @Capsia
              last edited by

              @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?

              Nexus 5 16.04 OTA-12 stable, PinePhone UBports CE

              1 Reply Last reply Reply Quote 0
              • C Offline
                Capsia
                last edited by

                @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
                
                adeliepenguinA 1 Reply Last reply Reply Quote 0
                • adeliepenguinA Offline
                  adeliepenguin @Capsia
                  last edited by

                  @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.)

                  Nexus 5 16.04 OTA-12 stable, PinePhone UBports CE

                  adeliepenguinA 1 Reply Last reply Reply Quote 0
                  • C Offline
                    Capsia
                    last edited by

                    @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.

                    1 Reply Last reply Reply Quote 0
                    • adeliepenguinA Offline
                      adeliepenguin @adeliepenguin
                      last edited by

                      @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

                      Nexus 5 16.04 OTA-12 stable, PinePhone UBports CE

                      1 Reply Last reply Reply Quote 0
                      • G Offline
                        Giiba
                        last edited by Giiba

                        Maybe a dumb question, but have you run those commands with:

                        $ sudo
                        

                        ?

                        adeliepenguinA 1 Reply Last reply Reply Quote 0
                        • adeliepenguinA Offline
                          adeliepenguin @Giiba
                          last edited by

                          @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.

                          Nexus 5 16.04 OTA-12 stable, PinePhone UBports CE

                          1 Reply Last reply Reply Quote 0
                          • C Offline
                            Capsia
                            last edited by

                            @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

                            1 Reply Last reply Reply Quote 0
                            • S Offline
                              stan
                              last edited by

                              so any success on setting up the DNS

                              C 1 Reply Last reply Reply Quote 0
                              • C Offline
                                Capsia @stan
                                last edited by

                                @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.

                                1 Reply Last reply Reply Quote 1
                                • First post
                                  Last post