Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I seem to be using two IP addresses on my PC. I use DHCP to get an IP address and then I statically set an IP address and activate it. ifconfig says that I am using the address given by DHCP but I am also able to connect to a device on the network of the statically set IP. What is going on here?

DHCP address: 172.16.1.99 Statically set address: 10.1.49.200 OS: Fedora 8

share|improve this question
    
please post the output of ip link show, ip addr show, and netstat -rn. When you connect to the device, what is its address? –  Mike Pennington Jun 20 '11 at 9:12
add comment

1 Answer

up vote 3 down vote accepted

What is the question here?

  • Yes, it sounds like you have two addresses assigned.
  • Yes you can talk to the box using either one of them.
  • If you talk from that box to other machines, it will use the most relevant address, meaning if there is an IP address in the same subnet, it will use that one to talk.
  • One of the addresses, probably the one assigned first, is going to be marked as the default route and the gateway address set will be used to talk to everything outside of either of the two subnets.
  • Assigning an address doesn't remove others. If you want only one address you will need to turn off DHCP acquisition first.
share|improve this answer
    
I was under the impression that a Device could only have one IP address. So what you are saying is a Device can have more than one IP address at the same time? –  toc777 Jun 20 '11 at 12:16
    
@toc777: I don't know what gave you that impression, but it is wrong. Any given network device can have many addresses. I have some routers with dozens of addresses on a single interface. –  Caleb Jun 20 '11 at 12:18
    
For some reason I thought a NIC could only have one IP assigned to it, I guess because the default is one. Normally I'd do some research on a question before asking it but I thought I knew what I was talking about :( –  toc777 Jun 20 '11 at 12:29
    
@toc777 A network interface can have multiple addresses. It's not so common on a desktop or server machine though, it mostly happens on network appliances (routers, firewalls, that kind of stuff). So it might indicate that something is misconfigured. Or maybe you're running a virtual machine with a bridged network interface; if so, one of the addresses goes to the real machine and the other one goes to the VM. –  Gilles Jun 20 '11 at 19:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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