IP Forwarding: Does it Actually Work on Isolated Machines with Two Wired Networks?

Abstract: Enable IP forwarding on isolated Ubuntu machines by setting net.ipv4.ip_forward=1 in sysctl and configuring static IPs via Netplan to route traffic between separate subnets.

Created: 2026-08-02 by
Yes, IP forwarding works on isolated machines with two wired networks provided the kernel parameter is enabled and the network interfaces are correctly configured. A fresh Ubuntu 22.04 LTS installation requires explicit activation of the forwarding capability via sysctl settings. Without this configuration, the operating system will drop packets destined for the other subnet, even if both physical connections are active and cabled.

Understanding Isolated Network Topologies

An isolated machine in this context refers to a server or workstation that possesses two distinct network interface cards (NICs) connected to separate physical networks. These networks do not share a common router or gateway between them. The primary goal is to allow traffic to flow from one subnet to another through the host machine itself. This setup effectively turns the computer into a software-based router.

It is crucial to distinguish this scenario from standard routing where a default gateway exists. In an isolated environment, there is no external path for return traffic unless the source devices have specific routes pointing back to the forwarding machine. The machine acts as a bridge at Layer 3, inspecting and directing packets based on their destination IP addresses rather than MAC addresses alone.

Configuring Kernel Parameters

The Linux kernel disables IP forwarding by default for security reasons. To enable it, you must modify the net.ipv4.ip_forward parameter. This change can be made temporarily for testing or permanently for production use. For a persistent configuration on Ubuntu 22.04, you should edit the sysctl configuration files.

  1. Open the sysctl configuration file using a text editor with root privileges. The standard location is /etc/sysctl.conf.
  2. Add the following line to the end of the file: net.ipv4.ip_forward=1.
  3. Save the changes and exit the editor.
  4. Apply the new settings immediately by running the command sudo sysctl -p.

You can verify that the setting has been applied by checking the current value. Run sysctl net.ipv4.ip_forward. If the output is net.ipv4.ip_forward = 1, the kernel is now permitted to forward packets between interfaces. If it returns 0, the configuration was not loaded correctly.

Network Interface Configuration

Simply enabling forwarding is not enough; the network interfaces must also be properly assigned to their respective subnets. Ubuntu uses Netplan for network configuration in modern versions. You need to ensure that each interface has a static IP address corresponding to its local subnet.

For example, if your first interface is eth0 connected to subnet 192.168.1.0/24 and the second is eth1 connected to 10.0.0.0/24, your Netplan YAML file should reflect these assignments. Ensure that the dhcp4 option is set to false if you are using static addressing, which is typical for router-like setups.

After modifying the Netplan configuration, apply the changes using sudo netplan apply. Verify that both interfaces show their correct IP addresses by running ip addr show. Both interfaces must show a state of UP. If an interface is down, the forwarding mechanism cannot function because there is no link to receive or transmit data.

Verifying Connectivity and Troubleshooting

Once forwarding is enabled and interfaces are configured, test the connectivity. From a device on the first subnet, attempt to ping an IP address on the second subnet. If the ping fails, the issue is rarely the forwarding setting itself but rather routing or firewall rules.

Check the routing table on the client devices. The client on subnet A must know that to reach subnet B, it should send packets to the IP address of the forwarding machine's interface on subnet A. Similarly, the client on subnet B needs a route back to subnet A via the forwarding machine. Without these static routes on the endpoints, traffic will be dropped because the return path is unknown.

If you suspect firewall interference, check for any active iptables or nftables rules. Although the initial premise assumes no complex firewall rules, Ubuntu may have default policies that drop forwarded traffic. You can check this by reviewing iptables -L -n -v. Look for chains named FORWARD. If the policy is DROP, you must add rules to ACCEPT traffic between the specific interfaces.

Another common pitfall is ARP resolution. Since the forwarding machine is not a router in the traditional sense of NAT, ARP requests for IPs on the remote subnet will not be answered by the intermediate machine unless proxy ARP is enabled. However, for simple point-to-point forwarding between known subnets, standard routing usually suffices without proxy ARP.

If you are dealing with virtual machines or complex nested networking, consider how traffic flows between VMs and the host. Properly configuring traffic routes ensures that data moves seamlessly across boundaries.

Frequently Asked Questions

Does enabling IP forwarding expose my machine to security risks?

Yes, enabling IP forwarding allows your machine to act as a router, which can potentially expose internal networks if not properly secured. You should implement strict firewall rules to control which traffic is allowed to pass between the interfaces. Always review your iptables or nftables configurations to ensure only necessary ports and protocols are forwarded.

Why does ping work but TCP connections fail?

This often indicates that ICMP traffic is allowed while TCP or UDP traffic is blocked by a firewall. Check your firewall rules specifically for the FORWARD chain. Additionally, ensure that the destination service is listening and that no stateful inspection rules are dropping established connections due to misconfigured NAT or filtering policies.

Can I use DHCP for the interfaces in a forwarding setup?

While technically possible, using DHCP for interfaces involved in IP forwarding is generally discouraged for stable routing setups. Static IP addresses provide predictable routing tables and prevent issues if the DHCP server goes offline. Most router configurations require fixed IPs to ensure consistent connectivity for clients relying on the forwarding machine.

How do I check if packets are actually being forwarded?

You can monitor packet flow using tools like tcpdump on both interfaces. Run sudo tcpdump -i eth0 and sudo tcpdump -i eth1 simultaneously. If you see packets arriving on one interface and leaving the other, forwarding is working. You can also check kernel statistics via cat /proc/net/snmp to view counters for IP forwarding.

What happens if I reboot the system?

If you only used sysctl -p without editing the configuration file, the forwarding setting will be lost after a reboot. To make it permanent, you must ensure net.ipv4.ip_forward=1 is present in /etc/sysctl.conf or a file within /etc/sysctl.d/. Ubuntu loads these configurations during the boot process, restoring the forwarding capability automatically.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More