# can't set defaultrouter via rc.conf



## algould (Apr 25, 2011)

I'm running FreeBSD 7.4 RELEASE with an atheros wireless PCI card.

I'm trying to setup a static IP connection using WPA2 to a home router.  (I've configured the router to pass certain services through to this computer.) Everything works fine except I have to manually enter the default gateway after the computer boots up:
`# route add default 192.168.1.254`

Here are the relevant parts of rc.conf:

```
hostname="myhost.mydomain.org"
  ifconfig_ath0="WPA inet 192.168.1.3 netmask 255.255.255.0"
  wpa_supplicant_flags="-B -iath0 -c/etc/wpa_supplicant.conf"
  defaultrouter="192.168.1.254"
```

I've also tried with the defaultrouter line above the ifconfig line.

Here's the contents of wpa_supplicant.conf, although that part seems to work right:

```
network={
	ssid="2WIRE923"
	key_mgmt=WPA-PSK
	psk="0123456789"
  }
```

How can I change my configuration so that the default gateway is set automatically?

Thanks,

Andrew


----------



## wblock@ (Apr 25, 2011)

algould said:
			
		

> I'm running FreeBSD 7.4 RELEASE with an atheros wireless PCI card.
> 
> I'm trying to setup a static IP connection using WPA2 to a home router.  (I've configured the router to pass certain services through to this computer.) Everything works fine except I have to manually enter the default gateway after the computer boots up:
> 
> ...



That should be defaultroute*r* with an R.  Should not need the wpa_supplicant_flags at all, either.


----------



## algould (Apr 25, 2011)

Thanks.  I'll make that correction when I get home.


----------



## gordon@ (Apr 26, 2011)

I would also recommend that you use the router's feature to do a DHCP reservation instead of statically hardcoding everything. It's pretty easy to do and will allow you to port forward.


----------

