SSH Tunneling - Local & Remote Port Forwarding (by Example)

  Рет қаралды 233,429

Hussein Nasser

Hussein Nasser

Күн бұрын

In this video I explain how to perform SSH Tunneling with Local Port forwarding and remote port
forwarding
Chapters
0:00 Intro
3:30 Local Port Forwarding Example
11:20 Remote Port Forwarding Example
I need to access something remote that I don’t have access to.
only expose 1 port securely and access pretty much any service (database etc..)
ssh -L local_port:remote_address:remote_port username@sshserver
I need people to access something local on my machine that they don’t have access to
ssh -R remote_port:local_address:local_port username@sshserver
For Remote Port forwarding the ssh server config /etc/ssh/sshd_config should have a property GatewayPorts yes
🏭 Software Architecture Videos
• Software Architecture
💾 Database Engineering Videos
• Database Engineering
🛰 Network Engineering Videos
• Network Engineering
🏰 Load Balancing and Proxies Videos
• Proxies
🐘 Postgres Videos
• PostgresSQL
🚢Docker
• Docker
🧮 Programming Pattern Videos
• Programming Patterns
🛡 Web Security Videos
• Web Security
🦠 HTTP Videos
• HTTP
🐍 Python Videos
• Python by Example
🔆 Javascript Videos
• Javascript by Example
👾Discord Server / discord
Support me on PayPal
bit.ly/33ENps4
Become a Patreon
/ hnasr
Stay Awesome,
Hussein

Пікірлер: 165
@antonimihailov8046
@antonimihailov8046 4 жыл бұрын
It is really, really great that there are still tech channels which actually share tech knowledge and don't just publish videos, such as "top languages to learn in 2025". I really hope you keep up with this great videos and don't become a slave to the algorithm.
@hnasr
@hnasr 4 жыл бұрын
Man tell me about it, I made a video last year ranting about videos claiming Top programming languages in 2020 kzbin.info/www/bejne/f5uym5x8acSWh8U
@hnasr
@hnasr 4 жыл бұрын
Man tell me about it, I made a video last year ranting about videos claiming Top programming languages in 2020 kzbin.info/www/bejne/f5uym5x8acSWh8U
@maxteer2800
@maxteer2800 2 жыл бұрын
This covered in 7 minutes (only needed local) what I've been trying to understand for a couple weeks... I normally don't "research" on youtube, but your practical example was great. Thanks so much!
@anothersonnyday936
@anothersonnyday936 2 жыл бұрын
The only guy on the internet that explains SSH port forwarding and remote port forwarding properly.
@callistachang8358
@callistachang8358 3 жыл бұрын
Hey there - I stumbled upon your video when I was looking up reverse proxies and I just wanted to say that you're such an excellent explainer! I see from your profile that you update frequently and consistently. Thank you for doing what you do, I'd definitely recommend this site to my friends when you cover topics they like!
@hnasr
@hnasr 3 жыл бұрын
Thank you soo much cal for taking the time to write this 🙏 very happy you like the content ! I try to upload frequently and i talk about topics that i am interested on
@rvoros
@rvoros Жыл бұрын
Clear, to the point, no BS explanation. Well done!
@x7331x
@x7331x 6 ай бұрын
I have read so many articles and I was really struggling understand what happens behind the scenes. Brilliant explanation and visuals, thanks you!
@ThanhTran-wf2jf
@ThanhTran-wf2jf Жыл бұрын
This is BY FAR the best explanation of local & remote port forwarding that I have seen anywhere. It makes it very clear exactly who is requesting what from where at each point in the request, and the separation of resources is most helpful ; most other explanations will have the requested resource and the ssh server be on the same host, not making it clear that the requested resource can actually be running on a different host. Huge thanks to you for sharing such a great video with us!
@DavidChandra
@DavidChandra Ай бұрын
Agree with you. This is the best tutorial video.
@LukePammant
@LukePammant Жыл бұрын
Awesome explaination! I read (*skimmed*) 5 articles on local vs remote port forwarding and didn't grok it until I saw your visuals. Thanks for this!
@varghapayandeh3024
@varghapayandeh3024 3 жыл бұрын
Also a wonderful video with explanation and examples. Thank you!
@abdalla_zaki
@abdalla_zaki Жыл бұрын
Man, you are the guru of back-end engineering
@acooper978
@acooper978 2 жыл бұрын
Thanks for this! You have a really good way of explaining things. Appreciate it :)
@bjornotto98
@bjornotto98 3 жыл бұрын
Thanks, definately had a woah moment when the web interface of process on my aws server popped up So usefull!
@demandelz
@demandelz 3 жыл бұрын
Thank you sir. This was exactly what I needed. I don't know why on Earth I had so much trouble building a remote ssh tunnel, but I did and it was only after viewing your video that I was able to get everything working solidly. Once again thank you for the clear explanation.
@yousofebneddin7430
@yousofebneddin7430 3 жыл бұрын
this is exactly what I needed. Thanks.
@BradMore
@BradMore 3 жыл бұрын
Thanks for the nudge in the right direction ... helped!
@hashithbandara111
@hashithbandara111 2 жыл бұрын
i can understand this lesson very well because of terminal practice of you
@leamon9024
@leamon9024 Жыл бұрын
The best ssh tunneling tutorial ever!!! Thanks for your hard work, Hussein. Could you also talk about dynamic tunneling if possible?
@fanden
@fanden 2 жыл бұрын
Very well explained. Thank you!!
@dffabryr
@dffabryr 2 жыл бұрын
Excellent explanation Hussein !! Thank you
@meryemeaitahmed-brahim3082
@meryemeaitahmed-brahim3082 5 ай бұрын
Your video helped me understand a lot of things, thank you!
@davidfernandotorres3484
@davidfernandotorres3484 2 жыл бұрын
Love your video bro! Keep working on them 💪🏼💪🏼
@AshutoshKumar-ue3dr
@AshutoshKumar-ue3dr 2 жыл бұрын
Super Video, Exactly what I need!
@sohamroy6004
@sohamroy6004 4 жыл бұрын
thank you for making such a great content
@clapandslap
@clapandslap 2 жыл бұрын
Thanks a lot! That's pretty clear and useful.
@breakersun
@breakersun 10 ай бұрын
So clear my man. Thank you
@soldadopreciso
@soldadopreciso 3 жыл бұрын
Thanks pal, greetings from Ecuador.
@cipherswami
@cipherswami 2 жыл бұрын
awesome, got everything in the shot !!!
@amrhussein1677
@amrhussein1677 Жыл бұрын
Many thanks man for this simple way 👏🏻
@vladislavkaras491
@vladislavkaras491 5 ай бұрын
Really thanks for the explanation! It was great!
@user-eq1er5lh3d
@user-eq1er5lh3d 7 ай бұрын
Brilliant tutorial!!!!!!!!!!!!!!!! Thank you Hussein!)
@leongszekim1727
@leongszekim1727 3 жыл бұрын
Very detail explaining, thanks
@omarjarkas2175
@omarjarkas2175 2 жыл бұрын
Thanks for the video Hussein
@SkreenGG
@SkreenGG 3 жыл бұрын
Wow, this was a great video, I was able to learn a lot from this. Great examples, and great and clear speech. Thank you very much for this brother.
@hnasr
@hnasr 3 жыл бұрын
Glad you enjoyed it!
@anirbandutta1371
@anirbandutta1371 3 жыл бұрын
Understood very well ..Thank you ... To make things very very clear and less confusing you could have used a cloud VM for public SSH server ...
@m3ntas
@m3ntas Жыл бұрын
Very well explained dude. Thnk u so much!😉
@hugh1a001
@hugh1a001 2 жыл бұрын
This was extremely well explained and easy to understand. You have a calling as a teacher I believe ;)
@super3d201
@super3d201 9 ай бұрын
Thanks for this great video, it helped alot.
@cygnemignon5507
@cygnemignon5507 2 жыл бұрын
Thank you ! fantastic explanation :)
@noahwilliams8918
@noahwilliams8918 4 жыл бұрын
Thank you for making this video Hussein! I've been trying to wrap my head around remote port forwarding for the longest damn time. I live in an area with shared wifi and I've been looking forever for a way to circumvent the stupid firewall so I can get some of those sweet sweet LetsEncrypt certs for my Raspberry Pi's! I've watched so many videos on this and not found a single one that isn't either a) using PuTTY on Windows, which is useless since it doesn't show which command line args to use or b) a purely conceptual explanation with no examples or instructions!
@hnasr
@hnasr 4 жыл бұрын
Noah Williams thanks Noah! Glad I could help. This concept is very complex believe me I go back to my videos all the time to remember how I did things. So i try to put the commands .. which reminds me must make sure i put it on this YT description
@kudorgyozo
@kudorgyozo 3 жыл бұрын
Excellent explanation
@carsonboi9326
@carsonboi9326 2 жыл бұрын
this helped me a lot. thank you.
@mohammade.8770
@mohammade.8770 4 жыл бұрын
Been waiting for this. Great video by the way
@hnasr
@hnasr 4 жыл бұрын
Enjoy 😊
@artamohammadi3589
@artamohammadi3589 Ай бұрын
Thank you so much it was really helpful
@gillfromamritsar
@gillfromamritsar 4 жыл бұрын
Great Video, I am using this technique to create tunnel from my local to server, additionally, I am using "-fNL" params. The -f option tells the ssh command to run in the background and -N not to execute a remote command.
@hnasr
@hnasr 4 жыл бұрын
jatin seth thanks Jatin for sharing! Nice tips 👍
@danyvangoch3586
@danyvangoch3586 2 жыл бұрын
Really good video. Thank you!
@mohamedirfan2816
@mohamedirfan2816 Жыл бұрын
Thankyou so much!
@bionic1039
@bionic1039 4 жыл бұрын
I think I love you. Subscribed, liked, and added to favourites, GOOD JOB BRO, thank you very much!
@hnasr
@hnasr 4 жыл бұрын
Bionic ❤️❤️ *sending love back * enjoy the content
@ishanmisra5336
@ishanmisra5336 2 жыл бұрын
You are a nice person... : Stay awesome...
@RM-cv4tl
@RM-cv4tl 3 жыл бұрын
You explained that very well. Thank you
@hnasr
@hnasr 3 жыл бұрын
R M thanks😊 appreciate it!
@founderofisis6627
@founderofisis6627 3 жыл бұрын
Hey you got some cool stuff. Thanks!!
@anuXsec
@anuXsec Жыл бұрын
you r amazing man ...
@bestcodepractice7898
@bestcodepractice7898 3 жыл бұрын
Thank you soo much brather i hoop you happy
@nansenejames8219
@nansenejames8219 Жыл бұрын
Thanks dear it helped me alot
@carloscoliver9427
@carloscoliver9427 3 жыл бұрын
Wello Done, bro... Awesome Explanation!!
@hnasr
@hnasr 3 жыл бұрын
Thanks Carlos 😊🙏
@sharkdavid
@sharkdavid 2 жыл бұрын
This was great Thanks ✌
@waiphyotun7633
@waiphyotun7633 Жыл бұрын
thank you sir
@i.i
@i.i 2 жыл бұрын
thanks alot
@diegoc8083
@diegoc8083 3 жыл бұрын
Awesome! Thanks
@pdamiano
@pdamiano 3 жыл бұрын
amazin video, TY !!!!
@decoder6878
@decoder6878 2 жыл бұрын
Great video👌🏻
@mostinho7
@mostinho7 3 жыл бұрын
2:00 local vs remote port forwarding 5:00 Clear example of local port forwarding Forwards local traffic originating from my machine to a public ssh server which then forwards it to the private server we’re accessing.
@debasismandal1924
@debasismandal1924 3 жыл бұрын
This was soooo helpful!!
@hnasr
@hnasr 3 жыл бұрын
Glad it was helpful!
@michaelcastanaro3760
@michaelcastanaro3760 3 жыл бұрын
Great explanation, Hussein. Thank you!
@raulalejandromunozaraya3878
@raulalejandromunozaraya3878 3 жыл бұрын
Awesome 🖖
@noambitions
@noambitions 2 жыл бұрын
Good video! What's the software that produce the red mouse pointer trailing in your video BTW?
@ganges6661
@ganges6661 3 жыл бұрын
Yah habibi. I love the accent. Thank you for the video!
@audiokernel412
@audiokernel412 3 жыл бұрын
great video
@BaoTran-jo8lj
@BaoTran-jo8lj 7 ай бұрын
Hi I am new to this field. May I ask if I open GateWay publically, will there be some hackers have an ability to access my server? Thanks.
@tushargoel5049
@tushargoel5049 29 күн бұрын
Hi Hussein Even if we do not use ssh command to access the remote server, we can still access it by making a TCP req on public ssh server on port 22, right?
@aymanpatel5862
@aymanpatel5862 3 жыл бұрын
Can you do a video on Dynamic port forwarding using SOCKS5 protocol?
@securiosityy
@securiosityy 7 ай бұрын
This is a really good explanation of SSH tunneling and port forwarding! Unfortunately one can only appreciate the accuracy after seeing so many very confusing and even incorrect explanations on KZbin. It's important to get the terms right and use proper examples (e.g. "local" or "remote" from which machine's perspective) and where the connection is initiated etc. Too often something like "SSH -R 1080:localhost:1080" is used which is the worst way, as students can't see which machine each component is referring to and what's actually happening here. So, thank you for going the extra mile with the diagrams and being careful with how you use the terminology.
@yasirmaqsood9260
@yasirmaqsood9260 3 жыл бұрын
do we have to install frontier communications or what. I am completely new. Kindly guide
@nixexd
@nixexd 2 жыл бұрын
Hi Mr. Hussein. I like to ask some Question. How to fix Connection refused when run the ssh command and fix bad local forwarding specification 'ip adress'?
@jorgensenabrahamson6479
@jorgensenabrahamson6479 3 жыл бұрын
I don't have a public dynamic ip. My ISP shares my IP with others, it means I am behind a NAT. I tried to use remote port forwarding to see my DVR and NAS, but the problem is that I can not publish ports in my router. In the example described in the video that tunne it's not needed, you could configure the router to forward the ports of that internal resource with out needing a 3rd party server. However, I am able to see a port of an external database server and see it as a local resource.
@hnasr
@hnasr 3 жыл бұрын
Ill make a video on this topic you can use ngrok.io
@jorgensenabrahamson6479
@jorgensenabrahamson6479 3 жыл бұрын
@@hnasr I evaluated that solution but it's limited :( thanks for your really quick answer
@hnasr
@hnasr 3 жыл бұрын
Yes it is very limited and terminates your connection.. best way is to purchase a tiny vm from linod
@jorgensenabrahamson6479
@jorgensenabrahamson6479 3 жыл бұрын
@@hnasr what could I do with that? I have my own server in cloud at cost, that's where I tryied to do the tunneling solution , what do you suggest to install to achive my purpose?
@jorgensenabrahamson6479
@jorgensenabrahamson6479 3 жыл бұрын
I'll try this superuser.com/questions/277218/ssh-access-to-office-host-behind-nat-router
@TechnicalHeavenSM
@TechnicalHeavenSM 3 жыл бұрын
Nice explained.. But I have a problem.. What do I do if I have access to only one device on the private network (in which my web/game server is running)?
@supa1954
@supa1954 3 жыл бұрын
So i setup Pi-Hole on my Raspberry pi, with Pi-Vpn to install openvpn alongside my Pi-hole then i logged into my router made it a static ip, now im trying to setup port forwarding to the raspberry pi on port 1194 that openvpn uses What confuses me is my router asks for a internal host ip which i set to my Raspberry Pi's ip, and external host ip, i ended up leaving the external host ip blank, im trying to access my Pi-Hole Adserver while im at work does that require me to put a ip for the external host? I made my internal port, and external port 1194
@foxmulder9240
@foxmulder9240 4 жыл бұрын
Can I use port forwarding to bypass my router to use a VPN without unplugging everything? I think I would have to restart my modem every time to connect to my computer every time as well. A hassle. I have an Archer A6, I got from a friend, because it wouldn't work with Nord. Would a network switch work? Thanks.
@TyphoonBeard
@TyphoonBeard 3 жыл бұрын
Thank you very much for the great explanation! I have been wondering, if it is possible to achieve the same thing (hosting a web server) if my router gets a private IP from the ISP... I just cannot find a straight forward tutorial or explanation, how this thing may work. In your use case, if I understood correctly, you use the public IP of the router, but mine is private as it doesn't match with the IP what I see from "outside" ip tracking webpages, and the port forwarding simply doesn't work.
@marcelo_luz
@marcelo_luz 3 жыл бұрын
Im also interesting to know about it, since i dont have a static IP and my ISP blocked the majority of the ports.
@TyphoonBeard
@TyphoonBeard 3 жыл бұрын
Marcelo, the only option I found is, to use a service like ngrok or other alternatives with similar functionality. Basically it is a service, which creates a channel between your server and an external hosting service. The mentioned one has some free possibilities, so you can try it out just by creating a free account. For a paid plan you can also create your own domain if you like. I hope this helps a little. Cheers!
@marcelo_luz
@marcelo_luz 3 жыл бұрын
@@TyphoonBeard thank Florián, I'm here breaking my head.. at the moment I'm trying ngrok without success. Actually I just wanna turn on my computer over the lan (Wake on LAN remotely - WOL/WOW).
@DaRKeN58
@DaRKeN58 3 жыл бұрын
How do I do this with nginx in WinNMP, a step by step please, thank you very much.
@syedhannan546
@syedhannan546 Жыл бұрын
is the same possible to do using putty settings?
@philipk883
@philipk883 4 жыл бұрын
Finally
@empuraan4710
@empuraan4710 Жыл бұрын
Anyone else get a port conflict on port 22 in the port forwarding example (in the router setup) ?
@NoONE-bk7ud
@NoONE-bk7ud 7 күн бұрын
Apr 28 2024, good video
@giugot87
@giugot87 3 жыл бұрын
Is it possible between two windows pc? I can't set a ssh tunneling to have an encrypted vnc connection (in a local connection I can, but remotely I can't). Any idea?
@andyhinkel
@andyhinkel 3 жыл бұрын
Thank you Hussein, I learned a lot ! Can you tell me how to know which ports I have?
@hnasr
@hnasr 3 жыл бұрын
Thanks Andrea! I think you can run netstats -a on windows or mac?
@andyhinkel
@andyhinkel 3 жыл бұрын
@@hnasr I see, thanks. I got a huge list on Linux now. My question might be not accurate. Like how do I know from that huge list on which I can use?
@pigtv3759
@pigtv3759 2 жыл бұрын
This is possible use this with 4g cg-nat connection. I need port for dvr.For ssh this is possible to use with rpi model b and vps with public ip.
@HOOHA333
@HOOHA333 2 жыл бұрын
On @9:05 I did not get one thing, when someone login using user ID pi on your machine, not on raspberry pi, how after logging in we reached to raspberry pi ?
@user-zg2kr6ph9z
@user-zg2kr6ph9z Жыл бұрын
when i heard RRRRRouter i immediately glanced to the channel name , lol
@varghapayandeh3024
@varghapayandeh3024 3 жыл бұрын
What is "raspberry2" pointing to. I mean, do you have that in your hosts file to be something like 127.0.0.1?
@vidmantasdd
@vidmantasdd 2 жыл бұрын
Hi. I'm newbie with SSH. Can you please tell me, does it possible have remote connection via SSH between two computers ( I mean between two different countries) and transfer files between them, without involving third party servers? And if possible, how I can do this in Ubuntu terminal. Thanks
@sl-agent047
@sl-agent047 3 жыл бұрын
How to use this with SNI To access internet freely using content base packages from ISP
@kunalpatil7968
@kunalpatil7968 2 жыл бұрын
Getting below error in public port forwarding: Warning: remote port forwarding failed for listen port XXXX Any reasons?
@palaniappanrm6277
@palaniappanrm6277 3 жыл бұрын
This was an eye opener for me. This is so powerful actually. But the public SSH servers available will actually block these stuffs right?
@hnasr
@hnasr 3 жыл бұрын
Glad its helpful! correct its rare to find a public ssh server that has port 22 open but very easy to spin one up with a $5 droplet from cloudflair even cheaper
@mo.downhill6760
@mo.downhill6760 3 жыл бұрын
هلاوالله بحسين، لهجتك فله 👌
@hnasr
@hnasr 3 жыл бұрын
❤️ هلا ولله
@Karurosagu
@Karurosagu 3 жыл бұрын
what happens if a captive portal has port 22 blocked, how do i make a tunnel?
@thegame8538
@thegame8538 2 жыл бұрын
I am trying to find a place to buy SSH Tunnel no-login servers. Have any ideas?
@HOOHA333
@HOOHA333 2 жыл бұрын
What is internal resources?
@jivanmainali1742
@jivanmainali1742 3 жыл бұрын
So remote port forwarding only in case of when we want world to access our local server.
@deepak.rocks.
@deepak.rocks. 2 жыл бұрын
Do video about reverse ssh
@Eagle-md6ku
@Eagle-md6ku 3 жыл бұрын
Why did you have to create a name for your machine's IP on the public DNS server? (The noIP website @ 8:33) Is this a required step or can I just use the SSH server's IP?
@hnasr
@hnasr 3 жыл бұрын
No reason you may use the public IP address just wanted an easy way to write it down
A Good Network Engineering Videos Resource Recommendation
10:28
Hussein Nasser
Рет қаралды 4,3 М.
SSH Full Course - EVERYTHING You Need to Know!
1:28:00
Learn Linux TV
Рет қаралды 544 М.
[실시간] 전철에서 찍힌 기생생물 감염 장면 | 기생수: 더 그레이
00:15
Netflix Korea 넷플릭스 코리아
Рет қаралды 38 МЛН
SSH Tunnels SIMPLIFIED!
19:49
Shawn Powers
Рет қаралды 41 М.
Proxy vs Reverse Proxy Server Explained
14:18
Hussein Nasser
Рет қаралды 128 М.
SSH Crash Course | With Some DevOps
55:02
Traversy Media
Рет қаралды 542 М.
TCP Tunneling Applications Pros and Cons (Explained by Example)
29:58
Hussein Nasser
Рет қаралды 37 М.
SSH Tunneling Explained
6:37
Tinkernut
Рет қаралды 460 М.
SSH Tunneling - A Deep Dive
21:17
0612 TV w/ NERDfirst
Рет қаралды 10 М.
Use SSH tunneling like a pro
11:18
Ahmed Elfakharany
Рет қаралды 3,8 М.
Что еще за обходная зарядка?
0:30
Не шарю!
Рет қаралды 173 М.
Секретная функция ютуба 😱🐍 #shorts
0:14
Владислав Шудейко
Рет қаралды 2,1 МЛН
Такого вы точно не видели #SonyEricsson #MPF10 #K700
0:19
BenJi Mobile Channel
Рет қаралды 2,7 МЛН
iPhone - телефон для нищебродов?!
0:53
ÉЖИ АКСЁНОВ
Рет қаралды 3,6 МЛН