Network Address Translation - NAT Explained

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

Комментарии • 158

  • @jaafarbalaghi9012
    @jaafarbalaghi9012 9 месяцев назад +3

    Thank you. I have a kind of disease that I have to be curious about any topic in programming. And now I found my cure: Hussein Nasser! Your videos have exactly this property of going deep into the subject

  • @pajotrus
    @pajotrus 4 года назад +204

    this is better than netflix

    • @suadrifrasan2726
      @suadrifrasan2726 4 года назад +8

      In fact it is better. Got bored of Netflix... and now watching this at 1:30am

    • @jaykothari8798
      @jaykothari8798 4 года назад +2

      Need to cancel my subscription 😛

    • @giovanni-cx5fb
      @giovanni-cx5fb 4 года назад +21

      It's NATflix.

    • @elhakimdev
      @elhakimdev 3 года назад +1

      @@giovanni-cx5fb Good one XD

    • @giovanni-cx5fb
      @giovanni-cx5fb 3 года назад

      @@elhakimdev
      Thanks 😆

  • @bleronqorri3011
    @bleronqorri3011 10 месяцев назад

    Just wanna say one thing Hussein, I really really appreciate the in-depth explanations. I've seen many videos on protocols that just barely scratch the surface and you're left with more questions than answers at the end. You instead go and explain every little detail, with an approach that makes sense.
    Thank you. I'm becoming a better Software Engineer daily by watching the stuff you post and talk about.

  • @elultimopujilense
    @elultimopujilense 4 года назад +57

    I blame the youtube algorithm. I should have found this channel a long time ago.

  • @ankansharma4897
    @ankansharma4897 2 года назад +4

    Your explanation style and in-depth explanation are pure gold. We don't need an explanation in 2 min videos. Your explanation helped me connect the loophole in concepts and make it crystal clear perfectly. Thank you. Very much appreciate your efforts.

  • @mrunalumate5399
    @mrunalumate5399 Год назад

    this is how teaching should be....Just wow...!! how we get familier with networking so easily...

  • @ramyfarid2296
    @ramyfarid2296 3 года назад +19

    This channel is pure gold!!

  • @muhammadahsan9275
    @muhammadahsan9275 2 года назад +4

    I hated networking, i withdrawn my computer network course in university. i hated the teacher as well who teach us networking. after listening and watching your videos on webRTC and NAT, now i am thinking networking is not that much bad👀.
    BTW Thank you for such a great backend engineering content.

  • @zsigmondforianszabo4698
    @zsigmondforianszabo4698 2 месяца назад

    bro has a good time recording amazing explaining videos while being high

  • @amoldeshpande5369
    @amoldeshpande5369 3 года назад +15

    Hi Sir, I am new member and have recently subscribed to your channel. Your style of explaining is really very good, all your videos are very informative. Please do not think that you speak a lot, actually you are doing a great job by explaining the concepts in detail. Thanks for all your efforts.

    • @hnasr
      @hnasr  3 года назад

      Thank you Amol! So kind of you 🙏

  • @keithjacob4636
    @keithjacob4636 5 лет назад +15

    Great video! I love the way you explain things and I really enjoy your attitude . You make this fun! I watched a few other videos you have and I am a fan. Keep up the great work! Thanks

    • @hnasr
      @hnasr  5 лет назад +5

      Thank you Keith, really appreciate your comment and compliment. I try to lighten up the mood on dry topics like this. I know it could also be distracting sometimes when I do it too much So Im trying to find the balance.
      Thanks again! Cheers

    • @sharvarigc7714
      @sharvarigc7714 4 года назад

      Me too!

  • @mprasanth18
    @mprasanth18 Год назад

    Thanks a lot for making this video. It cleared my gap in NAT.

  • @Douglas_Gillette
    @Douglas_Gillette 2 года назад +1

    Routers do not have an IP address. The interfaces on the router have IP addresses. This is particular but very important.

  • @sukiyang3474
    @sukiyang3474 3 года назад

    I like how you talk about related knowledge. It's like connecting the dots. Learn so much from your videos. Thank you so much ~

  • @ramjonchhen5882
    @ramjonchhen5882 2 года назад

    Really This is one of the best videos, I have seen on NAT. Thank you for explaining the concept in such simple way.

  • @georgeli6820
    @georgeli6820 2 года назад

    Best explanation ever on RUclips

  • @hariomkuntal9520
    @hariomkuntal9520 2 года назад +1

    Awesome explanation Hussein. I love your videos, they are so at the basics and clear the fundamentals

    • @hnasr
      @hnasr  2 года назад

      Thank you! Glad you liked it

  • @wick12298
    @wick12298 2 года назад

    You talk alot, and that's the best thing XD. Explaining in so much detail, its like you are learning with us and discovering as we go.

  • @ZeeshanAli-nk3xk
    @ZeeshanAli-nk3xk 2 года назад

    in love with your videos! Allahumma baarik ya akhi!

  • @bobslave7063
    @bobslave7063 Год назад

    Amazing job Hussein. Thanks for the best explanation!

  • @sagarchopade6656
    @sagarchopade6656 4 года назад +12

    Sir it's fun to learn. Thanks you, such a great video.

    • @hnasr
      @hnasr  4 года назад +2

      It is fun indeed! Thanks for your comment 🙏

  • @g0thman865
    @g0thman865 3 года назад +1

    On top of the great content.
    I just want to say that your thumbnails are awesome!!

  • @usamatahseenulhaque9125
    @usamatahseenulhaque9125 4 года назад +2

    Even though videos are long but its worth watching thanks keep it up

    • @hnasr
      @hnasr  4 года назад +1

      Usama Wizard thank you Usama

  • @MrRoBot-wn4kp
    @MrRoBot-wn4kp 2 года назад

    Thank you..one of the best channels

  • @fazalali2771
    @fazalali2771 3 года назад +1

    Man! You're awesome.
    "Router says, you wanna go out but you're naked, let me put some clothes on you 😂"

  • @patrickjason4384
    @patrickjason4384 3 года назад

    WOW fun and learning at the same time great stuff dude keep it up

  • @krishnakrmahto97
    @krishnakrmahto97 3 года назад +1

    I read (really sorry if you also mentioned it in the video and I missed it) that NAT functions at the network layer (layer 3). Port forwarding deals with ports which is a layer 4 concept. Want to know if this fact is ignored when implementing NAT? What's bothering me more is that router is also a layer 3 thing, ideally I would think it doesn't have enough tech physically built into it to work on anything beyond layer 3.
    Sorry if this doesn't make sense, thanks!

  • @heetdave6779
    @heetdave6779 2 года назад

    Legendary Video

  • @nguyenlouis4690
    @nguyenlouis4690 4 года назад +1

    It's so helpful. Thanks so much for your content

    • @hnasr
      @hnasr  4 года назад

      Thank you Kelbin!! 🙏 glad you like the content

  • @timmy5362
    @timmy5362 3 года назад +4

    Hi! Thank you so much for these videos! Very entertaining and informative! One question, what if two devices (within the same network) made a request to the same server, how would the router know whom to send the response to?

    • @hnasr
      @hnasr  3 года назад +3

      Sure thing! Each client will get a unique source port which the router will use to send back data

    • @timmy5362
      @timmy5362 3 года назад

      @@hnasr Thanks for clearing!

    • @booleanboolean2984
      @booleanboolean2984 3 года назад +3

      @@hnasr won't they have different local ip address apart from port ??

    • @iplaty9830
      @iplaty9830 2 года назад +1

      @@booleanboolean2984 yes

  • @singaravelann3671
    @singaravelann3671 4 года назад +1

    Thanks again for the such a good content, Here when we want to communicate to other server which is another network and which TLS request, who will take care of TCP handshake and who will validate that certificate given by server.

  • @criticalnewstvcriticalanal2495

    For consistency it should be said, that from the WAN-Port (44.11.5.17) to the host 44.12.1.9, it must be routed again.

  • @shashikantpawar7069
    @shashikantpawar7069 3 года назад +1

    Thank you for the content 🙏🙏

  • @zakizaz1
    @zakizaz1 3 года назад

    Great content sir, and also so much fun to follow .. Thank you .

  • @thatguyadarsh
    @thatguyadarsh 4 года назад

    Man !!! 13:28 You are hilarious. Great Video. Respect !!

  • @albinpaul3429
    @albinpaul3429 3 года назад

    I love the part where you said we can address aliens with ipv6.

  • @manjunathreddy5966
    @manjunathreddy5966 Год назад

    Superb 🎉

  • @aqeelzeid24
    @aqeelzeid24 3 года назад

    Amazing content !!!!!!

  • @devyetii
    @devyetii 4 года назад +4

    Redirected her from your latest video about NAT Slipstreaming and I'd like to really thank you about the great effort you put in your content ❤️.
    I just have one question, What if client A with prvt. IP 192.168.0.17 and client B with prvt. IP 192.168.0.18, both wants to access let's say a nodejs server on server with pub. IP 40.82.84.10:8080 (imaginary 😅), both of them happen to create the same random port on let's say 8992 but each of them sent different messages. How will NAT know which response to send to which MAC address. Does it store the MAC address of the sender as well ?

    • @hnasr
      @hnasr  4 года назад +6

      Fantastic question!!! The router in this case will detect that and rewrite a new port for the second host and when it comes back it will rewrite it to the original.

    • @devyetii
      @devyetii 4 года назад

      @@hnasr Oh got it ! Great thanks for your reply جزاك الله خيرا

    • @Iamkumargaurav
      @Iamkumargaurav Год назад

      ​@@hnasr ​ hi there, so the number of translations, for the same nodejs server is limited by number of ports available.(2^16).
      what if i want to get through more connections than 2^16

    • @Iamkumargaurav
      @Iamkumargaurav Год назад

      do we have something like port multiplexing here :D

  • @chswin
    @chswin 2 года назад

    You can also forward other ip protocols like GRE…

  • @elmeroranchero
    @elmeroranchero 3 года назад +2

    This is lovely XD

  • @dumbskull5593
    @dumbskull5593 3 года назад +2

    Great video! I think I understood the main concept. But I do have a doubt. What if there are multiple devices within a local network that's working on the same port (all devices working on port 8080 for example). How will the router make the NAT table in that case?

    • @radonspace2098
      @radonspace2098 2 года назад

      My answer to that is each device even though on the same local network has a unique Ip address. John Chandler, Damon Chandler, Maddy Chandler. all Chandler's but with unique names.

  • @chetanrana7778
    @chetanrana7778 4 года назад

    It makes lot of sense cool

  • @asishreddy7729
    @asishreddy7729 3 года назад +1

    You wouldn't believe how long I had to search for to get this answer.I didn't even know it was called NAT, I was just typing stuff like "how router knows my computer when it receives data". Anyway, one question, what if the client machine pings the same server from two different ports? How does the router handle that ? cuz it just saves client IP and port with the server IP and port so how does it distinguish between the two client ports?

    • @hnasr
      @hnasr  3 года назад +1

      Glad you found the content!
      So lets unpack your example
      client (ip address c) and server (ip address s)
      Client want to connect to s:80
      client creates a random port 1234
      Router sees client want to go s:80 and creates a mapping on its public ip (lets call it r) with another port,, created a NAT entry as follows
      c:1234 wants going to s:80 through r:9876
      Now client want to connect to s:25
      Client creates another random port c:1235 and router creates new entry as follows
      C:1235 going to s:25 through r:9875
      So it is always a unique mapping.

    • @asishreddy7729
      @asishreddy7729 3 года назад +1

      Ohhh so router creates a new port for every entry ? Because my question was c:1234 wants to go to s:80 and then c:5678 also wants s:80. so when s:80 responds the router needs to find the correct client and that was my doubt.

  • @balsubu1
    @balsubu1 2 года назад

    awesome...

  • @tahasaleh4697
    @tahasaleh4697 3 года назад +1

    If 2 clients from the same subnet made the same request to the same server over the internet, when the server replies and the router receives the packet, will oit find that there are two entries in the NAT table that map to the same request? How does the router know to which client this response belongs to? Is NAT aware of the session ID?

  • @palaniappanrm6277
    @palaniappanrm6277 4 года назад +1

    Does Load Balancer uses NAT only to keep track of where it should forward the response back by who made the request?

  • @virendrabhati6685
    @virendrabhati6685 3 года назад

    Could you please explain NAT type too . Thanks again 👍

  • @КристиянКалугеров
    @КристиянКалугеров 3 года назад

    You are crazy but I do like your videos and way of expression :))

  • @vadimgoldenko6843
    @vadimgoldenko6843 3 года назад

    Interesting thing, this NAT. One question about it: how the source machine picks random port? Believe, source machine should ensure the port is free. But how the machine knows the port is free on the router? I guess, it sends a simple request to get that port is free to router. But what if all router ports are busy? So the request should not be sent, right?

    • @hnasr
      @hnasr  3 года назад

      The machine keeps track of all its used source ports because it has a list of all active connections. Usually the operating system takes care of this ..
      Good question

  • @SuperMichielv
    @SuperMichielv 4 года назад +2

    I have a question about IP addresses in same local network.
    If I run a local server on my PC localhost:9090 with IP 192.168.0.111
    Wy can't I connect to it from my smartphone in the same network by giving the address 192.168.0.111:9090

    • @hnasr
      @hnasr  4 года назад +2

      Assuming your phone is connected to the same WIFI network than you should unless the your computer does not allow inbound traffic? If it is windows enable port 9090 inbound windows firewall

    • @SuperMichielv
      @SuperMichielv 4 года назад +1

      @@hnasr
      Ok, thanks It was firewall related.
      I'm using Linux Mint on my PC.
      I googled and did the following:
      sudo ufw allow from any to any port 9090 proto tcp
      sudo ufw status
      Status: active
      To Action From
      -- ------ ----
      9090/tcp ALLOW Anywhere
      9090/tcp (v6) ALLOW Anywhere (v6)
      Now it worked!
      Thanks to give me advice!

  • @singaravelann3671
    @singaravelann3671 4 года назад +1

    Here in NAT, What if multiple request are been sent to same networks by different machines, how the response will be get back to the right machine using NAT table.

    • @hnasr
      @hnasr  4 года назад +2

      Good question!
      each machine in the internal network will have a unique IP address internally but the same public IP address (the router)
      The NAT table will have the internal port/IP address mapped to the public IP address with a random internal port..

  • @kayeshparvez
    @kayeshparvez 3 года назад

    Say two clients in the same subnet send request to the same server app. The nat table is updated with two entries. Then the request reaches the target server. The server then replies back to receiver. In this case, the router should be confused to find out real receiver. and how the port forwarding will work now ?

  • @lakshay7906
    @lakshay7906 2 месяца назад

    i don't know i may be wrong in when you make a get request shouldn't it go from layer 7 to layer 1
    4:19
    it should be
    source ip address | source port number |get| destination port number | destination ip address

  • @engineerscodes
    @engineerscodes 3 года назад

    cool video

  • @singhgoldi
    @singhgoldi 2 года назад

    Hey Hussein - Great video. Can you please share the slides?

    • @hnasr
      @hnasr  2 года назад +1

      Thanks Gurpreet! Let me do that I forgot to do so

    • @hnasr
      @hnasr  2 года назад

      Just posted it to the members community post :)

  • @yaseengousesamudri9390
    @yaseengousesamudri9390 2 года назад

    But what if 2 machines on the same subnet send different requests to the same destination? How does the router know, where in its subnet, to send the received response back to?
    i) Does it store extra information about those requests?
    ii) Does it overwrite the the original sender's information in the stored info.?
    iii) Does it send all the received responses from the destination to both the senders? (Doens't feel correct)

  • @alexstoyanov6792
    @alexstoyanov6792 5 лет назад

    Great content!

    • @hnasr
      @hnasr  5 лет назад

      Alex Stoyanov thank you Alex!

  • @aryankumar87771
    @aryankumar87771 2 года назад

    so what you're saying is to communicate on the internet we don't need to send MAC addresses along with the data frame ? MAC is only needed on a local network right. Am i right Hussein ?

  • @rohantammewar6337
    @rohantammewar6337 3 года назад

    Just one question. When the router assigns a public ip address to a request is it unique? If yes, how does he checks if the IP address is unique and what if there are no IP address available for that instance?

  • @logesh-s2245
    @logesh-s2245 3 года назад

    How does packet flow between different subnets?

  • @samueladewale2987
    @samueladewale2987 3 года назад +1

    What happens when multiple client nodes from the same subnet are reaching out to the external target node system?

    • @hnasr
      @hnasr  3 года назад

      They each get a unique source port to identify them

  • @nathanbenton2051
    @nathanbenton2051 4 года назад +2

    wow another great video - thank you! question: so where does the modem fit into this picture?

    • @sudqi
      @sudqi 3 года назад +1

      Modem comes before the router. It is probably a layer 2 device and basically what it does is to convert from telephone signals to ethernet signals and vice versa

  • @abdelrhmanahmed1378
    @abdelrhmanahmed1378 4 года назад

    i spend full day one the channel to get there, lol

    • @abdelrhmanahmed1378
      @abdelrhmanahmed1378 4 года назад

      one question here so who can use port 80 directly without port forwarding ?! only known web servers like Apache or gws ?!also the documentation said the gateway change the port to fit more connection to one private ip range ,using what called pat(port address translation ) in the transport layer (tcp) that called port overloading ,,
      here is some resource
      ruclips.net/video/01ajHxPLxAw/видео.html
      ruclips.net/video/n0UqAXu_GAI/видео.html
      www.freeccnastudyguide.com/study-guides/ccna/ch10/10-4-nat-overloading-aka-port-address-translation-pat/#:~:text=NAT%20Overloading%20or%20Port%20Address,access%20to%20all%20inside%20hosts.

  • @mateuszciupa8141
    @mateuszciupa8141 5 лет назад +1

    I enjoyed it more than 2min video xd

    • @hnasr
      @hnasr  5 лет назад +1

      Mateusz Ciupa 😂😂 glad you did! Thanks for watching

    • @vallwesture
      @vallwesture 4 года назад

      I also enjoyed more than 2 min videos! It brings more explanation and connects everything together!

  • @exe.m1dn1ght
    @exe.m1dn1ght 5 дней назад

    hey, what happens when the router stores in the memory 2 different private ips with the same ephemeral port and they both try to access the same server ip ?

  • @osmaninci672
    @osmaninci672 2 года назад

    14:22 two-three minutes videos are when u study exams at university🤣🤣. but if u work on a project U want a video to be longer as it can be and all words have a value of gold. maybe I should say Bitcoin.

  • @richard-social8125
    @richard-social8125 3 года назад

    I'll make sure to let the aliens know..they told me they're still using ipv4😂

  • @palaniappanrm6277
    @palaniappanrm6277 4 года назад

    Even in L7 LB, the proxy has to remember the client in some way so that it can sends the response from the server back to the appropriate requested client. It can use this NAT for this or it can use some sort of mapping between TCP connections in proxy FE and proxy BE. Right?

  • @saifsmailbox98
    @saifsmailbox98 3 года назад

    Is the third column in your NAT table required? Can the router not forward all inbound traffic coming on 44.11.5.17:8992 to 192.168.1.2:8992 ?

  • @mohammadturabali3870
    @mohammadturabali3870 4 года назад

    Mr Hussein , when you say that the source attaches the MAC address of the router to the packet, then does it mean that in the data link layer when it attaches the mac address of destination it attaches the mac address of router instead of final destination , if so then how does the packet reach the destination mac address if the destination mac address is not attached to the packet when it is launched from the router.

  • @andreigatej6704
    @andreigatej6704 4 года назад +1

    Great video!
    Isn't something similar happening when using docker? For example, if we want to containerize a nodejs app, we might instantiate the container with `-p 49160:8080`, so when going to the port of the host (49160), it will map to the private address of the container, which uses 8080. Is this correct?

    • @hnasr
      @hnasr  4 года назад +2

      Andrei Gătej that is very similar to iptables where it maps ports to internal virtual networks created by docker

  • @takudzwamhonde1276
    @takudzwamhonde1276 2 года назад

    Hi, Hussein. Quick question. In your OSI video, you have the port numbers before the IP address in the packet structure and in this video, you have the reverse of that. I assumed that the port numbers get added before the IP addresses. Is this a mistake or I am wrong?

    • @hnasr
      @hnasr  2 года назад

      The way I present it is just for visualization and explanation purposes.
      In reality, the IP packet header has the ip addresses and the TCP segment has the port.

  • @unnoticedspacegoat8537
    @unnoticedspacegoat8537 2 года назад

    what happens when multiple clients sends a request to the same ip address. How does the router know which request should be forwarded back to which client?

    • @hnasr
      @hnasr  2 года назад

      a random source port will be assigned to both clients. those ports will be used to reroute packets back to each client.
      e.g.
      bot h 10.0.0.1 and 10.0.0.2 want to visit 8.8.8.8 : 80 , public router ip 1.2.3.4
      router will have two entries
      10.0.0.1 : 1111 -> 1.2.3.4: 1111 -> 8.8.8.8 : 80
      10.0.0.2 : 2222 -> 1.2.3.4: 2222 -> 8.8.8.8: 80

  • @abba5.rangwala
    @abba5.rangwala 4 года назад +2

    If there are two device 192.168.1.2 and 192.168.1.3 and both request from the same port 8992 for the same address 44.12.1.9:8080 then in table there will be two row. But problem is when it received the package router don't know from which device that request came because there is data duplication, So will it sent package to both server or may be router will do second request on other port.
    case 1: same port
    -----------------------------------------------------------------------------------------------------
    192.168.1.2:8892 | 44.11.5.17:8892 | 44.12.1.9.8080
    -----------------------------------------------------------------------------------------------------
    192.168.1.3:8892 | 44.11.5.17:8892 | 44.12.1.9.8080
    -----------------------------------------------------------------------------------------------------
    case 2: different port of router
    -----------------------------------------------------------------------------------------------------
    192.168.1.2:8892 | 44.11.5.17:8892 | 44.12.1.9.8080
    -----------------------------------------------------------------------------------------------------
    192.168.1.3:8892 | 44.11.5.17:8893 | 44.12.1.9.8080
    -----------------------------------------------------------------------------------------------------
    I think they implement second approach.

  • @zaarare
    @zaarare 3 года назад

    i think i have eye problem
    i'm sure this channel should have 1m subs not 100k so guess it's my problem

  • @nithishkarthik9163
    @nithishkarthik9163 3 года назад

    What if there are two local machines sending packets to the same server, in that case, what would the router do because, when the response comes back from the server, now the router will be confused as to where to send it know??

    • @hnasr
      @hnasr  3 года назад +1

      Router will assign a unique source port for each machine so when the server reply to the router ip and port, the router will forward the packets back to the correct machine

    • @nithishkarthik9163
      @nithishkarthik9163 3 года назад

      @@hnasr now it makes sense..👍

  • @rabbyhossain6150
    @rabbyhossain6150 3 года назад

    What happens if a machine is not connected to a router for example maybe a phone?

  • @vim55k
    @vim55k 4 года назад

    In what video you talk about subnet?

    • @hnasr
      @hnasr  4 года назад

      I don’t believe I discussed that hmm i do mention it here ruclips.net/video/ECukPUUK_74/видео.html
      And here
      ruclips.net/video/dh406O2v_1c/видео.html

  • @mhmdshaaban
    @mhmdshaaban 4 года назад

    It's kinda a ridiculous question but I have to ask it :)
    As far as my concern, the router is responsible for connecting different networks together and switch for local networks.
    So, I think in this example it should be a switch, not a router doesn't it?

    • @hnasr
      @hnasr  4 года назад +1

      Mohamed Shaban a switch plays with Mac addresses at layer 2 while the router plays with ip addresses at layer 3 changes subnets
      But yes my router plays both as a router and a switch

    • @mhmdshaaban
      @mhmdshaaban 4 года назад

      @@hnasr I know that bro. What I meant is that if it's a router why we are dealing with mac addresses in this stage

    • @hnasr
      @hnasr  4 года назад +1

      I edited my comment, my router acts both as a switch and router in some cases..

    • @mhmdshaaban
      @mhmdshaaban 4 года назад

      @@hnasr Thank you so much,
      Hussein :)

  • @parasarora5869
    @parasarora5869 4 года назад

    so...nat is keeps track of those changes IP addresses in a table and change it accordingly on requests ?! 🤔🤔

    • @hnasr
      @hnasr  4 года назад +1

      Paras Arora correct, not requests though, packets

    • @parasarora5869
      @parasarora5869 4 года назад +1

      @@hnasr ohh yes yes ... thank u for clearing !! and great video sir 👌👌

  • @HexapoDD
    @HexapoDD 4 года назад +1

    NOOOOOO! In the picture at ~3min I was telling myself "pls dont say router, pls dont say router" and then you said it :-( routers rout between networks. you meant a switch. sorry to be that guy...

    • @hnasr
      @hnasr  4 года назад

      CORRECT! The switch component in my router is what did the work at 3:00~ good catch ..
      my router acts as a router and switch at the same time, routes traffic to outside network, and switches packets to the same network

    • @nournote
      @nournote 3 года назад

      @@hnasr Also at traslation time, the source port is not necessary the same after translation, because at some point, 2 hosts may have chosen the same source port.

    • @nournote
      @nournote 3 года назад

      @@hnasr Also, at 07:00, no need to do an ARP request, because the server has just received a packet with IP 1.2 inside a frame with MAC AAA.

  • @cunningham.s_law
    @cunningham.s_law 4 года назад

    how does the router know which machine to send the response back if two machines send a request to the same server?

    • @hnasr
      @hnasr  4 года назад +3

      honeyspoon short answer source ports..
      Long answer
      when machine A sends a request to Server S it will have source ip and source port those are used in the NAT table to map the response back.
      E.g.
      Router store this in NAT
      A:123 connects to S on port 80
      B:456 connects to S on port 80
      If A sends a request S the router exchanges A IP with its own R, and source port 123 becomes another random port lets say 999, then when a response
      R:999 - S:80
      When server responds back to R:999
      Router says which machine is on port 999 and was destined to S:80 .. that is machine A:123

    • @cunningham.s_law
      @cunningham.s_law 4 года назад

      @@hnasr Thanks, very clear

  • @vipsvips3213
    @vipsvips3213 2 месяца назад

    ❤❤❤❤❤❤❤❤❤❤❤❤❤❤

  • @henrikrinne3639
    @henrikrinne3639 3 года назад

    what if two computers want to access the same public server?

    • @henrikrinne3639
      @henrikrinne3639 3 года назад

      ah the assigned port of the router will determine which packet go back to which pc

    • @hnasr
      @hnasr  3 года назад +1

      Correct the router will assign a different source port for each in the NAT table

    • @henrikrinne3639
      @henrikrinne3639 3 года назад

      @@hnasr am watching your webRTC video. 👍👍👍👍👍👍

  • @benripka6977
    @benripka6977 2 года назад

    Lol sounds like a grinder account had me laughin

  • @poke_champ
    @poke_champ 5 лет назад +1

    can syou show this being done? something practical

    • @hnasr
      @hnasr  5 лет назад +1

      Sure! Might consider it in another video, thanks for the tip!

    • @hnasr
      @hnasr  5 лет назад +2

      I just posted a new video on how to do this check it out! ruclips.net/video/uuWzk8U4dJE/видео.html

  • @SaumyaSHota
    @SaumyaSHota 3 года назад

    the talk is more like listening to some cartoon channel.

  • @vim55k
    @vim55k 4 года назад

    I think you pronounce get as git... (

  • @gauravsah7780
    @gauravsah7780 3 года назад +1

    Too much crap in between for NAT basics.

  • @batista98854
    @batista98854 3 года назад

    Too much repetition. Actual topic starts at @12:00