How to pair android and ubuntu via KDE connect behind firewall [ufw]?

6,136

Solution 1

Just found a solution

https://community.kde.org/KDEConnect mentions that we need to enable rule in ufw.

so...

sudo ufw allow 1714:1764/udp
sudo ufw allow 1714:1764/tcp

And I needed to reboot my laptop for things to work. Its working now like a charm with ufw running.

Solution 2

To do this in a more complete and secure fashion, only opening ports to devices in your local network, open the console and enter:

ip -4 addr

Look for inet line that looks like:

inet xxx.xxx.xxx.xxx/24 brd xxx.xxx.xxx.255 scope global...

Now enter these commands for IPv4:

sudo ufw allow proto udp from xxx.xxx.xxx.0/24 to any port 1714:1764
sudo ufw allow proto tcp from xxx.xxx.xxx.0/24 to any port 1714:1764

Substitute xxx.xxx.xxx with your inet adress first 3 numbers as shown in bold.

Use the line with scope global at the end to find your correct adress, don't use the line with 127.0.0.1 adress:

For IPv6 just enter:

sudo ufw allow proto udp from fe80::/64 to any port 1714:1764
sudo ufw allow proto tcp from fe80::/64 to any port 1714:1764

fe80:://64 is the local link range for IPv6 connections (your IPv6 local network adresses).

Finally type:

sudo ufw reload

This way you don't have your ports open to the wild.

You can install gufw a graphical tool to manage your firewall rules and delete previously set ones for kdeconnect. To do that just enter:

sudo apt install gufw
Share:
6,136

Related videos on Youtube

nazar2sfive
Author by

nazar2sfive

Trying hard to make ubuntu as my primary os.

Updated on September 18, 2022

Comments

  • nazar2sfive
    nazar2sfive over 1 year

    I have my ufw setup in my ubuntu. I have problem with connecting KDE connect and my ubuntu pc behind firewall. How do I do it? Disabling firewall easily pairs the two device but I am having difficulty with firewall on.

  • Maduka Jayalath
    Maduka Jayalath almost 6 years
    You don't need to reboot, just sudo ufw reload does the trick
  • Robin
    Robin over 4 years
    In case it helps anyone else looking at this; I know the IP of my phone on my network, so I could add the following more explicit rules: sudo ufw allow in on wlp2s0 proto tcp from 192.168.0.182 to any port 1714:1764 sudo ufw allow in on wlp2s0 proto udp from 192.168.0.182 to any port 1714:1764