# netif restart brings dhcpd down



## romeor (Nov 2, 2011)

Hello, 

I've got now two FreeBSD NAT "routers" with DHCP and BIND, and one with same plus quagga configured on them (running ospf to announce loopbacks and bgp to announce netwroks inside of one AS). On every server there is one common problem: when I issue the command [cmd=]service netif restart[/cmd] my DHCP server stops working too. I mean it is like running, but does not reply to clients requests, I have to restart it to make it work again. Same when the network cable got disconnected. Any ideas, how can I fix this?


----------



## SirDice (Nov 2, 2011)

romeor said:
			
		

> any ideas, how can i fix this?


Restart dhcpd after a netif restart.

The reason this is happening is because the netif script will shutdown the interface(s). Dhcpd then loses it's binding.


----------



## fluca1978 (Nov 2, 2011)

Having a look at the rc scripts should emphasize that the daemon for dhcp is requiring NETWORKING. By the way, dhcpd isn't the client daemon?
Finally, it would be great to have the service command to automatically restart all the services depending on the target service.


----------



## romeor (Nov 2, 2011)

fluca1978 said:
			
		

> Finally, it would be great to have the service command to automatically restart all the services depending on the target service.



+1




> Restart dhcpd after a netif restart


Yes, I do this, if I personally restart the netif (with routing), but, if by some reason my utp cable will be disconnected, how do I know first, that dhcpd isn't serving people any more?  (first mad worker/client not in count).


----------



## SirDice (Nov 2, 2011)

romeor said:
			
		

> yes, i do this, if i personally restart the netif (with routing), but, if by some reason my utp cable will be disconnected, how do i know first, that dhcpd aint serving people anymore?  (first mad worker/client not in count)


That's why applications like net-mgmt/nagios were invented.


----------



## fluca1978 (Nov 3, 2011)

Nagios and other monitoring tools are great to keep an eye on a lot of systems and services, in this case having a simple advice that restarting A requires also restarting B could be great too. Anyway, yes, Nagios (and others) is the right answer right now. Even an nmap on the machine could emphasize something not working...


----------



## romeor (Nov 3, 2011)

You guys must be kidding on me? FreeBSD is a huge and powerful OS. even simplest Linux has no such problem. Installing nagios to monitor only dhcpd on FreeBSD is just an epic overkill.


----------



## nORKy (Nov 3, 2011)

romeor said:
			
		

> you guys must be kidding on me? freebsd is a huge and powerfull OS. even simplest linux has no such problem. installing nagios to monitor only dhcpd on freebsd is just an epic overkill.



SirDice said "Like". You can install others light monitoring service you want.
SirDice means "is a good pratice to monitor services."


----------



## wblock@ (Nov 3, 2011)

romeor said:
			
		

> you guys must be kidding on me? freebsd is a huge and powerfull OS. even simplest linux has no such problem. installing nagios to monitor only dhcpd on freebsd is just an epic overkill.



It probably isn't needed just for that, but often servers have multiple things that need to be monitored.

As far as dhclient exiting when the interface is downed, that's not unreasonable.  It being a problem suggests that you're using netif restart when something else ought to be used.  A disconnected Ethernet cable doesn't down the interface, so shouldn't cause a problem with dhclient anyway.


----------



## Alt (Nov 4, 2011)

romeor said:
			
		

> Any ideas, how can I fix this?


Restarting netif drops some things including routing, so you try to restart like this: 
	
	



```
/etc/rc.d/netif restart && /etc/rc.d/routing restart
```


----------

