LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-17-2015, 04:04 PM   #1
agooodname
LQ Newbie
 
Registered: Jun 2013
Location: Chicago IL USA
Distribution: debian
Posts: 23

Rep: Reputation: Disabled
Question Static IP Config Problems Debian


I have a headless Debian server running --- and i'm attempting to give it the static ip 192.168.1.74. Unfortunately, after I changed the setting on my router my server couldn't connect to my network. Pinging my gateway gave the error "Network is unreachable" and the command wouldn't even run. Eventually i realized that i needed to change the file at /etc/network/interfaces from
Code:
  auto eth0
    allow-hotplug eth0
    iface eth0 inet dhcp
to
Code:
   auto eth0
    iface eth0 inet static
        address 192.168.1.74
        netmask 255.255.255.0
        gateway 192.168.1.254
Now when I try to ping my gateway the command starts but after each ping attempt it says "destination host unreachable" with a 100% packet loss rate. I have no way of copying the actual text on the screen so i'm just paraphrasing the output of the ping command. Does anyone know what im not doing or doing wrong that's causing this connection issue? thanks
 
Old 05-17-2015, 04:12 PM   #2
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
You need to create an /etc/resolv.conf -- the dhcp server would do this for you but you don't have that now.
Code:
su -
cat > /etc/resolv.conf << "EOF"
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
This version uses Google's DNS -- there are others you could use:
https://wiki.archlinux.org/index.php...ve_DNS_servers

EDIT: Actually, I didn't read your post carefully enough -- what is the exact `ping` command you are trying to use?

What is the output of:
Code:
ip r

Last edited by Head_on_a_Stick; 05-17-2015 at 04:22 PM.
 
Old 05-17-2015, 05:23 PM   #3
agooodname
LQ Newbie
 
Registered: Jun 2013
Location: Chicago IL USA
Distribution: debian
Posts: 23

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Head_on_a_Stick View Post
You need to create an /etc/resolv.conf -- the dhcp server would do this for you but you don't have that now.
Code:
su -
cat > /etc/resolv.conf << "EOF"
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
This version uses Google's DNS -- there are others you could use:
https://wiki.archlinux.org/index.php...ve_DNS_servers

EDIT: Actually, I didn't read your post carefully enough -- what is the exact `ping` command you are trying to use?

What is the output of:
Code:
ip r
I tried your first solution but it seems there was no effect.

ip r is
Code:
default via 192.168.1.254 dev eth0
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.74
the ping command was
Code:
ping 192.168.1.254
thanks for your help
 
Old 05-17-2015, 05:26 PM   #4
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
Quote:
Originally Posted by agooodname View Post
the ping command was
Code:
ping 192.168.1.254
Are you sure this is the correct IP for your router?

I'll be AFK for ~8 hours.
 
Old 05-17-2015, 05:54 PM   #5
agooodname
LQ Newbie
 
Registered: Jun 2013
Location: Chicago IL USA
Distribution: debian
Posts: 23

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Head_on_a_Stick View Post
Are you sure this is the correct IP for your router?

I'll be AFK for ~8 hours.
Yep, I just brought up the routers page in my browser using it just now.
 
Old 05-17-2015, 07:52 PM   #6
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Please post the output of
Code:
sudo ifconfig
To speed up things while waiting for an answer here, enter:
Code:
ifconfig eth0 192.168.1.74 up
and report if you see any error messages.
If there are no error messages, do again:
Code:
sudo ifconfig
If you see a different eth in the output of ifconfig, configure that one as well in /etc/networking/interfaces. Or start with
Code:
ifconfig ethx 192.168.1.74 up
where 'x' is teh number of the eth which was listed in ifconfig.

jlinkels
 
Old 05-18-2015, 02:23 AM   #7
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
Quote:
Originally Posted by agooodname View Post
after I changed the setting on my router my server couldn't connect to my network.
Which settings did you change exactly?

I can switch from dhcp to static IPs without touching my router.

Does resetting the router back to the original values fix things?

I don't have any experience of running a server so apologies if I'm missing something obvious here.
 
Old 05-18-2015, 04:47 PM   #8
agooodname
LQ Newbie
 
Registered: Jun 2013
Location: Chicago IL USA
Distribution: debian
Posts: 23

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jlinkels View Post
Please post the output of
Code:
sudo ifconfig
To speed up things while waiting for an answer here, enter:
Code:
ifconfig eth0 192.168.1.74 up
and report if you see any error messages.
If there are no error messages, do again:
Code:
sudo ifconfig
If you see a different eth in the output of ifconfig, configure that one as well in /etc/networking/interfaces. Or start with where 'x' is teh number of the eth which was listed in ifconfig.

jlinkels
i couldnt find a way to copy the text so i hope this is fine
first ifconfig command
http://i592.photobucket.com/albums/t...pstk1lwz1l.jpg

if config eth0 192.168.1.74 up command
http://i592.photobucket.com/albums/t...pss0vkqu2p.jpg
i hope that helps, sorry for the glare. as you can see nothing visible happened after the
Code:
ifconfig eth0 192.168.1.74 up
command "eth" didnt change from eth0. thanks again for your help.
 
Old 05-18-2015, 05:09 PM   #9
agooodname
LQ Newbie
 
Registered: Jun 2013
Location: Chicago IL USA
Distribution: debian
Posts: 23

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Head_on_a_Stick View Post
Which settings did you change exactly?

I can switch from dhcp to static IPs without touching my router.

Does resetting the router back to the original values fix things?

I don't have any experience of running a server so apologies if I'm missing something obvious here.
on my router there is an ip address allocation section, and under my servers name there is a drop down menu where you can select 3 options:
"private fixed ip" (what i changed it to, 192.168.1.74)
"private from a pool of 192.168.1.0" (what i had before)
"public (select WAN IP routing)"
reverting it back doesn't fix the connection issues, thanks for the help.
 
Old 05-18-2015, 05:13 PM   #10
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
Quote:
Originally Posted by agooodname View Post
i couldnt find a way to copy the text
Code:
sudo ifconfig > ifconfig.txt
Will redirect the output to a text file called "ifconfig.txt"

Or you could use:
Code:
# apt-get install pastebinit
sudo ifconfig | pastebinit
To generate a link to a pastebin client.
 
Old 05-18-2015, 05:25 PM   #11
agooodname
LQ Newbie
 
Registered: Jun 2013
Location: Chicago IL USA
Distribution: debian
Posts: 23

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Head_on_a_Stick View Post
Code:
sudo ifconfig > ifconfig.txt
Will redirect the output to a text file called "ifconfig.txt"
thank you this is very useful. Will the pictures work or should I go back and use this command, do you think?
 
Old 05-18-2015, 05:30 PM   #12
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
Quote:
Originally Posted by agooodname View Post
should I go back and use this command, do you think?
I think jlinkels would appreciate not having to click on an external link (and s/he may be bandwidth-restricted)
 
Old 05-18-2015, 05:51 PM   #13
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by agooodname View Post
i hope that helps, sorry for the glare. as you can see nothing visible happened after the
Code:
ifconfig eth0 192.168.1.74 up
command "eth" didnt change from eth0. thanks again for your help.
That is fine.

Your eth0 seems to be up and running. There are even packets received and transmitted.

I am starting to doubt that this host is not correctly configured. Do you have any other hosts on that subnet that you can ping? Anything with an IP address in the range 192.168.1.x will do.

Not sure that it is mandatory, but you could add this to the eth0 stanza in /etc/network/interfaces:
Code:
network 192.168.1.0
broadcast 192.168.1.255
On your router there is a DHCP "pool". That is a range of addresses which is given to DHCP clients. Is 192.168.1.74 within that range? It should not. If it is, change the static IP of your host to something outside that range. If you have to, decrease the size of the range.

There must also be a list inside your router wich shows so-called active leases. It should not show 192.168.1.74.

I have seen very, very rare occasions where the network would not come up after a change from DHCP to static, only after rebooting. I hate to ask this, but did you try to reboot?

jlinkels

Last edited by jlinkels; 05-18-2015 at 05:54 PM.
 
Old 05-19-2015, 05:11 PM   #14
agooodname
LQ Newbie
 
Registered: Jun 2013
Location: Chicago IL USA
Distribution: debian
Posts: 23

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jlinkels View Post
That is fine.

Your eth0 seems to be up and running. There are even packets received and transmitted.

I am starting to doubt that this host is not correctly configured. Do you have any other hosts on that subnet that you can ping? Anything with an IP address in the range 192.168.1.x will do.

Not sure that it is mandatory, but you could add this to the eth0 stanza in /etc/network/interfaces:
Code:
network 192.168.1.0
broadcast 192.168.1.255
On your router there is a DHCP "pool". That is a range of addresses which is given to DHCP clients. Is 192.168.1.74 within that range? It should not. If it is, change the static IP of your host to something outside that range. If you have to, decrease the size of the range.

There must also be a list inside your router wich shows so-called active leases. It should not show 192.168.1.74.

I have seen very, very rare occasions where the network would not come up after a change from DHCP to static, only after rebooting. I hate to ask this, but did you try to reboot?

jlinkels
I tried to ping my laptop (which I am using now) and im getting the same destination host unreachable error.
I added the two lines but that hasn't changed anything
I also checked the range on my router and it can go from 192.168.1.64 to 192.168.1.253 but just to be sure i changed my router and my config file to 192.168.1.63 but that did work either.
and no rebooting dosent fix the problem, im afraid nothing is working, thanks for the help regardless.
 
Old 05-19-2015, 06:43 PM   #15
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by agooodname View Post
I also checked the range on my router and it can go from 192.168.1.64 to 192.168.1.253 but just to be sure i changed my router and my config file to 192.168.1.63 but that did work either.
This is unclear.
What are the current settings?
I recommend to set the router DHCP range to x.x.1.100 from x.x.1.150. That will be enough. Reboot the router and see what you get.

jlinkels
 
  


Reply

Tags
connection, debian, ip, problem, static


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Samba 3.2.5 config problems using Debian defaults mac101 Linux - Server 1 08-30-2009 07:45 AM
Static LAN (wired and WiFi) IP in Debian setup problems. CloudyWizzard Debian 15 03-29-2009 02:07 AM
How do I config static routes? mikezang Linux - Networking 4 10-31-2005 10:29 AM
how to config. network settings for having a static ip with a router kkeith Linux - Newbie 2 10-19-2005 05:00 AM
Static IP Config in SuSE ChineseElite Linux - Networking 6 01-12-2003 10:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration