Restart Networks

Tom Vilot tom at vilot.com
Wed Mar 30 17:59:04 PST 2005


> > On linux variants, you can run a command like:
> > /etc/init.d/network restart
> > that will restart network serverices ie, reinitialize ifconfig setup, reload
> > IPs for a local NIC.
> > 
> > Does anyone know if there is a similar command or command set in
> > FreeBSD?

You can also try just restarting the interface. On my laptop, for
example, running FreeBSD 5.3, I re-start the ndis based network
interface thusly:

/etc/rc.d/ndis restart

where that script is:

----------------------------------------------------------------------
#!/bin/sh
# By Mario S. 2004

# PROVIDE: ndis
# KEYWORD: FreeBSD

. /etc/rc.subr

name="ndis"
start_precmd=""
stop_precmd=""
start_cmd="ndis_yastart"
stop_cmd="ndis_yastop"


ndis_yastart()
{
echo "Starting NDIS network driver: "
sysctl dev.ndis.0.SSID="myssid"
ifconfig ndis0 192.168.1.234
route add default 192.168.1.1
echo "Done"
}

ndis_yastop()
{
ifconfig ndis0 down
kldunload if_ndis
killall dhclient
}

load_rc_config $name
run_rc_command "$1"
----------------------------------------------------------------------


More information about the freebsd-questions mailing list