How does Network Address Translation affect computers on the network? - nat

(I’m asking the question here because most of the other similar questions on StackExchange seem to be here — please let me know if there is a more appropriate community).
I have a number of computers on a network with a Linux Server running iptables, which is using Network Address Translation.
Not being an expert, I understand that the role of NAT is to take the internal 198 IP addresses, forward them to the external host under a common external IP address, and, when the response arrives, reverse the process.
If a number of internal machines make requests to the same external host, does this mean that host thinks they’re all coming from the same machine? What implications would that have for security or if the host wants to blacklist a machine?

"The router knows where packets belong because The router saves ... an address translation table. It remembers what inside-outside address translations it has made. As such, one inside address equals one outside address, and the out-on-the-internet destination is irrelevant. This, of course, ignores the firewall present in practically every NAT router, which tracks full connections:"
How NAT Port forwarding works

Related

FTP to external address from server on internal network

I am at a large University, with servers set up on the Univeristy network. The network has internal (10...) IP addresses, and external (129...) IP addresses. I have a ColdFusion-based business process which FTP's data from an external server.
The server on which the ColdFusion instance is based has several (about 10) IP addresses associated with it, both internal and external. It has one primary address, which has been, until recently, external.
Using Wireshark, we have been able see which IP is used, and it is never the primary, but other than that, does not seem to follow any logic.
We recently changed the primary IP for the server to an internal address, to comply with new University-wide security policies, and the FTP connection from Coldfusion stopped working. Using Wireshark, we've confirmed it is going out on one of the internal (10...*) IP addresses (not the primary).
Is there a way to control which IP ColdFusion uses for an FTP connection, either through system configuration, or programmatically?
Code for the FTP call:
var ftpService= new ftp(
username = partnerConfig.sftpLogin,
connection = "MyConnection",
password = partnerConfig.sftpPw,
fingerprint = partnerConfig.sftpFingerprint,
server = partnerConfig.sftpServer,
secure = "yes"
);
var result=ftpService.open();
var result2=ftpService.listdir(directory = partnerConfig.inFolder, name="dirlist");
var result3=result2.getResult();
EDIT: My server guy tells me that this University is fairly unique in how it configures the subnets. NO firewall exceptions are allowed from the 10.* subnet. The "Public" IP's are not public by default, simply the ones which are capable of having exceptions.
FURTHER EXPLANATION: It comes down to the Rules and IP addresses the main IT org at the university set up. the 10.x.x.x IPs are never allowed access outside the university ("internal"). 129.x.x.x IP, may have firewall exceptions ("external"). If I type ipconfig (it's Windows), I see about 10 static IP addresses, half of which are 10.x.x.x, and half of which are 129.x.x.x. When the "primary" IP for the machine was a 129.x.x.x address, Coldfusion chose one of the OTHER 129.x.x.x addresses for the outgoing IP for the connection. With the "primary" IP switched to a 10.x.x.x IP, ColdFusion is choosing one of the OTHER 10.x.x.x addresses for the outgoing connection. My choices, as far as I can tell are 1) Switch the primary back to a 129.x.x.x for the server; 2) Move the site to a different server with a primary of 129.x.x.x, and keep other sites on the server in compliance with the new policy; 3)See if I can figure out how to control which IP Coldfusion chooses from the 10 static IPs on the server.
Our admin figured it out. We needed to add a static route to the server, so that whenever ColdFusion (or any application) tries to connect to the specific destination we were FTPing to, it goes through a specific outgoing IP address.
This was not something I was familiar with, but a quick search gives the basics: http://technet.microsoft.com/en-us/library/dd469825.aspx
You have an internal IP address and you are not sure what the external is? This sound like a network bridge issue. What you are looking for is FTP proxy or some tool that associates an externally assigned IP to an internally assigned IP for port 22 (or whatever you set your port to). Look at: http://wiki.squid-cache.org/Features/FtpGateway
FTP reverse proxy
It sounds like your IPs (even internally may not be static)...or maybe it just feels that way. Make sure your internal IP is static.
Read about FTP port forwarding: Here are some port forwarding guides.
Other keywords FTP bridge, FTP one-to-one mapping, among others.
Good luck.
I had a similar question regarding the cfmail tag:
Force cfmail tag to send from a specfic server IP address
Unfortunately, I didn't get an answer that worked. ColdFusion seems to pick (seemingly at random) which source IP address is used.

IP Comparison between 2 Locations

can one location have more than 1 IP address? I have 2 IP addresses and need to know if they originate from the same source. Thanks
You're missing clear definitions of "location" and "source" in your question but lets go with the assumption that you mean "physical machine" for both (as it's obvious that multiple machines will have different addresses and that a single machine can change its IP address over time).
In that case, the answer is yes. The operating system may bind as many IP addresses to a physical network port (and a single MAC -- the physical addressing used by Ethernet) as it wishes.
Binding multiple IP addresses was the standard way of doing "virtual web hosting" before HTTP/1.1 arrived with the "Host" header. The provider would use DNS to map different host names to different IPs on the same network (usually the same subnet as well) and then assign all of them to the same interface. The webserver would get address information from an incoming connection and based on the local IP address would know which virtual host was being accessed.
This led to a higher-than-typical use of public IP addresses but the practice is now gone with the proliferation of HTTP/1.1.
I'm not sure how Windows presents it, but Linux will present a physical interface with multiple IP addresses as multiple logical interfaces such as "eth0", "eth0:1", "eth0:2", etc. Each logical interface has a unique IP address even though they share the same physical interface.
This is hard to tell. Especially it is hard to tell if these IP addresses are from different times. Today I may have a different IP address than tomorrow.
Even they are from the same time, a load balancer im my internal equipment might send my packets over the fail-over line if the 1st one is overloaded or broken down.
One network adapter normally has only one IP address at once and a typical end user only has one network connection active, but even then the IP address can change. The user could switch from wireless to wired and back or a power outage might reset the ISP's DHCP server (assigning everyone a new IP address).
If you want to identify the user even if his IP address changes, you need to identify the user by his session id, stored in cookies. As two users can have the same IP address (a whole company could be behind a NAT), you should never rely on IP addresses for identification.

if I have a local ipv4 address can I use it from outside a network to talk across a NAT

I have an application where I want a device inside a network behind a NAT to make a call to the public network giving a server its local address, Later, say 10 or 20 minutes later, I'd like the server to be able to contact the device inside the network.
Is there any protocol generally supported by firewalls/routers etc. that would direct me to the local node if I provided its actual current local address?
Thanks
No, there is no such protocol. Moreover, in the case of multiple NAT, the local node can only know its address behind the innermost NAT, and the server can only know the public address outside the outermost NAT, so you have no means of mapping through multiple NATs, or even knowing how many exist in the path.
The local node will have to initiate and maintain an open connection with the server if it wants to receive anything from the server.
No there is not a protocol for mapping the IP address, though you can use portmapping/port forwarding to map specific a port to an IP Address
This is the sort of thing UPNP is meant to solve. Note that there are still challenges -- the network equipment needs to support it and the feature needs to be enabled. Many network admins will not enable it for good reason.

how to redirect connections to IPs behind the NAT to NATted (public ) IPs at the source?

I have an application that relies on IP addresses for communication (Domain names simply does not work. :(... )
Its function is to connect to its peer on the other machine and send data over after establishing trust. During the "trust establishing" phase they both exchange their IPs for future communication. They both are behind the two different firewalls and are NATted. One is in our NATted office network and other is in the cloud NATted behind their firewall. The applications knows their respective private IPs and exchange that (the 10.x.xxx.xxx range), when they try to connect back to each other (using the private IPs with range 10.x.xxx.xxx) for transferring data they fail. The connection is TCP and the port range is pretty varied.
I am curious if there is anyway I can hard code (for this one time) a rule (at may be firewall level or some place outside my application) that says if there is a connection being initiated for IP address 10.x.xxx.xxx then redirect it to 205.x.xxx.xxx?
Private IP address ranges like 10.x.y.z are, by their very nature, private.
You can't do any meaningful resolution unless each node in between the endpoints has rules in place to translate these.
Translation is tricky, all the main tools you would use cater for static translation (port forwarding, e.g. where a particular port is forwarded to a particular IP). This is one avenue, but it is a hacky one (it requires you to open lots of ports, procedurally update your router and probably have some sort of broker server to maintain mappings).
Alternatively, you could run the isolated networks over a VPN, which would give your endpoints mutual private IPs which you can use to connect to eachother. It would simply be a case of binding to this new address and communicating across the VPN. This would also potentially encrypt your communication over the internet.
Other possibilities are to use NAT/TCP punchthrough techniques which can allow traversal, but these are really a patch to a broken network topology (Read up on IPv6 to see how this can be alleviated).
Alternatively, you could route all the connections over a proxy, but this will complicate matters compared to a VPN.
To answer the question about hardcoding a rule, port forwarding is the solution here. It will obviously depend on your router configuration for the peer accepting the connection, but this client should have the port target port forwarded to the machine. This will obviously not scale very well and is really shifting to a server/client architecture for one connection!
Depending on your hardware, you may be able to forward a range of ports (if a single port cannot be established) and limit the port forwarding to certain incoming connections (the external IPs).
Information on port forwarding can be found at http://portforward.com/
This sounds a lot like what you'd want out of a VPN. Is there anyway that you could set one up? Basically the Site-To-Site VPN between you and the cloud would say 'oh hey, here is an ip located on the remote network, go ahead and connect through the link'. Would this kind of solution work in your case?
Something along these lines: http://i.msdn.microsoft.com/dynimg/IC589512.jpg

Different values for my IP address?

Was just wondering why I seem to get different values for my IP address from different sources. If I go to one of the many different 'what's my ip' sites on the net I get a completely different value from when I use ipconfig (on win7)
And no, it's not the subnet mask I'm looking at, these are the actual ipv4 addresses, why would they be resolving to different addresses? Are these 'what's my IP' sites only able to hit an exchange and not determine the IPs of my actual box itself?
If your PC is on a network and not directly connected to your ISP via a modem, there will be at least one router between your machine and the internet. That router will almost certainly be doing NAT (Network Address Translation) and possibly DHCP (Dynamic Host Configuration Protocol) too.
The router will have been assigned an address by the ISP when it established the connection. This address might be static (unchanging) or, more commonly, dynamic (changes periodically as the ISP sees fit). So your 'public' address - the one the router has been assigned and which is visible to the internet - may change from time to time.
Your PC will be connected to the router, and will either have a fixed IP address assigned to it (typically in the 192.168.x.x range) through your OS networking config, or will be given one by the router each time it connects (when you switch on or reboot) via DHCP. In this case, the address will be in whatever range the DHCP service has been told to use (again, the default is likely to be in the 192.168.x.x range).
So your PC has its' own internal address, and your router has its' public address. When you exchange internet traffic, the machine at the other end of the connection will see your public address, not your internal address - the router takes care of forwarding data to the right internal address automatically.
Depending on what IP-checker service you're using, it might display your public address (from the router, which may change if the ISP assigns dynamic addresses) or your internal address (typically when a script runs inside the browser and asks the machine directly).
The answer won't clarify anything, but I'll tell you anyway.
They're both right.
No, your machine doesn't really have two IP addresses, but the IP it shows as depends on who's looking, and from where.
•
What you're seeing is the result of what's called a NAT router. NAT stands for "Network Address Translation". The router manages the IP addresses on a LAN, or Local Area Network, and then translates to the appropriate IP address it was assigned on the external network, usually the internet.
details

Resources