Chapter 8: Connecting Two Ubuntu Servers Using Wi-Fi and Ethernet with Static Routes

Introduction

When connecting two servers, it is often useful to have multiple network interfaces active for redundancy, performance optimization, or security reasons. In this scenario, both servers have Wi-Fi and Ethernet interfaces and are connected to a router via Wi-Fi while also being directly connected via an Ethernet cable.

To ensure proper communication over Ethernet, we need to assign a different subnet to the Ethernet interfaces and configure static routes correctly. In this chapter, we will go step by step on how to achieve this using Ubuntu UI without relying on command-line tools.


Scenario Overview

We have two Ubuntu servers, each with Wi-Fi and Ethernet interfaces:

ServerWi-Fi IP (Router Assigned)Ethernet IP (Direct Connection)
Server A192.168.0.18 (via Wi-Fi)192.168.1.18 (via Ethernet)
Server B192.168.0.20 (via Wi-Fi)192.168.1.20 (via Ethernet)

Why Do We Need a Separate Subnet for Ethernet?

  1. Avoid Conflicts with Wi-Fi Subnet:

    • The Wi-Fi network (192.168.0.x) is managed by the router.

    • Ethernet interfaces must be in a different subnet (192.168.1.x) to avoid conflicts.

  2. Direct Communication Between Servers:

    • If both Ethernet interfaces were on 192.168.0.x, Ubuntu might still try to send data via Wi-Fi instead of Ethernet.

    • A different subnet forces direct Ethernet communication between the servers.

  3. Efficient Data Transfer:

    • Keeping Wi-Fi and Ethernet separate ensures that high-bandwidth traffic between the servers goes over Ethernet instead of Wi-Fi.

Step 1: Assigning Static IP Addresses to Ethernet Interfaces

Each server’s Wi-Fi interface is already assigned a static IP by the router. Now, we will configure the Ethernet interfaces with static IPs manually.

On Server A (192.168.1.18)

  1. Open Network Settings:

    • Click on the network icon in the top-right corner of Ubuntu.

    • Select SettingsNetwork.

  2. Select Ethernet Connection:

    • Find the Wired Connection section and click the gear icon next to it.
  3. Manually Assign an IP:

    • Click IPv4 Settings.

    • Choose Manual instead of DHCP.

    • Set the IP Address to 192.168.1.18.

    • Set the Netmask to 255.255.255.0.

    • Leave the Gateway blank (since this is a direct connection).

  4. Save and Restart the Connection.

On Server B (192.168.1.20)

Follow the same steps, but assign:

  • IP Address: 192.168.1.20

  • Netmask: 255.255.255.0

  • Leave Gateway blank


Step 2: Adding Static Routes for Direct Ethernet Communication

Now that we have assigned static IPs to the Ethernet interfaces, we need to configure routes so that traffic between the two servers prefers Ethernet over Wi-Fi.

On Server A (Routing to Server B)

  1. Go to Network SettingsWired ConnectionRoutes.

  2. Add a New Route:

    • Address: 192.168.1.20

    • Netmask: 255.255.255.255

    • Gateway: Leave blank (since it’s a direct connection)

    • Metric: 1 (lowest metric = highest priority, ensuring Ethernet is always used)

  3. Apply and Save.

On Server B (Routing to Server A)

Follow the same steps, but:

  • Address: 192.168.1.18

  • Netmask: 255.255.255.255

  • Metric: 1

Setting the metric to 1 ensures that all traffic between the two servers prefers Ethernet over Wi-Fi, since lower metric values indicate higher priority.


Step 3: Testing the Direct Ethernet Connection

After configuring the routes, we can test whether the direct Ethernet link is working.

Method 1: Check Active Routes (Using Ubuntu UI)

  1. Open Network Settings.

  2. Click on Wired ConnectionRoutes.

  3. Ensure that the route to 192.168.1.x is listed under static routes.

Method 2: File Transfer Test (If Servers Share Files)

  1. Open File Manager.

  2. Connect to the other server using SFTP (sftp://192.168.1.20 from A or sftp://192.168.1.18 from B).

  3. Transfer a file and observe the speed—it should be much faster than Wi-Fi!


Key Benefits of This Setup

Redundant Network Connection – If Wi-Fi fails, Ethernet still works.
High-Speed Data Transfer – Large file transfers happen over Ethernet, not Wi-Fi.
Separate Traffic for Better Performance – Internet traffic goes through Wi-Fi, while local data stays on Ethernet.
Easier Troubleshooting – Network monitoring tools can differentiate between Wi-Fi and Ethernet traffic.


Conclusion

By assigning static IPs on different subnets and configuring manual routes, we ensured that two Ubuntu servers prefer Ethernet over Wi-Fi for internal communication. This setup improves performance, reliability, and network management.

Key Takeaways:

Ethernet interfaces need a different subnet than Wi-Fi to avoid conflicts.
Static routes ensure direct Ethernet communication between servers.
Setting the metric to 1 forces all traffic to prioritize Ethernet over Wi-Fi.
Ubuntu UI provides an easy way to configure static IPs and routes.
Testing network performance confirms Ethernet is prioritized over Wi-Fi.


🚀 With this setup, your servers are now efficiently connected over both Wi-Fi and Ethernet!

🎯 End of Networking Basics Series – Now You’re Ready to Manage Networks Like a Pro!