Losing Static IP

I know it is very basic question but very confusing for a newby like me. I have installed FreeBSD on a PC and after installation, configured a static IP. Even though the entry is there in rc.conf:

Code:
ifconfig_em0="inet 192.168.0.254 netmask 255.255.255.0"
defaultrouter="192.168.0.1"

but I only see IP on em0 for a few minutes by checking ifconfig. Only during that time when there is the IP entry I can ping other PC on the network but after few minutes, without any error message, it stops pinging other PCs and ifconfig does not show any IP associated to the em0. I have rebooted, manually entered the IP but still having same issue.

Could you please help me?
thanks,
 
could you please post your /etc/rc.conf also look in /var/log/messages to look for unusual error messages to do with adapter em0

Code:
grep em0 /var/log/messages
 
Thank you shitson!
The rc.conf is
Code:
# Created: Fri Jan 27 08:56:38 2012
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
hostname="test-bed.com"
Ifconfig_em0="inet 10.10.10.5 netmask 255.255.255.0"
Defaultrouter="10.10.10.1"
#sshd_enable="YES"
gateway_enable="YES"
inetd_enable="YES"

For your information, the output of ifconfig -a was
Code:
Feb  3 06:46:27 test-bed kernel: em0: <Intel(R) PRO/1000 Network Connection 7.1.9> port 0xecc0-0xecdf mem 0xfe9e0000-0xfe9fffff,
0xfe9db000-0xfe9dbfff irq 21 at device 25.0 on pci0
Feb  3 06:46:27 test-bed kernel: em0: Using an MSI interrupt
Feb  3 06:46:27 test-bed kernel: em0: [FILTER]
Feb  3 06:46:27 test-bed kernel: em0: Ethernet address: 00:23:ae:1c:0c:9a

and after I manually execute following command,
[cmd=]ifconfig em0 inet 10.10.10.5 netmask 255.255.255.0[/cmd]

the output of ifconfig -a was
Code:
Feb  3 06:46:27 test-bed kernel: em0: <Intel(R) PRO/1000 Network Connection 7.1.9> port 0xecc0-0xecdf mem 0xfe9e0000-0xfe9fffff,
0xfe9db000-0xfe9dbfff irq 21 at device 25.0 on pci0
Feb  3 06:46:27 test-bed kernel: em0: Using an MSI interrupt
Feb  3 06:46:27 test-bed kernel: em0: [FILTER]
Feb  3 06:46:27 test-bed kernel: em0: Ethernet address: 00:23:ae:6c:0c:9a
Feb  6 03:46:04 test-bed kernel: em0: link state changed to DOWN
Feb  6 03:46:05 test-bed kernel: em0: link state changed to UP

During this time I was able to ping others but once I rebooted, I lost the connectivity again.
Again thank you for your help.
 
erohal said:
Code:
Feb  6 03:46:04 test-bed kernel: em0: link state changed to DOWN
Feb  6 03:46:05 test-bed kernel: em0: link state changed to UP
This looks like a bad connection. Have you tried a different cable? Different port on the switch?
 
Is there any special reason to use capital "i" on /etc/rc.conf for ifconfig_Xxx?
Code:
Ifconfig_em0="inet 10.10.10.5 netmask 255.255.255.0

What you set on ifconfig_xxx in /etc/rc.conf will be enabled after executing /etc/rc.d/netif restart, but you will need to execute /etc/rc.d/routing restart too.

I personally like using a two-line-setup to avoid alias issues:
Code:
ifconfig_em0="up"
ipv4_addrs_em0="1.2.3.4/24 2.3.4.5/23"
 
Thank you all for the help. It is working now. I think there was an issue with the network card. Again, thanks.
 
Back
Top