This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Can kdeconnect work in two networks?

Tags: None
(comma "," separated)
Lupccs
Registered Member
Posts
8
Karma
0
OS
Hi everybody and thanks for the great work you're doing; here's my question

two android phones:
M, where the kdeconnect is installed
and S
A Kubuntu 20.04 Pc
An ethernet wifi device

Case 1 - I connect to internet using M phone through usb tethering, and kdeconnect works smoothly
Case 2 - I connect to internet using M phone as an hotspot and the ethernet wifi device, and kdeconnect works smoothly
Case 3 - I connect to internet using S phone with usb tethering but I need to use kdeconnect on the M phone as a remote for my pc: it doesn't really seem to find the device, not even if I manually add the ip from kdeconnect android app. as soon as I disable that connection, kdeconnect gets going

How can I do it, in Case 3? how can I get to use S connection to surf the web while using an M network just for kdeconnect, at the same time? is there a way to route just the kdeconnect traffic to the M connection (which is, in both cases, a 192.168.43.x while the S is always 192.168.42.x)?

Thanks anyway for the help
Lupccs
Registered Member
Posts
8
Karma
0
OS
Seems like I managed to obtain the result I wanted!
I created another ethernet connection with my connection manager , which I use for my ethernet wi-fi device, and I called it "Ethernet-Local" : under IPv4 Settings I selected "Routes" and put a tick to "Use this connection only for resources on its network".
When I want to use the other phone's usb-tethered connection, I switch on the "Ethernet-Local" connection, and the two seems to co-exist in harmony! When I'm using M as an hotspot I switch back to the normal connection, called "Ethernet-Web",

it's even easy to automate

we'll need a script that gets launched everytime something changes between connections, and it must be owned by root

Code: Select all
    sudo nano /etc/NetworkManager/dispatcher.d/90-kdecon

And here's what's inside the script

Code: Select all
    #!/bin/sh
   
    ethweb=$(nmcli dev | grep "Ethernet-Web" | grep -w "connected")
    usb=$(nmcli dev | grep "usb0" | grep -w "connected")
    ethlocal=$(nmcli dev | grep "Ethernet-Local" | grep -w "connected")
   
    if [ -n "$usb" ] && [ -n "$ethweb" ] ; then
    nmcli c up Ethernet-Local   
    elif [ -z "$usb" ] && [ -n "$ethlocal" ] ; then
    nmcli c up Ethernet-Web
    fi


need to make it executable

Code: Select all
    sudo chmod +x /etc/NetworkManager/dispatcher.d/90-kdecon


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], lockheed, Sogou [Bot], Yahoo [Bot]