Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I try to have a static ip adress on an host.

I execute the following commands :

$ ip address eth0 10.4.1.15 netmask 255.255.255.0

$ route add default gw 10.4.1.5

But later my IP address changes on 10.4.1.241 unless I have commented the request command in dhcplient.conf and I have put into /etc/network/interfaces the following:

iface eth0 inet static
address 10.4.1.14
netmask 255.255.255.0
gateway 10.4.1.5

Please help me I don't understand why my ip changes ?

Thanks in advance.

Narglix

share|improve this question
add comment

1 Answer

/etc/network/interfaces holds your default configuration... so if you need a permanent static IP, put it in there like this:

iface eth0 inet static
address <THE IP YOU WANT>
netmask 255.255.255.0
gateway <THE IP OF YOUR GATEWAY (Usually your router)>

The commands you executed only adjusts your configuration temporarily.

share|improve this answer
    
You also need to remove the line for dhcp, or at least you should. iface eth0 inet dhcp # <== Remove this –  peelman Jul 21 '10 at 21:44
    
I don't see the difference than I have made –  user32433 Jul 22 '10 at 6:46
    
@user32433 - Your IP shouldn't change when that is in your interfaces file. –  BloodPhilia Jul 22 '10 at 14:43
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.