The problem
Moving between networks means changing an adapter's IPv4 address, gateway, DNS and routes. Doing it manually repeats the same work and makes it easy to leave a setting behind.
What I built
I built a Windows app that saves named site profiles, lists network adapters and applies the selected profile. Lite reduces that to three steps: choose the profile, choose the adapter, apply. It also provides DHCP recovery, configuration backup and rollback.
- Choose a saved profile
- Choose the intended adapter
- Validate and apply
A route-validation example
The table below uses fictional documentation addresses. These behaviours are covered by the application's route-validation tests; it is not output from a client network.
| Input | Expected result | Why it matters |
|---|---|---|
198.51.100.31 | 198.51.100.31/32 via 192.0.2.1 | A host route inherits the profile gateway. |
203.0.113.0/24 via 192.0.2.5 | Uses the explicit next hop | A route can use a different router on the adapter's subnet. |
0.0.0.0/0 as an additional route | Rejected by validation | Additional routes cannot silently redirect all traffic. |
Code you can inspect
This excerpt is adapted from the C# test source, with names and addresses replaced. It uses the application's models and xUnit, so it is not a standalone test suite.
Show the route-validation excerpt
// Adapted excerpt from SiteNetSwitcher route-validation tests.
// Profile names and addresses replaced with documentation-only examples.
// Requires the application's models/services and xUnit; not a standalone test suite.
using SiteNetSwitcher.Models;
using SiteNetSwitcher.Services;
using Xunit;
public sealed class RouteExamples
{
private static SiteProfile Lab(params SiteRoute[] routes) => new()
{
Name = "Example lab", IpAddress = "192.0.2.100",
PrefixLength = 24, Gateway = "192.0.2.1", Routes = [.. routes]
};
private static SiteRoute Route(string destination, string via = "") =>
new() { Destination = destination, Via = via };
[Fact]
public void HostRouteIsNormalisedAndUsesProfileGateway()
{
var routes = ValidationService.ResolveRoutes(
Lab(Route("198.51.100.31")));
Assert.Equal(new ResolvedRoute("198.51.100.31/32", "192.0.2.1"),
Assert.Single(routes));
}
[Fact]
public void ExplicitNextHopOverridesProfileGateway()
{
var routes = ValidationService.ResolveRoutes(
Lab(Route("203.0.113.0/24", "192.0.2.5")));
Assert.Equal("192.0.2.5", Assert.Single(routes).NextHop);
}
[Fact]
public void CloningCopiesRoutesRatherThanSharingThem()
{
var original = Lab(Route("203.0.113.0/24"));
var copy = original.Clone();
Assert.Equal(original.Routes[0].Destination, copy.Routes[0].Destination);
Assert.NotSame(original.Routes[0], copy.Routes[0]);
}
}
Checks and limits
The test source also covers invalid destinations, duplicate routes, off-subnet routers and compatibility with older profile files. The app is in my daily workflow. Source examples explain the validation logic; they do not substitute for testing elevated network changes and rollback on Windows.