DHCP to static IP failure

My experience is similar to another user's post : I installed FreeBSD 9.0 using DHCP, then tried to switch to a static IP address witout success.

In rc.conf I commented out the
Code:
ifconfig_dc0="DHCP"
line and added
Code:
ifconfig_dc0="inet a.b.c.d netmask 255,255,255,0"
and
Code:
defaultrouter="e.f.g.h"
The DNS servers are the same for DHCP and static IP addresses, so resolv.conf was unchanged.

After the changes, pinging the default gateway reults in "Host is down". Using the same cable and a windows machine and the static address and gateway, one can successfully ping the gateway and access the internet. Using the dynamically assigned address in freeBSD, the gateway does respond to pings.

I also used # sysinstallto change to the static address and got no better results.

One additional, possibly irrelevant fact: When I first tried the change to static IP, the gateway was actually down, couldn't be pinged from any machine.

I have used FreeBSD since verion 3.something, and this is the first time I have had such a perplexing problem. I'm hoping for enlightenment.

Thanks.
 
The netmask should be written with dots,

Code:
ifconfig_dc0="inet a.b.c.d netmask 255.255.255.0"

You can also write the address in CIDR notation,

Code:
ifconfig_dc0="inet a.b.c.d/24"
 
A clarification

kpa said: "The netmask should be written with dots".

It was. The code I posted was just typed in, not pasted, too hastily. In not using CIDR notation, I was just mimicking what sysinstall does when setting up the dc0 interface.

Here's what $ [b]netstat -rn[/b] has to say:

Code:
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            10.10.5.1          UGS         0       84    dc0
127.0.0.1          link#4             UH          0       55    lo0
10.10.5.0/24       link#2             U           0        2    dc0
10.10.5.232        link#2             UHS         0        5    lo0
with Internet6 stuff omitted. And here is rc.conf:

Code:
hostname="x.y.z"
ifconfig_dc0="inet 10.10.5.232 netmask 255.255.255.0"
defaultrouter="10.10.5.1"
#ifconfig_dc0="DHCP"
sshd_enable="YES"
moused_enable="YES"
ntpd_enable="NO"
powerd_enable="NO"

I hope this clarifies my earlier post. (The set-up given makes the gateway un-pingable, Host is down; enabling DHCP and commenting out the appropriate lines makes the internet reachable.)

Thanks.
 
Ping the IP address of the gateway. Not the hostname.

I'm guessing internet isn't "working" because /etc/resolv.conf doesn't contain any DNS servers.
 
SirDice said: "Ping the IP address of the gateway. Not the hostname.
I'm guessing internet isn't "working" because /etc/resolv.conf doesn't contain any DNS servers."

Pinging the IP address (I don't even know its hostname) of the gateway produces "Host is down". It's not down; using DHCP or another computer shows that it is responding to pings properly.

Here is /etc/resolv.conf:

Code:
# Generated by resolvconf
search xxx.yyy
nameserver 10.1.1.60
nameserver 10.1.1.61

The search argument is the appropriate one for my daomain and the nameserver addresses are the same whether DHCP is used or not, I am told. Fearing an incompatibilty between my public IP address and private addresses of the nameservers, I tried google's 8.8.8.8, but the gateway was still "down".

Just as a matter of curiosity: I gathered that the gateway should be pingable even without nameservers, since it is on the same subnet as defined by the netmask 255.255.255.0. Was I incorrect?

Thanks
 
freepara said:
Just as a matter of curiosity: I gathered that the gateway should be pingable even without nameservers, since it is on the same subnet as defined by the netmask 255.255.255.0. Was I incorrect?

Thanks

Are you sure it's on the same subnet? What subnet mask does the gateway have?
(Or IOW, what mask do you get when you use DHCP?)
 
When I use DHCP, I get a private IP address for the gateway, 10.1.10.1, and my compter's private address is 10.1.10.14, and all is well. When I try to use my public address x.y.z.232, my netmask is 255.255.255.0 and the gateway is x.y.z.1 (x, y, and z being in the range 1-254). I don't know what the netmask of x.y.z.1 is, nor do I know that 10.1.10.1 maps to x.y.x.1. I do know that 10.1.10.1 doesn't work as a gateway for x.y.z.232 (nor, I guess, should it.)
 
There's a router in front of your network that's already doing NAT. This means you can't use the external IP address internally.
 
The systems guy was just in and a quick reconfiguration of the port made all well. Not a FreeBSD problem at all, though it took a lot of trying to get to the point where they listened to me seriously.

The base problem was that I was away for two months, during which time a) the motherboard on the computer in question failed, and b) they made some changes to port configuations in my office suite. If the mobo hadn't failed, it would have been clear that that their reconfiguration was at fault. With the two happenning in tandem, it was unclear where the problem was.

My most profound thanks to SirDice, jalla, and kpa for taking teh time and having the patience to help out.
 
Back
Top