linuxgpsbinddaemongpsd

How to bind gpsd to some specific network interface?


In my pc currently 3 different network interfaces exists (interface1,interface2,interface3 ).I want to start gpsd daemon such a way that it should bind to some specific interface which i want.

Currently iam running gpsd as below

gpsd -b -n   #Here gpsd binds to localhost.

My goal is to run gpsd something like

gpsd -b -n interface1_ip   #here gpsd should bind to only interface1. 

how can i do this?


Solution

  • A quick and dirty way would be to start gpsd with the -G option, to enable monitoring all interfaces (by default, gpsd will only listen to localhost for security and privacy) and then disable access on unwanted interfaces by having proper firewall rules (disable access on two unneeded interfaces). Gpsd will listen on port 2947, you can change that with the -S option to fit your needs.