interfaces/static IP problem - Debian
Solution 1
You should add "gateway 192.168.1.1" and change the network entry to "network 192.168.1.0".
Solution 2
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
Related videos on Youtube
elduderino
Javascript, php, html,css, apache, mysql - learning Linux servers
Updated on September 17, 2022Comments
-
elduderino over 1 year
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?
-
Jason Berg almost 14 yearsActually, he can go ahead and get rid of the network statement. It is only required for ancient kernels.
-
elduderino almost 14 yearsHi, 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 almost 14 yearswhoops my bad. Somehow an extra line of text was in the file iface eth0 inet static It works now :) Thanks