LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-23-2009, 08:24 PM   #1
robogymnast
Member
 
Registered: Dec 2005
Location: Boston, USA
Distribution: Kubuntu, Debian
Posts: 78

Rep: Reputation: 16
cannot ping outside network after switching from dhcp to static ip


I have a debian box running as a simple server at home and I want to give it a static ip address, I can't seem to find any simple guides on how exactly to accomplish this. So far I have modified the /etc/network/interfaces from:
Code:
iface eth0 inet dhcp
auto eth0
to:
Code:
iface eth0 inet static
address 192.168.1.50
netmask 255.255.255.0
#network 192.168.1.0
gateway 98.229.96.1
and here are the new results of ifconfig:
Code:
chris@debian:~$ sudo ifconfig
eth0      Link encap:Ethernet  HWaddr 00:07:95:31:90:37
          inet addr:192.168.1.50  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::207:95ff:fe31:9037/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1276 errors:0 dropped:0 overruns:0 frame:0
          TX packets:528 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:118934 (116.1 KiB)  TX bytes:66310 (64.7 KiB)
          Interrupt:5 Base address:0xcc00

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)
The result:
Code:
chris@debian:~$ ping google.com
ping: unknown host google.com
chris@debian:~$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=3.04 ms
This was working when it was using DHCP. Sorry if this is a simple fix but I have looked all over and can't figure out what the problem is.
 
Old 06-23-2009, 09:03 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Check your resolve.conf file?

This is where nameservers are configured. DHCP was probably setting up this on its own, but with a static IP, you will need to configure your own nameserver addresses in /etc/resolve.conf.

Hopefully this applies to Debian -- I don't use it, but the scenario does seem pretty common, and distro-independant.

Sasha
 
Old 06-23-2009, 09:26 PM   #3
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 71
How come your default gateway is not in the same subnet as your IP?
 
Old 06-23-2009, 10:47 PM   #4
Okieman46
LQ Newbie
 
Registered: Sep 2006
Location: Oklahoma
Distribution: openSUSE Tumbleweed
Posts: 14

Rep: Reputation: 1
Looks like to me your default gateway should be 192.169.1.x Since the default gateway is a real ip address (98.229.96.1) your machine which is using a private ip address will not be able to talk to or through the default gateway.
 
Old 06-24-2009, 03:21 PM   #5
robogymnast
Member
 
Registered: Dec 2005
Location: Boston, USA
Distribution: Kubuntu, Debian
Posts: 78

Original Poster
Rep: Reputation: 16
Editing the resolv.conf file did it, thanks for your help!
 
  


Reply



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
easy switching between dhcp and static powadha Linux - Laptop and Netbook 3 12-20-2005 10:58 AM
Help switching from Static IP to DHCP on Redhat Linux 9 asilentmurmur Linux - Networking 8 08-16-2005 08:08 PM
switching from dhcp to static lost internet basq3 Linux - Networking 8 03-29-2005 09:44 AM
eth0 can't get IP with DHCP, static config. attempts can't ping pdt677 Linux - Networking 6 03-06-2005 09:53 PM
Switching from DHCP to static IP class-a Linux - Networking 0 09-19-2001 03:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:58 PM.

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