Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to configure my Debian machine (Lenny) to use a static ip address. Here's what my interfaces file currently looks like:

# This file describes the network interfaces available on your system.
# and how to activate them. For more information, see interfaces

#The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.200
network 192.168.1.1
netmask 255.255.255.0

Here's what I've done. I went in to my router settings and changed it's dynamic ip range to 192.168.1.2 to 192.168.1.100. So I could use anything above 100 as my static address. Then I came in to the interfaces file and edited to what you see above. I set the address to be 192.168.1.200 because that's out of the range that's reserved for dynamic addresses by my router and I also set the network to 192.168.1.1 because that's the ip address of my router.

I'm not sure what i'm getting wrong but I have no connection to the internet. I'm not sure i've got the right IP addresses.

Any ideas?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

You should add "gateway 192.168.1.1" and change the network entry to "network 192.168.1.0".

share|improve this answer
    
Actually, he can go ahead and get rid of the network statement. It is only required for ancient kernels. –  Jason Berg Jul 24 '10 at 18:38
    
Hi, Thanks for the reply. I've done what you suggested. restarted the machine and noticed that on startup there was a message saying: configuring network interfaces..../etc/network/interfaces:11: duplicate interfaces Ifup: Couldn't read interfaces file "/etc/network/interfaces" So i went in to the network dirctory did a ls -a and there was a file called interfaces~ with exactly the same content. I removed it and re-booted but still have this message on startup. Double checked and there's only one interfaces file with the correct text in it. Any ideas? –  elduderino Jul 24 '10 at 18:57
    
whoops my bad. Somehow an extra line of text was in the file iface eth0 inet static It works now :) Thanks –  elduderino Jul 24 '10 at 19:15

Add the below configuration also.

Open /etc/resolv.conf. In it use the nameserver directive to specify your name server(s). The nameserver directive(s) will be searched in the order entered here. Here is an example: nameserver 192.168.1.2 nameserver 192.168.1.3

share|improve this answer

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.