Skip to main content

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​

  1. Connect the VPN first, so that its interface is up.
  2. Open Options → Connection and find Network interface under Network.
  3. Choose the interface in the list. Each shows its name and its IPv4 addresses; Any, the default, lets the system choose.
  4. 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 writenjMule binds to
NothingAny 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 itThe same, matched exactly.
An IPv4 address of this computer, such as 10.8.0.2That 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:

  1. it leaves the server, stops Kad and closes its listening ports;
  2. it stays offline: nothing reaches the network, not even another way;
  3. 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;
  4. 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 interfaceNot bound
The TCP port other clients connect to, and the UDP portsThe web interface, which listens as its own options say
Connections to servers and clientsUPnP'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​

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.

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.

  1. Turn Forward the ports with UPnP off.
  2. 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.
  3. 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.