473,657 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Desitnation mac address and ip for machine behind gateway

1 New Member
If I want to send a packet to another system and there are two gateways(mine, and thiers) what would be the destination MAC address be? Would it be to my router, their router, or their system? And what would be the IP address destination be? MY first guess would be my router.
Oct 17 '11 #1
1 1876
Banfa
9,065 Recognized Expert Moderator Expert
OK the routers are presumably doing NAT (Network Address Translation), i.e. the router is connected to 2 networks and as packets pass through it it translates the addresses in the packet from 1 network to the other. The router itself has 2 addresses, 1 on each network.

If you connect to a web-server on the internet what happens is
  • Your computer sends the request to your router (which is in your computers network configuration as its gateway address)
  • Your router sees the request, assigns a port for the connection, stores a record in an internal table matching the port it assign and its external IP address with your computers IP address and the port your computer used. Replaces your computers address and port in the packet being sent with its own and forwards the packet onto the destination.
  • The packet may traverse several more NAT routers doing the same thing with-in you ISPs network before reaching the internet but we'll ignore that it just adds more layers of the same thing.
  • The packet arrives at the web-server which sends reply to the senders address in the packet, that is the address and port provided by the router.
  • The packet arrives at your router, it checks in its internal tables for a record matching its external IP address and port number it received on, which it finds so it substitutes the ip address and port in finds in that record (the ip and port of your computer) back into the packet as the destination and forwards it onto your computer on the internal network which receives it and displays the data in your browser.

This is all very well the problem is that if you connect to someone else's router you will connect to its external address (assuming it is visible to the internet/network) but the router will have no entry in its internal tables telling it where to forward the packet to, it will be unable to do anything.

There is a way round this that most routers support, you program the router with a permanent port redirection, for example you program it for forward everything received on port 42321 to a specific ip address and port on the internal network. Obviously this has to be the ip address and port for the receiving computer. Then when the router receives an external connection and packets on that port it can forward the packets to the correct destination.

Of course that is rather dependent on the router being visible on the internet either using DNS (having an assigned URL) or having a static IP address (unlikely) or you can use something called dynamic DNS which accounts for the changing ip address of the router and keeps a url pointing at it.
Oct 18 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
18573
by: Darren Kirby | last post by:
Hello list: I am writing a small app in python which tracks the kernel banner at kernel.org and downloads newer kernel version(s) (if there are any). I am using GeoIP to set the download to a local mirror if there is one. This is what I use to get the local IP address: ip = socket.gethostbyaddr(socket.gethostname()) # returns: ('hostname.domain', , )
2
1195
by: bob the yob | last post by:
Is this possible or should I set a cookie with md5 session id and login time and date.
1
1705
by: roger beniot | last post by:
Is there anyway to get the external IP Address of a gateway/router that a small LAN is connected to. I currently have a variety of linkSys and Netgear gateways that I have a variety of windows LANs connected to... I would like to be able to get the IPAddress of each gateway. Thanks in advance, Roger
7
21289
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of someone (client) that visits a web site through an anonymous proxy if this person ONLY has JavaScript enabled in their browser? This is NOT a question about PHP, perl, VBScript, Java(.class), or ActiveX. Let us _only_ deal with JavaScript for...
3
8976
by: roger beniot | last post by:
I would like to figure out how to detect an IP address change for an XP/Win2K3 machine that is leasing an IP via DHCP (and do it in C#)... Is there any event that indicates an IP address change?... I really don't want to poll for a change. I would like to get an event indicating the IP address has changed and propogate that change to other levels of my app. If anyone has a solution that isn't in C# I am interested in that as
1
1569
by: Terry Petty | last post by:
I want to write a program that gets the leased IP address off of my DSL router and then tells a remote machine what that address is so that machine can find it. The remote machine on the web with a fixed IP will have a page with a link to a video camera that is located on a closed internal network. That network gateway is a DSL router and the camera is behind that proxy server. When the leased address changes, the program will report to...
0
328
by: Herbie | last post by:
I am trying to retrieve my WAN IP address from behind a Linksys router I have tried this but it only retrieves my Local IP address Dim MyIP As IPHostEntry = Dns.GetHostByName(System.Net.Dns.GetHostName) Any suggestions would be much appreciated
8
4353
by: google_groups3 | last post by:
Below is a snippet of code I am using. I want to set the IP, subnet and default gateway of my local computer via code. However, when I do it, I get a "not found" (error number 5) error on the default gateway line. Dim GateArray() As String = {"99.99.99.1"} 'Array Dim inPar As ManagementBaseObject = Nothing Dim outPar As ManagementBaseObject = Nothing Dim blah As ManagementBaseObject()
0
1549
by: bweaver4usenet | last post by:
Hi, all. I need some help getting a client up and running. Client Issue Client is using vc++ 6 and the Soap Tkt. Our web service is built with c# vs.net 2003. Can someone refer me to a sample I can take a look at for this specific case? Gateway Issue The gateway URL is in this form: https://domain.com/service.asmx. They're hitting the dynamic wsdl at service.asmx?wsdl where they're
14
4043
by: John Kotuby | last post by:
Hi all, I have a situation where a Web Server at an install site does not currently have a publically registered Domain Name associated with the site. This requires that the a user access the site from a remote (outside the LAN) browser using the IP address, as in http://192.35.78.234 . Currently in my code I use the following syntax to obtain the Root Web path which I then append as a prefix to Images and Links in external documents...
0
8323
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8838
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8613
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.