Why does my IP address Change so frequently? - networking

I have connected my network connection through the wireless device with DHCP. Recently I have changed my connection from wireless to wired cable connection.
At that time My IP address got changed automatically,
I tried these steps Changing Your Private IP to have my past IP address but also it changes automatically.
Now, when I check my IP address it shows a different IP from before. That makes 3 changes, my confusion is around whether it changes itself once per day or not. If anyone has an answer for this, please let me know.

Are you sure you talk about private IP and not Public one ?
Did you try going back to wireless for few days and watch if your private IP don't change ?

Some details are missing so I can't probably make a good diagnosis of what you have here. But for now I'll try to help out.
If you are talking about your public IP address it's normal that it'll get changed quite often, unless you have signed up on your ISP for a static public IP address (ex. you told you're ISP that you'll be running a web server). It's normal for the IP to change in intervals, days, hours or even minutes if your ISP has lots of users.
If you're talking about your local IP address, you should check your router out (assuming you use one), check if how many people are using/connected to it.
OK, so we're dealing with Private IP. Your problem is it changing whenever you Disconnect/Connect right? Are you the only user? Or are you suspecting the router might be spewing out random IPs from the IP pool even if the previous ones aren't already allocated?
Ex.
a) You connect, router gives you 192.168.0.2
b) You disconnect
c) Some other PC connects and gives 192.168.0.2
d) You connect again and router gives you 192.168.0.3
Are you talking something like the above situation?
EDIT: Silly me, found out that I can comment on my own answer.

Related

Local Area Network Configuration Question

Comcast installed a Juniper Universal Access Router ACX1100, I plugged our switch to the port that the technician told us that is in/out port. But nothing happened, after reading and asking I was told that I need a managed switch to be configured with the gateway IP and that IP is a /29. That's where I got lost. According to him there are 6 usable IP's.
example:
Gateway: 192.168.120.161/29
Usable Range: 192.168.120.162 - 192.168.120.167
One of my multiple questions is what hardware do I need to be able to connect my PC's?, I configured a managed switch, but when I connect my laptop to it I get Unidentified Network and No Internet Connection.
I have been reading and I think I need a VPN with DHCP server integrated.
If some one can help me I'll appreciate it.
/29 is the subnet mask, it can also be expressed as 255.255.255.248. Basically it defines which part of the IP is the network ID and which part of IP is the host ID.
I think in order to accurate assess your situation, we need to know exactly what kind of configuration you set on the managed switch you purchased, also which managed switch did you purchase?
Also currently on your laptop's NIC, what IP is assigned on there?
Either on your old unmanaged switch or on the managed switch, you can try assigning one of the addresses from the /29 block that the technician told you about statically. And the default-gateway with the addresses you posted in your question.

Basic networking questions

I am trying to understand how exactly routing works:
if 2 computers are on the same network
if they are on different networks.
More specifically I am trying to understand this: Routing
I am also trying to understand the difference between
IP Address,
Net Address,
Mac Address.
From what I understand:
1) IP Address: is used when computers communicate on the internet only.
2) Net Address: is a local version of the IP address and each device on the network has a unique net address. It's used when devices on the same network want to communicate with each other.
3) Mac Address: is a globally unique address and no other computer in the world has the same Mac address. In reality this is not true because it can be changed. It's used when ???
When a computer wants to communicate with another on the same network, they use net address, right? If the computers are on different networks what exactly happens?
Question: Can someone please fix my mistakes if any and explain what I am missing?
Thank you very much.
There are many network types, but since the most used ones are Ethernet and IP networks (and you seem to be asking about them), I will answer shortly based on them.
IP addresses are always used. They may not be used for deciding who gets the packets directly, but they are the basis even in local networks, since it is an IP network. There can also be other network types that have their own mechanisms, but they are not that common.
In local Ethernet the machines ask via ARP protocol "who has this IP address?" and get a reply with a MAC address. After that they send and receive packets based on that MAC address. The packets still have the IP address information, otherwise the receiving machine wouldn't know what is the destination. Do note that the receiving machine might be a firewall or other middleware device, not the actual computer that has the address. Also a single machine and network card may have several IP addresses set up for it.
In IP networks the IP address is used for routing. All routing devices have a routing table that will tell where the packets should go. If it's a simple device, it usually has a local network and everything else goes via a default gw, which will know better what to do with the packets.
A home router will just push them to the operator, there another router will know what addresses go to their networks, others are pushed forward via another connection, until a bigger place is reached where there are inter-operator connections and they choose again the correct route. And then it goes to smaller and smaller pipes the other way around.

IP Address: using program or script

A) The below statement
System.out.println(java.net.Inet4Address.getLocalHost());
shows output as myhostname/192.168.1.25
B) The http://whatismyipaddress.com/ shows below (masked):
14x.7x.2xx.x1x
Using above mentioned technique A (any language or script), how do I get the value 14x.7x.2xx.x1x that above mentioned technique B shows? Or, is it at all possible?
In other words (?), using technique A (as mentioned in original question), how I can I get the same public Ip address of my home router which is shown by technique B? If it is impossible, please explain briefly (two lines at the most) why?
Thanks
Refer to this question:Getting the 'external' IP address in Java
The computer don't know its final public address as it is not necessary for it to know. Local network IP Address is sufficient for it for the tasks. But if you want to get the public address you have to use an external service as mentions in the answers of the linked question.
I will assume that you are at your home and you have a router for connecting your several computers to the internet.
http://whatismyipaddress.com/ will show an IP address as it is visible on the global internet. This may well be the IP address of your in-home router, which exposes one address for your entire in-home network. This is your public IP address.
The script that you show will give you the IP address of your own machine, which is usually only useful on your own local network. This is a private IP address, only accessible from your local network.

Modem 3G - Two different IPs

I just saw something I never have seen before.
I got a new SIM card from Nextel (communication company). I tried to use it on a 3G modem E3131, where I had a successful case before with VIVO (another communication company). Now it is different, instead to have only an external IP, I'm getting two different IPs.
For example:
When I go to some service like whatismyip.com, I see an IP 200.xxx.xxx.xxx, but when I check it out on ipconfig /all, I see another IP 10.xxx.xxx.xxx.
My problem is I can't connect to my app from another computer because there's no port redirection to internal IP. I must connect to some specific ports.
Does anyone know how to fix this problem?
Thanks in advance!

Automatically detect a new computer connected to the network

Is there an elegant way to make a program detect a new computer that is connected to the network?
I would like my program to "auto-sense" a new computer being connected on the network (they're on the same network). Like a USB device being connected to the computer.
What I'm doing now is to save a list of all computers in the network from time to time. Another approach is to PING all available IPs on the subnet.
Are there any other elegant approaches?
Thanks!
Listening for ARP requests is the canonical way to do this. Independent of DHCP or not, any connected computer that wishes to communicate with the outside world will have to make an ARP request for the address of the default router. This request will go out as a broadcast, and contain the source interface's MAC and IP adresses.
If the other computer uses DHCP, it will make an ARP request for it's own address as part of duplicate address detection, which is also a broadcast you can snoop on.
(This works more or less the same way for IPv6, except you need to look for neighbor discovery or router soliciation packets instead.)
Like the answer alluded to, if you have a switch to which you can telnet or use SNMP on, you can extract the MAC table. That will give you a list of MAC adresses on each port in the switch. If you want the IP addresses however, you still need to listen for ARP:s.
On the other hand, if you have access to the default gateway on the network, you can also look at the ARP table there. That will give you MAC and IP addresses for anyone that has recently (for different values of recently...) communicated with it.
If you have a managed switch of some kind, you could probably connect to that, that would be a fairly elegant method.
If you're on a domain, you can can get a list of all the machines joined to the domain from the domain controller.
Failing that, all I can think of is either a challenge/response thing (e.g. pinging them) or by detecting traffic sent from them (see this question maybe as a starting point?), neither of which strike me as an elegant approach.

Resources