Jump to content

Client bind to interface/IP?


Recommended Posts

Rubin Starset
Posted

Hi there. Windows 10 server, Debian client. The Server is a desktop with a static address on an ethernet NIC, and the Debian client is a laptop with both wifi and ethernet through a dock both with separate static addresses. The client likes to connect to the server primarily through my wifi interface. I'd like it to only connect via the ethernet interface (which coincides with when the laptop is actually docked right next to my Windows displays. The messy solution I have is to simply block the Synergy port via an iptables rule for the wifi interface. I'd just like to have a bind to IP/interface that's part of the Synergy client. I couldn't find any info on such a thing, does it exist?

  • Like 1
Rubin Starset
Posted (edited)

 

Just for reference here's the messy way I'm doing it with NetworkManager under Debian...

Enable and start the NetworkManager-dispatcher.service:

$ sudo systemctl enable NetworkManager-dispatcher.service
$ sudo systemctl start NetworkManager-dispatcher.service

Create a dispatcher script that contains your rules:

$ sudo vim /etc/NetworkManager/dispatcher.d/wlp61s0-firewall.sh

Note that wlp61s0 is the interface name I'm targeting for these rules:

#!/usr/bin/env bash

interface=$1
event=$2

if [[ $interface != "wlp61s0" ]] || [[ $event != "up" ]]
then
  return 0
fi

/sbin/iptables -F		# Clear FW rules
/sbin/iptables -A OUTPUT -o wlp61s0 -p tcp --dport 24800 -j DROP        # Block synergy on wifi

Give the file safer permissions:

$ sudo chmod 755 /etc/NetworkManager/dispatcher.d/wlp61s0-firewall.sh

Cycle the wifi interface down and then back up through Network Manager's UI, then check to see if the iptable rule was added:

$ sudo iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A OUTPUT -o wlp61s0 -p tcp -m tcp --dport 24800 -j DROP

If you encounter some issues, check the status of the dispatcher service:

$ sudo systemctl status NetworkManager-dispatcher.service

 

Edited by Rubin Starset
  • 4 months later...
HorsetoWater
Posted

same situation here... would be nice to specify default 'mode' of connecting the client to the server rather than having it default to wifi each time

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...