Skip to content

SLiRP: Support for changing the network.#6783

Merged
OBattler merged 3 commits into
86Box:masterfrom
chungy:slirp_custom_addr
Feb 7, 2026
Merged

SLiRP: Support for changing the network.#6783
OBattler merged 3 commits into
86Box:masterfrom
chungy:slirp_custom_addr

Conversation

@chungy

@chungy chungy commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

Since the default 10.0.2.0/24 (or 10.0.3.0... etc) address can conflict with a LAN (as it does in my case), this feature now adds the ability to set custom network prefixes in the configuration file. I believe this is an “advanced” usage feature (like port forwarding) and should not be exposed in the GUI, therefore no GUI changes have been made.

In the [Network] section of 86box.cfg, each of the four NICs can be set to have a custom address like such:

net_01_addr = 10.80.88.0
net_02_addr = 10.82.86.0
net_03_addr = 10.84.86.0
net_04_addr = 10.85.86.0

The last octet of the address is effectively ignored and always set to 0 again when the configuration file is saved. Only a /24 CIDR (netmask 255.255.255.0) is supported. IPv4 has three local-scope ranges: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0. Finding a network prefix within these that do not conflict with your real LAN should not pose a problem.

This change has only been tested on Linux. Code review is greatly appreciated, too.

Summary

The feature working with a TinyCore VM with all four NICs set to the above setting:
Screenshot_20260206_172409

Checklist

References

Provide links to datasheets or other documentation that helped you implement this pull request.

Since the default 10.0.2.0/24 (or 10.0.3.0... etc) address can
conflict with a LAN (as it does in my case), this feature now adds the
ability to set custom network prefixes in the configuration file.  I
believe this is an “advanced” usage feature (like port forwarding) and
should not be exposed in the GUI, therefore no GUI changes have been
made.

In the `[Network]` section of 86box.cfg, each of the four NICs can be
set to have a custom address like such:

```
net_01_addr = 10.80.88.0
net_02_addr = 10.82.86.0
net_03_addr = 10.84.86.0
net_04_addr = 10.85.86.0
```

The last octet of the address is effectively ignored and always set to
0 again when the configuration file is saved.  Only a /24 CIDR
(netmask 255.255.255.0) is supported.  IPv4 has three local-scope
ranges: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0.  Finding a network
prefix within these that do not conflict with your real LAN should not
pose a problem.
Still untested on the OS, but Grok pointed me to the alternative
function to use.  Hope it works.
This exists on all platforms, no messy #ifdef needed.
@OBattler OBattler merged commit 7ec2e3f into 86Box:master Feb 7, 2026
45 checks passed
@chungy chungy deleted the slirp_custom_addr branch February 7, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants