XK9274 / syncthing-app-miyoo

Sets up Syncthing and injects into Onions runtime
71 stars 2 forks source link

IP Bind Issue #1

Closed MichaelRPowell closed 8 months ago

MichaelRPowell commented 1 year ago

Hello,

During first install I was on a 192.168.1.x network. Now I am on another network with the same subnet 192.168.1.x. I looked in the logs, because Syncthing seems to be failing. It appears it is trying to bind to the previous address it had on the old network.

Let's say it had 192.168.1.2, on this new network it is 192.168.1.3. It is failing to start as a service because somewhere it seems to be set to bind to 192.168.1.2 no matter what the current IP is. It worked perfectly on the previous network. I was surprised when I noticed it wasn't running.

I am submitting here because it seems like a bug, but I'm not sure where this is statically set. It could be a Syncthing issue if not a problem with the initial config generated by program you've written.

I haven't dove into the code yet. If there is an easy way to update the IP it tries to bind to, please let me know!

Thanks!

XK9274 commented 1 year ago

Hey how's it going?

That's an oversight by me, I write the IP address to the config file at the first run and don't actually offer a way to reset the IP. Thanks for dropping this in.

In the short term you can open the file:

/mnt/SDCARD/App/Syncthing/config/config.xml. And modify the IP address to the new one your MMP is using on the new network.

For the long term I'll fix the launch script to reset the IP on the second run & updatethis issue when it's done :)

Cheers!

MichaelRPowell commented 1 year ago

Sounds great!

Thanks for the quick fix and fast response. 🙂

XK9274 commented 1 year ago

No worries! I've modified the installer to set 0.0.0.0 in the config file so you don't need to keep changing your IP, it'll just accept connections on whatever the current IP of the device is :)

https://github.com/XK9274/syncthing-app-miyoo/commit/09126d0faf2801661af64303207d178b4a57d701

For you and anyone that may see this, you can just modify your config.xml to change the IP to:

<gui enabled="true" tls="false" debugging="false">
        <address>0.0.0.0:8384</address>
MichaelRPowell commented 1 year ago

Perfect! I actually thought about that last night, but didn't have a chance to try it yet. I also wasn't sure if there was a downside for using 0.0.0.0, but with only one network interface I assume in most cases it isn't an issue.

Though.. I want to see about getting Wireguard running on this as a VPN solution, which could create a second visible interface. 😅

XK9274 commented 1 year ago

There's actually 2 interfaces (we think it's a pseudo interface though as it's off the same chip, although both can work at the same time) :

/mnt/SDCARD/App/pygame/gs # ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 34:7D:E4:01:28:A4
          inet addr:192.168.1.149  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:18796 errors:0 dropped:6435 overruns:0 frame:0
          TX packets:7140 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3615603 (3.4 MiB)  TX bytes:5903713 (5.6 MiB)

/mnt/SDCARD/App/pygame/gs # ifconfig wlan1 up
/mnt/SDCARD/App/pygame/gs # ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 34:7D:E4:01:28:A4
          inet addr:192.168.1.149  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:18934 errors:0 dropped:6454 overruns:0 frame:0
          TX packets:7221 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3635546 (3.4 MiB)  TX bytes:5914843 (5.6 MiB)

wlan1     Link encap:Ethernet  HWaddr 36:7D:E4:01:28:A4
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

/mnt/SDCARD/App/pygame/gs #

I found wlan1 when i was researching setting up the hotspot for Onion, we actually use wlan1 to create the hotspot for various reasons.

Your point still stands though, It's probably not going to matter at all using 0.0.0.0 and the convenience far outweighs any issues I can think of atm 😅

Re: wireguard i've not had much dealings with it.. Will look it up and maybe build a copy if it's not full of dependency holes 😂

XK9274 commented 8 months ago

Closing