# Rc.conf setting are lost after netif restart



## lavi0007 (Sep 22, 2012)

Hello,

I've installed freebsd on virtualbox. I configured the network settings and default route on it. But after I do a machine restart or I just restart */etc/rc.d/netif restart*. The default route and ip address assigned to the interface gets erased. Please help, what could be causing this.


----------



## wblock@ (Sep 22, 2012)

Have you removed the install CD image so the VM doesn't boot from that every time?
Please show the exact changes you made, and to which file.
Is the VM disk image set to be immutable?


----------



## lavi0007 (Sep 22, 2012)

wblock@ said:
			
		

> Have you removed the install CD image so the VM doesn't boot from that every time?
> Please show the exact changes you made, and to which file.
> Is the VM disk image set to be immutable?



Hi,

So I'm booting from harddisk, rest of the other settings are saved
I assign IP:


```
ifconfig em0 192.168.1.10/24
route add default 192.168.1.1
```

When I do /etc/rc.d/netif restart, all the settings are gone....


----------



## lavi0007 (Sep 22, 2012)

I also tried to add entry under /etc/rc.conf


```
ifconfig_em0="inet 192.168.1.10 netmask 255.255.255.0"
### Default gateway ###
defaultrouter="192.168.1.10"
```

but same result once I execute */etc/rc.d/netif restart* setting is gone.


----------



## wblock@ (Sep 22, 2012)

It would help to see the rest of /etc/rc.conf.  My guess is that you have a DHCP entry after the static IP entries.


----------



## lavi0007 (Sep 22, 2012)

Hi, Please mark this post as solved. The issue is resolved, I restarted the system again it started working...


----------



## SirDice (Sep 24, 2012)

/etc/rc.d/netif only restarts the interface. In doing so it will remove the default gateway. You need to restart /etc/rc.d/routing too.


----------

