0

I'm trying to find a bug in a program and I was wondering if it is possible to have the same IP twice in a network interface. For example, have network interface eth1 with ip 192.168.56.174 twice. I haven't been able to find any information on the Internet about it, just how to have two different IPs in the same interface, but nothing about the same IP.

5
  • Same ip twice in one interface... Could you explain a bit why you'd like to do that? Jan 14 '20 at 14:04
  • I have a program that reads all interfaces and their information and sends an alert with the information it collects. Now, in one of the computers where it is installed, it is reporting to have the same IP twice in the same interface, so I'm wondering if that's possible or if it is a bug in the program.
    – jesusjimsa
    Jan 14 '20 at 14:08
  • Have you considered checking the config on the said computer instead of asking here? That will easily show you the addresses on the computer and solve the riddle.
    – TomTom
    Jan 14 '20 at 14:14
  • What happens if you go to that computer and list the addresses for that interface? ifconfig interface or, even better ip address list interface. You will know right away where the problem is. Jan 14 '20 at 14:16
  • I don't have access to that computer, but I could reproduce the error in my computer with the answer Stefan gave me. It appears I wasn't considering the mask when reading the IP.
    – jesusjimsa
    Jan 14 '20 at 14:35
3

Check out the netmask !

It is possible to do something like this:

ip addr add 192.168.2.1/25 dev eth1
ip addr add 192.168.2.1/32 dev eth1

This is different addresses in that it will change the network's subnet addresses.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.