Announcement

Collapse
No announcement yet.

Can kdeconnect work while two networks are active at the same time?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Can kdeconnect work while two networks are active at the same time?

    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)?
    I have tried something like this, without any success
    https://www.tldp.org/HOWTO/Adv-Routi...netfilter.html

    Thanks anyway for the help

    #2
    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:
        sudo nano /etc/NetworkManager/dispatcher.d/90-kdecon
    And here's what's inside the script

    Code:
      #!/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:
        sudo chmod +x /etc/NetworkManager/dispatcher.d/90-kdecon

    Comment


      #3
      Thanks for posting your solution!
      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
      – John F. Kennedy, February 26, 1962.

      Comment

      Working...
      X