Emulator Issues #12507

Dolphin sometimes uses wrong source IP for UDP packets

Added by Leseratte10 about 1 month ago. Updated about 1 month ago.

% Done:


Operating system:
Issue type:
Relates to usability:
Relates to performance:
Relates to maintainability:
Regression start:
Fixed in:


Game Name?

Probably any game, I tested with Mario Kart Wii

Game ID? (right click the game in the game list, Properties, Info tab)

RMCP01, probably applies to any game.

What's the problem? Describe what went wrong.

I'm running Dolphin on a linux machine with the following network configuration:

4: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 70:85:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic noprefixroute enp3s0
       valid_lft 2283sec preferred_lft 2283sec
    inet scope global enp3s0
       valid_lft forever preferred_lft forever
    inet6 2001:470:70bc:0:xxxx:xxxx:xxxx:xxxx/64 scope global dynamic noprefixroute 
       valid_lft 6756sec preferred_lft 3156sec
    inet6 fe80::xxxx:xxxx:xxxx:xxxx/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever is my "main" local IP in my normal network. is an extra IP I added to my machine manually.
My actual router (at is configured with a static route to send all traffic to
My Wii has the IP with gateway which makes my computer act as a router for the Wii.

Mario Kart Wii (and other Wii games, too) has a feature that when it figures out that two clients are behind the same internet connection (= have the same public IP) they tell eachother their local IP address and try to communicate directly, without using the NAT negotiation server.

When that happens in this particular constellation, Dolphin uses the wrong source IP and the Wii then errors out.

The Wii ( and Dolphin ( and come to the conclusion that they are on the same internet connection, and MKWii on Dolphin then tells the MKWii on the Wii "hey, we could skip all that server stuff, just contact me directly at".

The Wii obliges and sends an UDP packet from its IP ( to the IP that Dolphin claimed to have ( Then Dolphin replies to the Wii at, but chooses to use as the sender IP (as that IP is in the same network), and not the IP which it previously claimed to be. The Wii then goes "wait a minute, this response comes from the wrong IP" and cancels the connection.

This probably isn't an issue for most people (since I doubt many people have multiple local IPs on their machine AND want to play with a Wii in the same local network) but I wanted to report it anyways to make sure.

To fix it, I'd assume Dolphin would have to pick ONE local IP address from the system's network stack (in this case the first one,, and then always use that IP as sender of UDP packets even if the destination address is in the same subnet as one of the other existing IP addresses.

What steps will reproduce the problem?

I'm not sure if there's an easier way to reproduce this issue, but here's how it should work:

  • Take a Linux machine and add another IP to its network interface (ip addr add dev eth0)
  • Add a static route to your router, forwarding the whole network to your Linux machine
  • Enable forwarding / routing on that Linux machine: echo 1 > /proc/sys/net/ipv4/ip_forward
  • Configure a static IP from that new network on your Wii in the network settings (static IP, netmask, gateway
  • Start Mario Kart Wii on your Wii, connect to Wiimmfi and open a friend room
  • Start Mario Kart Wii in Dolphin, connect to Wiimmfi, and try to join your Wii's friend room.

Notice that after a bit of matchmaking the two clients do exchange peer-to-peer data over UDP, but the handshaking process fails (and is repeated over and over again) because the Wii notices the wrong IP.

Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.

It is, in 5.0-14191

Is the issue present in the latest stable version?

Not sure, can't successfully compile 5.0-stable. Tried a version from half a year ago (5.0-12725) and the issue is present there, too.

What are your PC specifications? (CPU, GPU, Operating System, more)

i9-9900K, RTX 2080Ti, Ubuntu 20.04


#1 Updated by sepalani about 1 month ago

AFAIK, Dolphin shouldn't (can't?) "change" its source IP address. It's based on the following heuristic:

  • Use the default network interface on Windows
  • Use a UDP socket and connect to to get its local ip

In theory, your Dolphin's local IP should always be
Unless the system's sendto function chooses another IP if the socket is unbound, I guess (probably the case, here).

The solutions I can think of would be:

  • Bind an unbound socket before sending data
  • Allow the user to choose the IP/network interface from the GUI
  • Use the Wii Network settings

Also available in: Atom PDF