Quoting Paul Shi <shihang at hkusua.hku.hk>:
> 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: 192.168.2.1, Gateway: 192.168.2.2, Netmask: 255.255.255.0
> ---------------------------------------------------------------------------------------------
> IP: 192.168.2.2, Netmask: 255.255.255.0
> Router
> IP: 192.168.1.1, Netmask: 255.255.255.0
> ---------------------------------------------------------------------------------------------
> IP:192.168.1.2, Gateway: 192.168.1.1, Netmask: 255.255.255.0
> Access Point
> ---------------------------------------------------------------------------------------------
> IP: 192.168.1.3, Netmask: 255.255.255.0
> Client
>> I have add following to /etc/rc.conf of server machine
>> static_routes="serverinternal"
> routes_serverinternal="'-net 192.168.2.1/24 192.168.2.2"
>> and following to /etc/rc.conf of router machine
>> static_routes="internal"
> routes_internal="'-net 192.168.2.2/24 192.168.1.1"
>> 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 freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-questions> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>
Paul,
It seems to me your problem is in your route configuration.
"192.168.2.1/24" is incorrect, /24 indicates the bitmask; the network
address should be correctly written as "192.168.2.0/24" instead
indicating a network address of '192.168.2.0' 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 192.168.1.0/24 192.168.2.2
(if the router is the ONLY router from the server, use this instead):
route add 0.0.0.0 192.168.2.2
Then, from the client, add:
route add 192.168.2.0/24 192.168.1.1
The gateway/router box itself does not need any routing setup
internally; you don't need/shouldn't be setting any routes given that
192.168.2.2, and 192.168.1.2 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 (192.168.2.1) <--> Router (192.168.2.2) (192.168.1.1) <--> Host
B (192.168.1.3)
Host A:
- needs to know to use '192.168.2.2' as it's gateway to 192.168.1.0/24
- may just use 192.168.2.2 as it's default gateway to ANY network
Host B:
- needs to know to use '192.168.1.1' as it's gateway to 192.168.2.0/24
- similarly, may just use '192.168.1.1' 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 vidican.com