Port Forwarding on Router and Why do we need It - GeeksforGeeks (2024)

Skip to content

Port Forwarding on Router and Why do we need It - GeeksforGeeks (1)

Last Updated : 18 Jan, 2021

Summarize

Comments

Improve

Suggest changes

Like Article

Like

Save

Report

Router port forwarding is used to allow the remote computers to connect to a specific service or computer on a Local Area Network. Now the question is why do we need it. And we will discuss all of these things one by one.

Use Cases :

  1. Suppose you are at the office and want to connect to your computer which is present in your house, the computer present at the house is connected to the WiFi of house which is a LAN(Local Area Network) one of the ways to connect to your house computer is port forward ssh(port 22) in your Router to your computers IP address and open ssh port on your computer. Now, who so ever will try to ssh to your public IP address will be forwarded to your computer present at your house.
  2. Suppose you want to host a website on your computer and you want everyone on the internet can access your website, this can be achieved by port forwarding. What you have to do is that port forward HTTP (port 80) or HTTPS(port 443) from your router to your computer on which your website is deployed. Hurray Knows anyone with your public IP address can access your website.

These are only two used cases that explain what is the need for Port forwarding, you can do much more like accessing the camera connecting to your LAN, accessing the printer connected on your LAN from anywhere in the world, you can also host a Minecraft server on your machine and invite friends to connect with it.

How To Implement Port Forwarding On Your Router :

Before starting with how to implement port forwarding two basic things are needed :

  1. Your Public IP address must be static because most of the normal internet connections have dynamic public addresses i.e the IP address changes after few hours or few days, so each time you have to connect to the machine present at your LAN you have to get your public IP address. Though for some users dynamic IP address will not be a big issue but in case you don’t want to know the IP again and again then you can ask your ISP to provide you a static IP.
  2. The 1st requirement was not that necessary the second requirement is very much necessary. You have to assign your machine(To whom you want to connect remotely) a static private IP address and this can be done very easily through your router and from your machine itself. This requirement is necessary because during port forwarding on the router we have to mention the IP address of the machine to which we want to forward the port so if the private IP address of the machine will be dynamic we have to configure port forwarding on the router again and again which is feasible.

Procedure :

Step-1 :

Open the default gateway of your WiFi router usually the IP address of the default gateway for most of the routers is http://192.168.1.1 find your router’s gateway address and open it in your browser this will open the routers setting page login into this page.

Port Forwarding on Router and Why do we need It - GeeksforGeeks (3)

Step-2 :

After login search for NAT, Virtual Server, and after that enter the port or service you want to forward, after that enter the IP address of the machine to which you want to. forward that port(Please note that this is the general procedure for every router, for your router it may vary slightly)

Step-3 :

Now you can easily access your machine with your public IP address remotely

Note –

Please note that if your machine(to whom you want to connect remotely) have a firewall installed then you have to manage that firewall to allow the remote requests



Please Login to comment...

Similar Reads

Difference Between SSH Local and Remote Port Forwarding

SSH stands for "Secure Shell" or "Secure Socket Shell". It is a cryptographic network protocol that allows two computers to communicate and share the data over on insecure network such as the Internet. SSH protocols protect the network from various attacks. Local Port ForwardingLocal Port Forwarding is the common type of port forwarding. It is used

6 min read

SSH Port Forwarding

SSH Port forwarding is a method used for securing TCP/IP connections. The TCP/IP packets can be tunneled through a SSH link making the data obscure thus protecting the link from attacks. SSH Port forwarding can be also seen as a form of Virtual Private Network(VPN). Types of Port Forwarding: There are 2 main types of port forwarding: Local Port For

2 min read

Difference between Root Port and Designated Port

Root Port and Designated Port are very important concepts in network switching, along with the Spanning Tree Protocol, which would have been like a runaway train causing loops and not allowing for effective data flow. Root Port is that one port on a switch that takes the shortest path toward the Root Bridge, whereas Designated Port controls which i

5 min read

Difference Between Trunk Port and Access Port

When it comes to networking, two terms that are “access port” and “trunk port" arises in our mind. They both sound familiar but both of these types have different functions. While commonly associated with Cisco, access ports and trunk ports are standard networking concepts utilized across various network equipment vendors. Access Port is a port tha

4 min read

How to Add Port in Router in CISCO Packet Tracer?

Cisco Packet Tracer is a tool built by Cisco and it provides network simulation to practice simple and complex networks. The main purpose of the Cisco Packet Tracer is to help students learn the principles of networking and demonstrate the networking concepts. Router is a networking device that works in the network layer and can connect two differe

2 min read

Hot Standby Router Protocol (HSRP) and Virtual Router Redundancy Protocol (VRRP)

Hot Standby Router Protocol (HSRP) is a CISCO proprietary protocol used to provide redundancy in a network. Only one router is the active router while others will be in standby state i.e the standby router will be responsible for forwarding the traffic when the active router fails. Virtual Router Redundancy Protocol (VRRP) is an open standard proto

3 min read

Internal and External Forwarding Rule in GCP

What is a Forwarding Rule?In Cloud Computing and specifically focusing on Google Cloud Platform, a Forwarding Rule is set up to allow incoming traffic and direct it from individual ports within a specific range to particular ports on user VM's on Google Cloud Platform. This range of ports can be opened on the public IP Address by using firewall rul

4 min read

Network Layer Services- Packetizing, Routing and Forwarding

The network Layer is the third layer in the OSI model of computer networks. Its main function is to transfer network packets from the source to the destination. It involves both the source host and the destination host. Key among these services are packetizing, routing, and forwarding. Packetizing involves encapsulating data into packets suitable f

8 min read

Selective forwarding Attack in wireless Sensor Network

A selective forwarding attack is a type of security attack that can occur in wireless sensor networks (WSNs). In this attack, a malicious node in the network selectively forwards some data packets to the base station while dropping others, with the goal of compromising the integrity and availability of the network. The attacker can use various tech

8 min read

Frame forwarding methods on Switches

There are 2 methods that all switch use for forwarding the frames (switching data) between the network ports: Store and forward switching Cut-through switching These are explained as following below. 1. Store and forward switching : In this switching technique, when the switch receives the frame, it stores the frame data in buffers until the full f

3 min read

Why TCP Connect Termination Need 4-Way-Handshake?

The modern developments in everyday life, in terms of technology and the internet, are only made possible with the help of the TCP/IP suite. TCP is been used for communication among devices on the network. It stands for Transmission Control Protocol. It can work with any type of network, whether personal networks or the internet. For instance, it c

8 min read

Why Do We Need IP Address if We Have Already MAC Address?

Answer: The network allots an IP address to every connected device making sure that every device can be identified separately within the network. Each device is identified by its MAC address, which cannot be shared by two devices. The MAC address is assigned by the embedded Network Interface Card (NIC) of each device and cannot be altered once set.

1 min read

Difference Between IP Address and Port Number

In computer networking, two fundamental concepts are crucial for understanding how devices communicate over a network. IP addresses and port numbers are the characteristic features of TCP/IP and their definition is as follows. An IP address is a unique address assigned to each machine that is connected to a network to locate the machines and commun

4 min read

Difference Between Network Address Translation (NAT) and Port Address Translation (PAT)

In the world of networking, most of the uses of IP addresses are important due to the limited availability of IPv4 addresses which is a part of network address translation. Two technologies that have been developed to address this problem are Network Address Translation and Port Address Translation. These technologies not only help to keep IP addre

6 min read

Port Security in Computer Network

Attackers' task is comparatively very easy when they can enter the network they want to attack. Ethernet LANs are very much vulnerable to attack as the switch ports are open to use by default. Various attacks such as Dos attack at layer 2, address spoofing can take place. If the administrator has control over the network then obviously the network

3 min read

Type-C Port in Computer Network

Type-C (or USB-C) is a 24-pin USB connector system. This is distinguished by its two-fold rotationally symmetrical connector. The USB Type-C Specification 1.0 was published by the USB Implementers Forum (USB-IF). It was finalized in August 2014. A device that implements USB-C does not necessarily implement USB Power Delivery, USB 3.1, or Alternate

4 min read

Port Address Translation (PAT) on Adaptive Security Appliance (ASA)

Port Address Translation (PAT) is a type of Network address translation (NAT) used when there is a shortage of public IP addresses .One of the public IP address of the same subnet or the interface address is used for translation. Port Address Translation (PAT): This is also known as NAT overload. In this, many local (private) IP addresses get trans

5 min read

Port Address Translation (PAT) mapping to Private IPs

In this article we will be learning how exactly a Home network works. In the beginning we should keep in mind that when we connect our Laptops, Smart Phones Tablets etc to the home network all get a IP address. This IP address which is assigned to these devices is not public IP address rather they are private IP address. This home network is a Loca

4 min read

Switch Port Analyzer (SPAN)

Switch Port Analyzer (SPAN) is switch specific tool that copies Ethernet frames passing through switch ports and send these frames out to specific port. Switch itself doesn’t analyze these copied frames, it send frames out of specific port to network analyzer. A Network analyzer may be purpose build hardware appliance or an application running on t

3 min read

How Spanning Tree Protocol (STP) Select Designated Port?

Spanning tree protocol is a type of communication protocol that functions to build a loop-free topology, which means the arrangement of elements in a computer network. STP commonly works for layer-2 bridges and switches. It also provides a backup link for the network system if the active link fails. Layer-2 devices send the data in the form of fram

3 min read

Configuring Port Security on Cisco IOS Switch

Overview :Switch is a network device, which is configured to connect and maintain communication channel between various devices. Ethernet ports are present on a switch, which are used to connect devices, such as Router, computer system and Laptop in the network. To connect all these network, Ethernet cables are used. MAC address of these connected

4 min read

What is a Designated Port?

The switch with the best path to the root switch is set to forwarding. That switch is referred to as the designated switch, and its port is referred to as the designated port. A designated port is a port that can have the lowest path cost on a Local Area Network(LAN) segment. Each segment has a port called a single port that is used to reach the ro

3 min read

Spanning Tree Port States

Spanning tree protocol prevent looping of frames around LAN by placing ports of switch in different states based on the criteria such as selection of root switch, switch's root cost, etc. There are five Spanning Tree Port States : 1. Blocking State : Switch port enters the blocking state at time of election process, when a switch receives a BPDU on

3 min read

Designing a Serial port configuration using cisco packet tracer

This article concerns the step-by-step designing of serial port configuration in cisco packet tracer using serial interfaces se0/0/0 or se0/0/1. In the end, it will also discuss how to check the network connectivity by transferring PDU’s between remote PCs. Objectives:To Configure serial port in cisco packet tracer using 2 routers and 2 PCs.Simulat

3 min read

What is Port Blocking within LAN ?

Port Blocking is the action performed by an Internet Service Provider (ISP) to identify and block the Internet traffic by using the Port Number and Transfer Protocol. Port Blocking within LAN refers to restricting the users from accessing a set of Services within the local area network. This may include blocking physical ports like USB, removable d

3 min read

What is a Switch Port?

A network switch is a piece of hardware that allows computers to communicate with one another. It accepts physical connectors from computers and other network devices and then uses packet switching to receive and forward data. Connecting different devices to the ports on a network switch allows them to communicate with one another via data transfer

2 min read

Advanced NAT Techniques: Port Address Translation (PAT)

Network Address Translation (NAT) is a networking technique used in routers to modify network address information in packet headers while in transit, Its main purpose is to enable the conservation of public IP addresses and facilitate communication between devices in private or local networks and the public Internet. now a days NAT is commonly impl

6 min read

What is Network Port?

In today's technological age, data stands out as a crucial asset, and to make regular advancements, we need to share data among ourselves. We can share data in two ways either using wired connections or the internet. In wired connections, we use connectors called physical ports for the transfer of data, power, and signals from one device to another

8 min read

How To Find Your Port Number ?

Answer: We can find port number using command line Tool, and using resource monitor.Methods For Find the Port Numbers On Your Device1. Using Command Line Tool like Netstat'Netstat' stands for Network Statistics and displays our computer's current network connection and port activation. Below are the steps: Open Command Prompt: On a Windows machine,

2 min read

Introduction of Virtual Router Redundancy Protocol (VRRP) and its configuration

VRRP is an open standard protocol, which is used to provide redundancy in a network. It is a network layer protocol (protocol number-112). The number of routers (group members) in a group acts as a virtual logical router which will be the default gateway of all the local hosts. If one router goes down, one of the other group members can take place

4 min read

Article Tags :

We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy

Port Forwarding on Router and Why do we need It - GeeksforGeeks (5)

'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id, check: true }), success:function(result) { jQuery.ajax({ url: writeApiUrl + 'suggestions/auth/' + `${post_id}/`, type: "GET", dataType: 'json', xhrFields: { withCredentials: true }, success: function (result) { $('.spinner-loading-overlay:eq(0)').remove(); var commentArray = result; if(commentArray === null || commentArray.length === 0) { // when no reason is availaible then user will redirected directly make the improvment. // call to api create-improvement-post $('body').append('

'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id, }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.unlocked-status--improve-modal-content').css("display","none"); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); return; } var improvement_reason_html = ""; for(var comment of commentArray) { // loop creating improvement reason list markup var comment_id = comment['id']; var comment_text = comment['suggestion']; improvement_reason_html += `

${comment_text}

`; } $('.improvement-reasons_wrapper').html(improvement_reason_html); $('.improvement-bottom-btn').html("Create Improvement"); $('.improve-modal--improvement').hide(); $('.improvement-reason-modal').show(); }, error: function(e){ $('.spinner-loading-overlay:eq(0)').remove(); // stop loader when ajax failed; }, }); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); } else { if(loginData && !loginData.isLoggedIn) { $('.improve-modal--overlay').hide(); if ($('.header-main__wrapper').find('.header-main__signup.login-modal-btn').length) { $('.header-main__wrapper').find('.header-main__signup.login-modal-btn').click(); } return; } } }); $('.left-arrow-icon_wrapper').on('click',function(){ if($('.improve-modal--suggestion').is(":visible")) $('.improve-modal--suggestion').hide(); else{ $('.improvement-reason-modal').hide(); } $('.improve-modal--improvement').show(); }); function loadScript(src, callback) { var script = document.createElement('script'); script.src = src; script.onload = callback; document.head.appendChild(script); } function suggestionCall() { var suggest_val = $.trim($("#suggestion-section-textarea").val()); var array_String= suggest_val.split(" ") var gCaptchaToken = $("#g-recaptcha-response-suggestion-form").val(); var error_msg = false; if(suggest_val != "" && array_String.length >=4){ if(suggest_val.length <= 2000){ var payload = { "gfg_post_id" : `${post_id}`, "suggestion" : `

${suggest_val}

`, } if(!loginData || !loginData.isLoggedIn) // User is not logged in payload["g-recaptcha-token"] = gCaptchaToken jQuery.ajax({ type:'post', url: "https://apiwrite.geeksforgeeks.org/suggestions/auth/create/", xhrFields: { withCredentials: true }, crossDomain: true, contentType:'application/json', data: JSON.stringify(payload), success:function(data) { jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-section-textarea').val(""); jQuery('.suggest-bottom-btn').css("display","none"); // Update the modal content const modalSection = document.querySelector('.suggestion-modal-section'); modalSection.innerHTML = `

Thank You!

Your suggestions are valuable to us.

You can now also contribute to the GeeksforGeeks community by creating improvement and help your fellow geeks.

`; }, error:function(data) { jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Something went wrong."); jQuery('#suggestion-modal-alert').show(); error_msg = true; } }); } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Minimum 5 Words and Maximum Character limit is 2000."); jQuery('#suggestion-modal-alert').show(); jQuery('#suggestion-section-textarea').focus(); error_msg = true; } } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Enter atleast four words !"); jQuery('#suggestion-modal-alert').show(); jQuery('#suggestion-section-textarea').focus(); error_msg = true; } if(error_msg){ setTimeout(() => { jQuery('#suggestion-section-textarea').focus(); jQuery('#suggestion-modal-alert').hide(); }, 3000); } } document.querySelector('.suggest-bottom-btn').addEventListener('click', function(){ jQuery('body').append('

'); jQuery('.spinner-loading-overlay').show(); if(loginData && loginData.isLoggedIn) { suggestionCall(); return; } // load the captcha script and set the token loadScript('https://www.google.com/recaptcha/api.js?render=6LdMFNUZAAAAAIuRtzg0piOT-qXCbDF-iQiUi9KY',[], function() { setGoogleRecaptcha(); }); }); $('.improvement-bottom-btn.create-improvement-btn').click(function() { //create improvement button is clicked $('body').append('

'); $('.spinner-loading-overlay').show(); // send this option via create-improvement-post api jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.improvement-reason-modal').hide(); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { $('.spinner-loading-overlay:eq(0)').remove(); var result = e.responseJSON; if(result.detail.non_field_errors.length){ $('.improve-modal--improve-content .improve-modal--improve-content-modified').text(`${result.detail.non_field_errors}.`); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); $('.improvement-reason-modal').hide(); } }, }); });

Port Forwarding on Router and Why do we need It - GeeksforGeeks (2024)
Top Articles
Gofundme Statistics Statistics: Market Data Report 2024
How to Make a Social Media App: Reduce Expenses and Avoid Mistakes | Aimprosoft
Data reveals most expensive dog breeds in U.S. for 2024 
Pikes Suwanee
Fbsm St Louis
World War II: Summary, Combatants & Facts | HISTORY
Christine Paduch Howell Nj
Pjstar Obits Legacy
Cadenheads Girvan 33yo & Cadenheads Ardmore 11yo
Indianapolis Star Obituary
Craigslist Pet Phoenix
Argus911
Welcome To Aces Charting
Ilcc Number Lookup
Die eID-Karte für Bürgerinnen und Bürger der EU und des EWR
Michelle_Barbelle
Snohomish Hairmasters
Oviedo Anonib
Southern Food Buffet Near Me
Netherlands Toys, Games & Hobbies | ExpatINFO Holland
Eos Fitness Irvine
Battle for Azeroth Preview: Drustvar Visitor’s Guide - WoW
Sevierville, Tennessee: Idyllisches Reiseziel in den Great Smoky Mountains
Will Certifier Crossword Clue
Pge Outage Map Beaverton
Reahub 1 Twitter
Berklee College Of Music Academic Calendar
Forza Horizon 5: 8 Best Cars For Rally Racing
Dynasty League Forum
Volkswagen For Sale Craigslist
Panty Note 33
Brake Masters 228
Craigslist Pets Seattle Tacoma Washington
Mathsspot.com Unblocked Roblox Online Unblocked
Craigslist Ct Apartments For Rent
Rinehart Sons Funeral Home
Restaurants Near 275 Tremont St Boston
R/Sandiego
Shop e.chi, Energie Welle, Energie Sohle, E-Smog Kissen, Hologramm
Sparkle Nails Phillipsburg
Lily Starfire White Christmas
Tj Nails Victoria Tx
Sarah Colman-Livengood Park Raytown Photos
Huntington Bank Review 2024 | Bankrate
Sierra At Tahoe Season Pass Costco
Norwegian Luna | Cruise Ship
Gun Show Deridder La
24 Hour Arrest List Knox County
Nuefliks.com
Vinoteca East Rutherford Menu
What Is Opm1 Treas 310 Deposit
Latest Posts
Article information

Author: Carlyn Walter

Last Updated:

Views: 5967

Rating: 5 / 5 (50 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Carlyn Walter

Birthday: 1996-01-03

Address: Suite 452 40815 Denyse Extensions, Sengermouth, OR 42374

Phone: +8501809515404

Job: Manufacturing Technician

Hobby: Table tennis, Archery, Vacation, Metal detecting, Yo-yoing, Crocheting, Creative writing

Introduction: My name is Carlyn Walter, I am a lively, glamorous, healthy, clean, powerful, calm, combative person who loves writing and wants to share my knowledge and understanding with you.