Hi, I found the method of obtaining the host IP in win-kex to be unreliable when using a VPN, that changes the resolv.conf file.

so i developed a python script to get the host IP from the output of 'ip addr'

since the windows host is always the first ip in the /20 network this was relatively easy

here is the code, i saved it as /opt/python/get_host.py
but this may not be the best location.

Code:
import subprocessimport re


ip_addr = subprocess.getoutput("ip addr")  # get the output of 'ip addr'
ip = re.findall(r"inet (1[79]\d.\d{1,3}.\d{1,3}.\d{1,3})/20", ip_addr)[0].split(".") # use regex to extract the ip address
ip = int.from_bytes([int(i) for i in ip], "big")  # str to int and then convert bytes to int 
mask = 4294963200  # /20 subnet mask as an integer 
ip_first = int.to_bytes((ip & mask) + 1, 4, "big")  # first host = (ip address & mask) + 1


print(f"{ip_first[0]}.{ip_first[1]}.{ip_first[2]}.{ip_first[3]}")  # print host address
then i altered the /usr/bin/kex script as follows

Code:
LINE 17
from:
HOSTIP=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}')
to:
HOSTIP=$(python3 /opt/python/get_host.py)
Hope this makes it into the next version of win-kex thanks.