You are not logged in.

#1 2011-06-26 05:10:07

ridley
Member
Registered: 2004-03-05
Posts: 19

No DNS with static IP after netcfg update [Solved]

If I set my rc.conf for dhcp, everything is fine, but when I set:

interface=eth0
address=192.168.1.99
netmask=255.255.255.0
gateway=192.168.1.1

a ping returns "unknown host" but I can ping ip addresses. That is why I think it is a DNS issue

Here is the output of ifconfig:

eth0      Link encap:Ethernet  HWaddr 00:22:68:6F:B2:AE  
          inet addr:192.168.1.99  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::222:68ff:fe6f:b2ae/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:101204 errors:0 dropped:0 overruns:0 frame:0
          TX packets:164710 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9859747 (9.4 Mb)  TX bytes:154477141 (147.3 Mb)
          Interrupt:40 Base address:0x6000 

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:2990 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2990 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:239124 (233.5 Kb)  TX bytes:239124 (233.5 Kb)

Any help is appreciated. I'll post my whole Networking section below in case it is relevant.







# -----------------------------------------------------------------------
# NETWORKING
# -----------------------------------------------------------------------
#
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
#
HOSTNAME="server"

# Use 'ip addr' or 'ls /sys/class/net/' to see all available interfaces.
#
# Wired network setup
#   - interface: name of device (required)
#   - address: IP address (leave blank for DHCP)
#   - netmask: subnet mask (ignored for DHCP)
#   - gateway: default route (ignored for DHCP)
# 
# Static IP example
# interface=eth0
# address=192.168.0.2
# netmask=255.255.255.0
# gateway=192.168.0.1
#
# DHCP example
# interface=eth0
# address=
# netmask=
# gateway=

interface=eth0
address=192.168.1.99
netmask=255.255.255.0
gateway=192.168.1.1

# Setting this to "yes" will skip network shutdown.
# This is required if your root device is on NFS.
NETWORK_PERSIST="no"

# Enable these netcfg profiles at boot-up. These are useful if you happen to
# need more advanced network features than the simple network service
# supports, such as multiple network configurations (ie, laptop users)
#   - set to 'menu' to present a menu during boot-up (dialog package required)
#   - prefix an entry with a ! to disable it
#
# Network profiles are found in /etc/network.d
#
# This requires the netcfg package
#
#NETWORKS=(main)

Last edited by ridley (2011-06-26 22:42:40)


this space for rent

Offline

#2 2011-06-26 07:19:34

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,680

Re: No DNS with static IP after netcfg update [Solved]

Look in /etc/resolv.conf

Offline

#3 2011-06-26 16:09:59

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: No DNS with static IP after netcfg update [Solved]

Perhaps you must set the DHCP in /etc/rc.conf as recommended with only the device ..."eth0" entered.

Then set the DNS in resolv.conf.  Mebbe?


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#4 2011-06-26 17:48:03

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: No DNS with static IP after netcfg update [Solved]

Working as intended. When you set a static IP, you no longer get nameservers from your DHCP server through dhcpcd hooks.

Offline

#5 2011-06-26 17:59:29

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,693

Re: No DNS with static IP after netcfg update [Solved]

The jest of what falconindy and skunktrader have posted is that it is up to you to put a nameserver line in /etc/resolv.conf since dhcpcd is not being invoked and won't do it for you.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#6 2011-06-26 22:41:53

ridley
Member
Registered: 2004-03-05
Posts: 19

Re: No DNS with static IP after netcfg update [Solved]

ewaller wrote:

The jest of what falconindy and skunktrader have posted is that it is up to you to put a nameserver line in /etc/resolv.conf since dhcpcd is not being invoked and won't do it for you.

Thanks ewaller, falconindy, lilsirecho, and skunktrader!
I put my router's IP address as my nameserver in resolv.conf and that did it smile

I assume net-tools used to get that from the "gateway" line - iproute2 doesn't do that? Seems like an important feature to me...

Thanks again!


this space for rent

Offline

#7 2011-06-26 23:13:15

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: No DNS with static IP after netcfg update [Solved]

Neither net-tools nor iproute2 touch /etc/resolv.conf. Your dhcp client was updating that file for you. There's no loss of functionality here, just a lack of understanding.

Offline

#8 2011-06-27 00:48:35

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: No DNS with static IP after netcfg update [Solved]

ewaller.

Nice to see the support you provide.

Might I suggest that the word "jest" should really be "gist" in your posts.

Have a good night.


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#9 2011-06-27 02:26:05

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,693

Re: No DNS with static IP after netcfg update [Solved]

lilsirecho wrote:

ewaller.

Nice to see the support you provide.

Might I suggest that the word "jest" should really be "gist" in your posts.

Have a good night.

You are correct yikes
I should know better.  What's worse is that it looked wrong, but I hit Submit anyway.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB