Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this question
(1) What is my and others real IP address on same lan? Can we still have a unique IP despite the fact that we share the same router/LAN? and how does the IPs are assigned?
Thanks!
If you use a router to access the internet you probably have a DHCP Server running on the router as well.
This gives each computer a unique IP address wit a lease of x-days.
From the net only your public (mostly dynamic) ip address is shown to others.
Inside you private local net you have private ip addresses like 192.168.x.x/class C.
Easy way to find out your ip addess on your local computer:
open a cmd shell and type "ipconfig /all".
Then you see your IP address and also the gateway (which is your router).
Within a single LAN (which I'm defining here as a section of the net with no network address translation (NAT)), your IP address should be unique.
That's so that traffic can get to the correct machine.
However, it's never that simple. There's a good chance that the IP address the world sees you at is nothing like your local IP address. Your local address is probably 10.x.x.x or 192.x.x.x (from memory), one of a group of private IP ranges. For example, my Ubuntu box here is 10.1.1.2, an address that probably half a million other people on the planet have.
But my packets don't hit the internet with that source address since they go through a NAT router on my desk as well as a large number of other NAT'ting devices in my ISP.
It's this NAT process that allows all those private IP ranges to be usable.
As to how you get your IP addreses, you can set up static addresses (very useful for servers that you don't want changing) but the usual approach for non-server machines is to use a DHCP (dynamic host configuration protocol) server which manages the IP addresses and hands them out as required (on booting your client machine usually).
Typically, the DHCP server wil lock an IP address to a specific Ethernet MAC address for a period of time (in our corporate environment, it's three weeks). That means that, barring a four week holiday with your machine turned off, you should always have the same address.
Keep in mind that you may have more than one network card with separate IP addreses. You may even have a single network card with multiple IP addresses. In that case, you can be said to have more than one real IP address although I'd probably still say that it's the one servicing your default route (the source address your packets go out on by default).
It's a very ... interesting ... field to work in :-)
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I'm trying to enable port forwarding in my router (ZTE F660) but for some reason it is not working at all. First I started my server application in my ubuntu machine and I fixed its ip address to 192.168.1.2. Then, I set the rules as following:
It did not work. So, I've tried to disabled the firewall on my router settings:
It did not work as well, then I've disabled the firewall of my host machine by typing:
sudo ufw disable
And it did not work. Then, I tried to use many different ports and it did not work! :(
I've tried to use some port forwarding testers (like this one: https://hidemy.name/en/port-scanner/) and it always says that the state of the port is "filtered". I called the provider of my internet and they said that the port forwarding should be running but they did not offer technical help. Can anyone help me with this? Can't think about anything else to do.
Your ISP is using CGN (Carrier-Grade NAT) because your WAN address is in the Shared address space (100.64.0.0/10). That is not public address space, and it is defined by RFC 6598, IANA-Reserved IPv4 Prefix for Shared Address Space:
Abstract
This document requests the allocation of an IPv4 /10 address block to
be used as Shared Address Space to accommodate the needs of Carrier-
Grade NAT (CGN) devices. It is anticipated that Service Providers will
use this Shared Address Space to number the interfaces that connect
CGN devices to Customer Premises Equipment (CPE).
Shared Address Space is distinct from RFC 1918 private address space
because it is intended for use on Service Provider networks. However,
it may be used in a manner similar to RFC 1918 private address space
on routing equipment that is able to do address translation across
router interfaces when the addresses are identical on two different
interfaces. Details are provided in the text of this document.
This document details the allocation of an additional special-use IPv4
address block and updates RFC 5735.
The address block is detailed in Section 7:
7. IANA
Considerations
IANA has recorded the allocation of an IPv4 /10 for use as Shared
Address Space.
The Shared Address Space address range is 100.64.0.0/10.
That address space is also found in the IANA IPv4 Special-Purpose Address Registry.
What that means is that you have a home/residential ISP agreement. The ISPs are using CGN to save their precious public addresses for businesses willing to pay for them. The ISP NAT would also need to be configured to forward the port to your WAN addressing the Shared space, but the ISP cannot do that because others behind the CGN may also want that port forwarded to them.
The ISP does not really care that this breaks what you want to do because your residential ISP contract contains a clause forbidding you from running services from your network to the public Internet. You will need a public address and ISP permission to do what you want, and that probably means a business contract. The proliferation of CGN is a big driver for hosting companies, and that is an alternative way to do it.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
This questions is hypothetical, this situation would most likely never happen nor could any router handle it
Situation 1
Lets say for example you (somehow) managed to put 255 devices onto your network. Lets refer to the 255th device as D255 and, just for later reference, the router's IP address is 192.168.0.1. If I am correct D255's local IP address should be 192.168.1.255. So what if we buy a new device (D256) and connect it to my home internet along with the other 255 devices. What would D256's local IP address become? I thought about it and I assume that it would be 192.168.2.1. Am I correct?
Situation 2
After thinking about situation 1 I came up with another situation. What if you had 65025 (255 * 255 = 65025, if you see where I'm going with this.) devices connected to the your internet? The last device's (I will refer to as D65025) local IP adress should be 192.168.255.255 (That is assuming that situation1's solution is correct.). So what if I go out and buy a another device (D65026) what would it's local IP address be? It can't become 192.168.256.1 because the numbers can not exceed 255 and it can't become 192.169.1.1 because 192.168.x.x is the local IP reserve and 192.169.1.1 exceeds the local IP limit and (correct me if I'm wrong) would be a external IP address. So what would happen?
I appreciate your feedback!
A local network will typically be configured with a DHCP server to hand out IPv4 address leases along with name server addresses and a gateway address.
Residential and small commercial routers are usually configured to do Network Address Translation and have a DHCP server configured to hand out Private IPv4 addresses and the router's private IP as the gateway and nameserver. The size of the local subnet is determined by the router's configuration.
A typical configuration is 192.168.0.0/24 which provides 254 host addresses.
The DHCP server has configuration that specifies the address pool it can hand out leases for, how a DHCP server behaves if it is asked for a lease when all addresses in the pool are currently assigned depends on the configuration, but in most situations it will just not respond as there are "no free leases".
In this situation a host will likely select a link-local zero-configuration address from 169.254.0.0/16 and not have any Internet access or any other hosts on the network except those with Zero Conf addresses. It may retry DHCP at a later point.
The RFC1918 private address block 192.168.0.0/16 actually has capacity for 65534 uniquely addressed hosts. Ignoring the issues of having a layer 2 broadcast domain of this size, the same constraints apply: when there are no leases left to assign, none are assigned.
If these private addresses are to have Internet access they will be Network Address Translated to one or more public IP addresses (usually one) by the router. One public address is unlikely to be sufficient for a large number of private network hosts, constrained by the availability of local TCP / UDP port numbers.
I suggest you read up on IP networking to fill in basic knowledge.
If you are using DHCP, when you run out of addresses, it will kick one of the other devices off the network, probably the one which connected first. There are only so many devices which can connect to a network, but that number depends on the router configuration.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
My ifconfig configuration is inet addr:192.168.1.3 and when I try to get know the router ip by executing ip route show | grep -i 'default via'| awk '{print $3 }' i get 192.168.1.1
I remember this ipv4 addresses from provider handbook, so they are roughly the same for all ethernet and routers config in my district.
The questions are:
How can I get know my real ip address?
Who and where assigns me unique ip?
Why do provider assign this standard ip for everyone?
If I get know my unique id will I be able to establish TCP | UDP connection? How does transmission works unique_ip -> 'router_ip' -> 'ethernet_ip' will not it be passed to my friend why share with me router?
I'm not completely following your question. Any IP address assigned to your computer is a real IP address which your computer uses. It may be a private IP address which can be reused in different networks, or it may be a public address which is supposed to be unique in the world (I think this is what you mean). IP addresses are assigned to your computer either by being statically assigned, or being assigned through DHCP.
If you want to know the public IP address assigned to your router, then you can look in your router, or browse one of the websites which will tell you what your public IP address is.
The ISP owns one or more blocks of public IP addresses, and it will assign your router an address via DHCP or PPP. Since some RIRs no longer have nay blocks of public IPv4 addresses to assign to the ISPs, many ISP have started using CGN which will assign private IP addresses to your router. This causes a double-NAT, which causes all kinds of problems.
The ISP does not assign your private IP addresses, you do that. There are three blocks of private IP addresses (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16) which you can use to assign your private IP addressing. The router manufacturers all used to use 192.168.0.0/24, but in recent years, they have mostly moved to using 192.168.1.0/24. It doesn't matter which block of private addresses you use.
Your router is running NAT which translates all your private addresses to a single public address (assuming your ISP isn't using CGN). In order to reach your LAN from the public Internet, you will need to set up NAT forwarding rules to be able to translate from the public IP address to one of your private IP addresses. This is known as port forwarding, and it is done by TCP or UDP port number, and you can only have one TCP or UDP port reach one private IP address inside your LAN. For instance, if you run a web server (nominally port 80), you can configure your router to forward any traffic arriving on the public address using port 80 to the web server inside your LAN.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
Suppose a host machine A in LAN has address like this 192.168.0.123. It connects to the Internet through a default gateway 192.168.0.1.
When A sends data to an external machine B, how does the gateway handle the IP packet?
When B's response reaches the gateway, how does the gateway locate A as the intended receiver?
ADD 1
Seems communication between A and B can only be initiated by A. Because external machine doesn't know about A hidden in the LAN.
Suppose there's another machine C who sits in another LAN. A and C wants to communicate to each other. I guess the only way to do that is to have some public machine like B to act as a middle-man. Maybe that's why all chat programs like OICQ have to log onto a server first, such as B. And all chat messages are forwarded by that central server. And I think unless the A-B or B-C connection are persistent, the forwarding can only be implemented as pulling by A or C, rather than pushing by B, because only A and C can initiate request to B.
Well - a short answer - through something called Network Address Translation
A slightly longish answer -
So here's what happens # A - Route lookup to get Next Hop (default gw in this case). ARP resolution to find out MAC address of Default gateway) and then Network Address Translation # Gateway - before packet goes out into wilderness.
Route Lookup -
Every well configured machine should have a local routing table - which would normally contain two routes. One is default route and another is called the subnet route. There can be more than these two routes, but definitely these two routes should help. the 'subnet route' helps in reaching the nodes on the subnet. and the 'default route' helps to reach anyone else. So eg. in your case there'd be two routes (0.0.0.0/32 gw = 192.168.0.1) the 'subnet route need not have gateway - in fact will not have gw). In this case since B's address is not on the subnet default route and gw corresponding to it will be used.
ARP resolution
A broadcast ARP request message is sent by A to ask for Gateway's MAC address - which it wants to use before forwarding the packet. Since Gateway knows it's own IP and MAC, it replies with it's own MAC address.
NATing -
So when a browser (say) on Node A wants to connect to a machine on Internet Node B (on a web server). It will send a TCP packet with following information - DIP = IP of B/ SIP = IP of A/ DP = 80/SP = 10000 (randomly chosen by A)/Proto = TCP.
Now when this packet arrives on Node B. Node B can forward this packet as it is - if it was simply working as a gateway - without NAT functionality. Technically that packet can go out and reach B, but there's no way for B's reply to reach back to 'A'. 'cos 192.168.X.X are private IP addresses - those packets routers are not supposed to forward them. So packets going out of A should have an IP address that can be reached by Host B. Gateway usually has a 'global' IP address. This address is used in all outbound packets. So packets on return path could reach to Gateway and subsequently to 'A'. So the IP address part is taken care of. The port part needs to be dealt with as well. Technically B could simply re-use the Source Port in outgoing IP packets, but imagine another node (say C) using a same port going to same server, so gateway would be clueless about whom to send packets to - on return path. So typically Gateway uses different outgoing ports and keeps a mapping between Inside IP-Port and outside IP-Port (technically that means Gateway can only reliably forward packets for 64 K connections). Normally this is not a problem, but for a large number of nodes on LAN with persistent TCP connections, this could be a problem. So typically multiple IP addresses are used - effectively multiplying the connections supported.
Hope that was not too long!
This is called NAT: Network address translation. The router strips off the source address of outgoing packets and replaces it with its own public IP address then forwards the packet. Onthe way back the router receives the packet and replaces the destination address with the internal IP address.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I don't have a great understanding of how networking works. From what I understand the WAN ip address which is visible to the outside world is different from thed LAN ip address. Inspite of that at any point in time isn't an ip address unique to one particular user? The reason I ask this is because we get a lot of spam from one particular ipaddress. If we report that user to the authorities, without any trouble they should be able to pin point the user, correct? My guess is they can take this WAN address that we provide them, to the ISP provider. And the ISP provider will be able to link this WAN to a LAN ip address, which can pin point the spammer.
Every host and a router on the Internet has an IP address, wich encodes its network number and host number. The combination is unique: in principle, no two machnies on the Internet have the same IP address. All IP Adresses are 32 bits long and are used in the Source address and Destination address fields of IP packets. You should note that an IP address does not actually refer to a host, but to a network interface, so if a host is on two networks, it must have two IP address, for example, if it is connected to local Ethernet, and to a WIFI(802.11) simultaneously. So, basically yes, you are correct, and the ISP provider should be able to locate it without difficulties.
EDIT: If the host is behind a NAT, then things can get a bit complicated, for example, if the user is spamming you from his office in a company, then that company gets the ip you are getting, but yet you are able to trace the company.