Setup of Router machine with FreeBSD

nvidican at nvidican at
Mon Jan 11 15:44:43 UTC 2010

Quoting Paul Shi <shihang at>:

> Dear All,
> I have tried to setup a wireless network consist of a server, AP, a router
> machine and wireless client. Here is setup and configuration of my design.
> Please correct me if I am wrong about anything.
> Server
> IP:, Gateway:, Netmask:
> ---------------------------------------------------------------------------------------------
> IP:,                                   Netmask:
> Router
> IP:,                                   Netmask:
> ---------------------------------------------------------------------------------------------
> IP:, Gateway:, Netmask:
> Access Point
> ---------------------------------------------------------------------------------------------
> IP:,                                  Netmask:
> Client
> I have add following to /etc/rc.conf of server machine
> static_routes="serverinternal"
> routes_serverinternal="'-net"
> and following to /etc/rc.conf of router machine
> static_routes="internal"
> routes_internal="'-net"
> Is there anything I have done wrong? Or anything else I need to do. My
> problem now is I cannot connect from server to router machine. Any
> suggestion would be greatly appreciated!
> Your sincerely,
> Paul Shi
> Electronic and Communication Engineering Senior
> Department of Electrical and Electronic Engineering
> University of Hong Kong
> _______________________________________________
> freebsd-questions at mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at"


It seems to me your problem is in your route configuration.  
"" is incorrect, /24 indicates the bitmask; the network  
address should be correctly written as "" instead  
indicating a network address of '' with a network of 254  
usable IP addresses in the same subnet.

You'll thus only have to have ONE route entry for the whole network,  
not one per IP (unless that is your intention -in which case the  
'-net' syntax is incorrectly being used). So long as routing is turned  
on (man sysctl), simply pointing the server to the router and the  
client to the router to connect to each other should work. Try doing  
the commands from the console first to get it all working, then worry  
about putting in the startup configs on boot-up.

Given your example, I'd login to 'server' and run:

route add
(if the router is the ONLY router from the server, use this instead):
route add

Then, from the client, add:
route add

The gateway/router box itself does not need any routing setup  
internally; you don't need/shouldn't be setting any routes given that, and are hosts on the two networks for which  
you want to allow routes. They key is in getting the clients to both  
use the same gateway, (as accessible from the network they are  
respectfully on). This may be a little more clearly depicted below:

Host A ( <--> Router ( ( <--> Host  
B (

Host A:
   - needs to know to use '' as it's gateway to
   - may just use as it's default gateway to ANY network

Host B:
   - needs to know to use '' as it's gateway to
   - similarly, may just use '' as it's default gateway to  
ANY as well

Assuming you're connecting the internet at some point to the gateway  
(router) machine, a decent firewall filter and NAT will most likely be  
required as well. Read up in the handbook a bit on the subject or feel  
free to come back for more info if needed.

Hope this helps.

Nathan Vidican
nathan at

More information about the freebsd-questions mailing list