FBI-Go is a utility that allows you to force applications to use a specific network interface/IP address for their outgoing connections, similar to the ForceBindIP utility for Windows. This is particularly useful for systems with multiple network interfaces where you need to control which interface is used for specific applications.
FBI-Go works by intercepting network-related system calls (bind, connect, getaddrinfo) using the LD_PRELOAD mechanism on Linux. When an application tries to make a network connection, FBI-Go forces it to bind to the specified IP address first.
- Force applications to use a specific IP address/network interface
- Supports both IPv4 and IPv6 addresses
- Works with any application that uses standard network system calls
- No modification of the target application required
- Transparent to the application being run
- Linux operating system
- Go 1.23.0 or later
- A C compiler (for CGO)
You can build FBI-Go using the included Makefile:
make allThis will build both the shared library (binder.so) and the loader binary (fbi).
To build components separately:
# Build just the shared library
make build-binder
# Build just the loader
make build-loaderAfter building, you can install FBI-Go by copying the fbi binary and binder.so to a directory in your PATH:
sudo cp fbi binder.so /usr/local/bin/fbi <IP_ADDRESS> <COMMAND> [ARGS...]Force curl to use a specific IP address:
fbi 192.168.1.100 curl example.comForce curl to use a specific IPv6 address:
fbi 2001:db8::1 curl example.comForce a web browser to use a specific interface:
fbi 10.0.0.5 firefoxRun a server application binding to a specific IP:
fbi 172.16.1.5 python -m http.server 8080- You must use an IP address that actually exists on one of your network interfaces
- To see your available IP addresses, run:
ip addr - Both IPv4 and IPv6 addresses are supported
- The application being run must use standard system calls for networking
FBI-Go consists of two main components:
- A shared library (
binder.so) that intercepts network-related system calls - A loader program (
fbi) that sets up the environment and executes the target application
When you run the fbi command, it:
- Sets the
LD_PRELOADenvironment variable to point to thebinder.solibrary - Sets the
FORCE_BIND_IPenvironment variable to your specified IP - Executes your command with its arguments
The intercepted system calls then ensure that all network connections are bound to the specified IP address.
- Can only bind to IP addresses actually assigned to your interfaces
- Some applications with special privilege handling may not work correctly
If you encounter issues:
- Verify that the IP address you're trying to bind to exists on your system
- Check that the
binder.sofile is accessible - Make sure the application you're running uses standard network system calls
- Run with strace to see what's happening:
strace -f fbi <IP> <command>
This project is licensed under the MIT License.
Contributions are welcome! Feel free to submit issues or pull requests.