Binding to an interface
A computer can reach the network in several ways: Wi-Fi, a cable, a VPN tunnel. By default njMule uses whichever the system picks. You can instead bind it to one interface, so that every connection goes through that interface only. The usual reason is a VPN: bound to the VPN's interface, njMule cannot reach the network around it, and when the VPN drops, njMule goes offline instead of falling back to your own connection (a kill switch).
Choose the interface
- Connect the VPN first, so that its interface is up.
- Open Options → Connection and find Network interface under Network.
- Choose the interface in the list. Each shows its name and its IPv4 addresses; Any, the default, lets the system choose.
- Click Apply and reconnect in the bar under the page.
The list holds the interfaces of the computer njMule runs on that are up, have an IPv4 address and are not the loopback; the web interface shows the same list. A choice that is not there now shows as wg0 (not available).
In njmule.properties the option is net.bindInterface, which takes:
| You write | njMule binds to |
|---|---|
| Nothing | Any interface (the default). |
An interface name, such as wg0, tun0 or eth1 (case does not matter) | That interface's first IPv4 address that is not a link-local one (169.254.x.x, the address an interface takes while it waits for its own). |
| An interface's display name, as the system shows it | The same, matched exactly. |
An IPv4 address of this computer, such as 10.8.0.2 | That address, as long as an interface that is up has it. |
Prefer the name: many VPNs give a new address at each connection, and a bound address that is gone keeps njMule offline. An eMule profile you import brings its bind address along.
When the interface goes away
njMule looks at the interface every ten seconds. When it is gone, or has lost its IPv4 address:
- it leaves the server, stops Kad and closes its listening ports;
- it stays offline: nothing reaches the network, not even another way;
- the desktop app and the web interface show a banner, The network interface wg0 is not available: njMule stays offline until it is back., with a button to the options, and the log says the same;
- connections that were open through the interface end with it.
When the interface is back (or comes back with another address), njMule opens its ports on it
again, starts Kad again (unless you turned it off), connects to a server when Autoconnect on
startup is on, asks the router again for its ports, and logs Connections go through wg0 (10.8.0.2). It does the same when it starts while the interface is missing: it starts offline and
waits.
What is bound
| Bound to the interface | Not bound |
|---|---|
| The TCP port other clients connect to, and the UDP ports | The web interface, which listens as its own options say |
| Connections to servers and clients | UPnP's search for the router, which looks on every local network |
Lists fetched from the web (server.met, nodes.dat, IP filters) | |
| The update check and update downloads, the country database | |
| E-mail and web hook notifications, which are not sent while the interface is gone |
While njMule is bound, it uses no IPv6 at all: the interface is chosen by its IPv4 address, and IPv6 connections would leave around it (see IPv6).
Typical VPN set-ups
- Windows
- macOS
- Linux
WireGuard and OpenVPN each add a network adapter while the tunnel is up. Connect the tunnel,
then choose its adapter in Network interface: the list names it as Windows describes it (for
example a WireGuard Tunnel or TAP-Windows Adapter entry) with its tunnel address. To find it
yourself, run ipconfig and look for the adapter holding the VPN's address.
VPN tunnels show as utun interfaces (utun3, for example), whose number may change from one
connection to the next. Run ifconfig while the VPN is connected to find the one with the VPN's
address. If the number changes, bind to the VPN's address instead, if your provider keeps it:
write it in net.bindInterface of njmule.properties while njMule is stopped, since the list
offers interfaces only.
WireGuard names its interface after its configuration (wg0 for /etc/wireguard/wg0.conf), and
OpenVPN usually uses tun0. Check with:
ip -4 addr show
then choose that interface in Network interface.
Port forwarding with a VPN
Bound to a VPN, other clients reach you through the VPN provider's address, not your home router's. Forwarding ports in your router, or with UPnP, does nothing for them then.
- Turn Forward the ports with UPnP off.
- If your provider offers port forwarding, ask for a port and set njMule's Client Port (TCP) to it; ask for the UDP port too if the provider forwards UDP. The port outside must be the same number njMule uses, since that is the one it tells the networks.
- Click Apply and reconnect, then Test Ports (see Ports).
Without a forwarded port you have a LowID and are firewalled on Kad; callbacks, buddies and NAT traversal still let you trade with many clients.