October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Forward Traffic from Another Port to Port 80 on Linux

Use nftables redirect or firewalld forward-port to send traffic from 8080 to local port 80. For another host, use DNAT with a destination address, enable forwarding, verify the return path, and make firewalld rules persistent.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To send TCP traffic arriving on port 8080 to a service on port 80, choose the rule that matches your network layout. On the same Linux host, use an nftables redirect to :80 rule or firewalld’s --add-forward-port without a destination address. If port 80 is on another machine, use destination NAT (DNAT), permit packet forwarding, and ensure the return path works.

Port translation is different from merely opening port 80. An open-port rule allows traffic to reach an application already listening there; a redirect or DNAT rule changes where the connection is delivered.

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

First decide which forwarding case you have

The correct rule depends on whether the destination service runs on the Linux machine receiving the connection or on a different host.

Same host: local redirect

A client connects to the Linux host on port 8080, while the application listens on port 80 on that same host. Use a NAT prerouting rule with redirect to :80. nftables describes redirect as a special form of DNAT that always translates the destination address to the local host. The destination port changes, but the service remains local.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Different host: routed DNAT

A client connects to one Linux machine on port 8080, but the application is on another machine, such as 192.0.2.14. Use DNAT with both a destination address and port. The Linux machine must also be allowed to forward packets, and replies must be able to return through the expected path.

Question Same-host redirect Remote-host DNAT
Where is the port-80 service? On the Linux host receiving traffic On a different host
nftables target redirect to :80 dnat to 192.0.2.14:80
Needs packet forwarding between hosts? No routed hop is required Yes; forwarding policy and return path must permit the flow
firewalld destination address Omit toaddr Set toaddr=192.0.2.14
Address family covered by the basic firewalld option IPv4 IPv4

Check the service and traffic before adding NAT

Port forwarding cannot compensate for a service that is stopped, listening on another port, or bound only where the incoming traffic cannot reach it. Perform these checks first.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Confirm that the application is listening on TCP port 80: ss -ltnp | grep ':80'.
  • Confirm that clients really use TCP. The examples below do not translate UDP, SCTP, or DCCP unless you create an appropriate rule.
  • Identify the interface on which traffic arrives and, when using firewalld, the zone assigned to that interface.
  • Decide whether the rule is temporary for testing or must survive a reboot and a firewalld restart.
  • Check whether Docker, UFW, firewalld, a distribution firewall service, or another component already manages the NAT table. Use one authoritative manager for a given NAT table where possible.

The example interface name ens3 and address 192.0.2.14 below are placeholders for the interface and destination address in your network. Replace them with your actual values.

nftables: redirect another port to local port 80

Use this method when both the listening application and the incoming connection terminate on the same Linux machine.

1. Create a NAT prerouting chain

Load a ruleset containing an IPv4 NAT table and a prerouting chain. The chain type and priority are important: NAT prerouting runs before the kernel makes the final local-versus-routed decision.

table ip nat {
  chain prerouting {
    type nat hook prerouting priority -100;
    tcp dport 8080 redirect to :80
  }
}

The rule matches TCP packets arriving for port 8080 and redirects them to local port 80. If clients use a different source port, that does not matter; the match is on the destination port.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

2. Apply the rule through your nftables configuration

Install the rule using the nftables configuration method provided by your distribution. If another service owns the NAT table, add the rule through that service instead of creating a competing table. A competing manager can overwrite or reorder rules during startup or reload.

3. Verify the listener and active rules

Run the listener check again, then inspect the active ruleset:

ss -ltnp | grep ':80'
sudo nft list ruleset

You should see a process bound to port 80 and the tcp dport 8080 redirect to :80 expression in the active ip nat prerouting chain.

4. Test from the actual client network

Connect to the Linux host at port 8080 from a client that normally uses this path. A local test from the host itself can take a different route and hook, so a successful loopback test does not prove that traffic arriving on the external interface is translated. Test both paths when hairpin or loopback access is part of your design.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Important limits of local redirect

  • The service must actually listen on port 80. Redirecting to an unused port produces a connection failure even though the NAT rule matches.
  • The rule is for TCP. Create a separate protocol-specific rule if the application uses another transport.
  • Traffic must arrive through the interface and address covered by the rule’s context. If you later move the service or change the interface, recheck the match.
  • Local redirect does not send traffic to another machine. Use DNAT with a destination address for that design.

nftables documentation records redirect availability beginning with Linux kernel 3.19. That is a compatibility note; your distribution’s nftables package and firewall-management service still determine how rules are loaded and retained.

nftables: forward port 8080 to port 80 on another host

For a remote application server, replace the local redirect with destination NAT. The incoming packet’s destination is rewritten to the remote address and port.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

1. Match the incoming interface and destination port

table ip nat {
  chain prerouting {
    type nat hook prerouting priority -100;
    iifname "ens3" tcp dport 8080 dnat to 192.0.2.14:80
  }
}

This example accepts only TCP packets arriving on ens3 for port 8080 and changes their destination to 192.0.2.14:80. Restricting the interface is useful when the Linux host has multiple networks and only one should expose the forwarded service.

2. Permit routed forwarding

DNAT changes the destination, but NAT alone does not make a blocked route work. The Linux host must be configured to forward packets, and its forwarding policy must allow traffic from the incoming interface toward the destination network. The remote server’s route for replies must also send return traffic through a path that preserves the connection.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When any of those conditions fails, clients may see a timeout even though sudo nft list ruleset shows the DNAT rule. Check the forwarding policy and the return route before changing the translation expression.

3. Confirm both endpoints

  • Verify that the destination host is listening on TCP port 80.
  • Verify that the forwarding Linux host receives the connection on the expected interface.
  • Verify that the destination host can send replies back through the forwarding path.
  • Test from the real client network, not only from the forwarding host or the destination host.

firewalld: forward a port with firewall-cmd

firewalld provides a higher-level forward-port interface. The basic option is an IPv4 feature and accepts TCP, UDP, SCTP, or DCCP. Specify the protocol explicitly so the rule matches only the traffic you intend to translate.

Same host: forward 8080 to local 80

sudo firewall-cmd --zone=public --add-forward-port=port=8080:proto=tcp:toport=80

This adds a runtime IPv4 forward-port rule in the public zone. It translates TCP traffic arriving at port 8080 to local port 80. Change public if the incoming interface belongs to another zone.

Remote host: add a destination address

sudo firewall-cmd --zone=public --add-forward-port=port=8080:proto=tcp:toport=80:toaddr=192.0.2.14

Adding toaddr changes the operation from a local destination to a remote IPv4 destination. firewalld’s documented behavior implicitly enables IP forwarding when toaddr is specified, but the forwarding policy and the remote host’s return route still need to permit the connection.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Make a firewalld rule persistent

Without --permanent, a forward-port rule is part of the runtime configuration and disappears after a reboot or firewalld restart. Add the permanent rule and reload:

sudo firewall-cmd --permanent --zone=public --add-forward-port=port=8080:proto=tcp:toport=80
sudo firewall-cmd --reload

After the reload, verify that the permanent configuration produced the expected active rule. If you add a runtime rule first for testing, add the equivalent permanent rule before restarting firewalld; otherwise the test result will vanish.

Do not confuse opening a port with forwarding it

sudo firewall-cmd --zone=public --add-port=80/tcp
sudo firewall-cmd --zone=public --add-service=http

These commands permit traffic to a service that already listens on port 80. They do not translate connections arriving on port 8080. Use --add-forward-port when the outside port and the service port differ.

IPv6 consideration

The documented --add-forward-port form is for IPv4. For IPv6 forward ports, use firewalld’s rich language rather than treating the IPv4 option as an IPv6 rule. Keep the address family explicit when troubleshooting so an apparently correct IPv4 translation is not mistaken for an IPv6 configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choosing nftables or firewalld

Situation Prefer Reason
Distribution already manages firewall policy with firewalld firewall-cmd forward-port Keeps the translation in the same zone and persistence model as the rest of the host firewall.
You manage a native nftables ruleset directly nftables redirect or DNAT Provides direct control over table, chain, interface, and priority.
Service is on the same host Local redirect No routed destination address is needed.
Service is on another host DNAT or firewalld with toaddr Rewrites both destination address and port and requires forwarding.
Need IPv6 with firewalld Rich language The basic forward-port option is documented for IPv4.

Do not configure the same translation independently in nftables and firewalld unless you deliberately understand which manager owns the rules. A reload or service restart can replace rules created by the other manager.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting: find the failing layer

Work from the application outward. This order separates a missing listener from a NAT, zone, forwarding, or return-path problem.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
  1. Check the target listener. Run ss -ltnp | grep ':80'. If nothing is listening, start or reconfigure the application before debugging NAT.
  2. Check protocol and port. Confirm the client uses TCP and actually connects to 8080. A UDP client will not match a TCP rule.
  3. Check interface or zone. For nftables, verify that the packet arrives on the interface named in the rule, such as ens3. For firewalld, verify that this interface is in the zone where you added the forward-port rule.
  4. Inspect the active configuration. Use sudo nft list ruleset for nftables. For firewalld, list the zone’s forward ports with firewall-cmd and confirm that the runtime rule exists after any reload.
  5. Separate local redirect from routed DNAT. If the service is remote, a redirect to :80 rule is the wrong target. Use DNAT with toaddr and the remote address.
  6. Check forwarding and policy. With toaddr or a native DNAT rule, ensure IP forwarding is enabled and the forwarding policy permits the incoming-to-outgoing path. NAT does not override a blocked forwarding policy.
  7. Check the return path. The destination host must return replies through a route that allows the connection to complete. Firewalld statefully allows the return path for established connections when the policy permits the initial flow, but the network route still has to be correct.
  8. Check persistence. A rule that worked until reboot or firewalld restart was probably runtime-only. Re-create it with --permanent and reload firewalld, or use your distribution’s nftables persistence mechanism.
  9. Check competing managers. Docker, UFW, firewalld, or another distribution service may overwrite the NAT table. Choose one authoritative manager and inspect the rules after each reload.
  10. Test from the correct vantage point. Test from the actual client network as well as locally. Hairpin and loopback traffic can traverse different hooks and policies, so a local success or failure may not represent external clients.

Common configuration mistakes

Opening port 80 instead of translating 8080

An --add-port=80/tcp or HTTP service rule only permits traffic addressed to port 80. Clients still connecting to 8080 will not be moved automatically.

Using local redirect for a remote server

redirect to :80 always targets the local host. For another machine, specify a destination address with DNAT or firewalld’s toaddr.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Forgetting the protocol

A TCP rule does not match UDP, SCTP, or DCCP. Confirm the application’s transport and create a matching rule for that protocol if required.

Adding a runtime firewalld rule only

Runtime state is intentionally temporary. Use --permanent and reload when the forwarding rule must survive a restart.

Assuming NAT bypasses firewall policy

Translation changes addresses and ports; it does not grant permission to route packets. Remote forwarding still depends on IP forwarding, zone or forwarding policy, and a valid return route.

Operational checklist

  • Identify whether the service is local or remote.
  • Confirm the service listens on TCP port 80.
  • Match the incoming port 8080 and the correct protocol.
  • Use redirect to :80 only for a local destination.
  • Use DNAT with a destination address for a remote destination.
  • Match the incoming interface or firewalld zone.
  • Permit packet forwarding and verify the return path for remote DNAT.
  • Inspect active rules after loading or reloading the firewall.
  • Make firewalld rules permanent when they must persist.
  • Test from the real client network, including any hairpin or loopback scenario.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.