Trying to connect networks and local servers through routing

I'm trying to connect LAN networks to servers. When I ran ftpd from the same IP range connecting it to a network for other devices, I could access them from these devices. But when, I put ftpd on a different range, I couldn't route them, despite following the instructions.

Installed net/dhcpd, and edited /usr/local/etc/dhcpd.conf
Code:
option subnet-mask 255.255.255.224;
default-lease-time 600;
max-lease-time 7200

subnet 172.16.1.3 netmask 255.255.255.254 {
    range 172.16.1.3 172.0.1.29;
    option broadcast-address 10.0.0.255;
}
# this is so my devices like phones can automatically connect
172.16.1.1 was left off, because this is the static IP address of the hostap on wlan0 connection. For some reason, 172.16.1.2 didn't work with dhcpd. IP's of 172.16.1.30 and 172.16.0.1 are also set as static in /etc/hosts and /etc/rc.conf.
I didn't add the IP's from my computer to my ISP router in dhcpd.conf, because that's taken care of. It seems that this is for devices which don't have DHCPd to the devices/phones.

For the wifi and ftp server/etc/rc.conf:
Code:
create_args_wlan0="wlanmode hostap"
ifconfig_wlan0="inet 172.16.0.x/8 ssid ..."
ifconfig_wlan0_alias="inet 172.16.1.1/12"
ftpd_enable="YES"
ftpd_flags="-A -D -l -a 172.16.1.1"

Tried adding a route from the ftp server at 172.16.0.1, to 172.16.1.3. /etc/rc.conf:
Code:
static_routes="ftp2devices"
route_ftp2devices="-net 172.16.0.1 172.16.1.3"
This, and varying combinations hasn't worked for me.

When I put the ftp server, wlan inet, and dhcp address on the same IP block, I can access ftp from my device. However, I need to learn how to route, by putting the ftp server on a different IP range. I'll need to route from behind by computer, to the Internet. I've done a bridge from FreeBSD allowing it to work as a wifi access point, using IP's from my ISP modem, though I haven't been able to bridge the ftp server to anything else. dhcpd allowed me to use my devices to access the ftp server on my computer without bridging, when before, I couldn't do that.

Other issues, which isn't as important, as functionality of the above is needed first. One is that I can't use what I set in /etc/hosts and /etc/networks from my phone to access the ftp server, when it is on the same IP range as the ftp server, however, it can be used from command-line. The other issue is, when I set the namespace of the IP range starting in 172 or anything else from /etc/networks, it doesn't show up in netstat -i4. It only works when I set in the first digits of the IP range starting in 10 to match the network.

In /etc/networks, the following don't work (dont' show up in netstat -i4):
Code:
private 172
private 172.16
private 172.16.0 # or any other number
Except only private 10, works for the 10.0.0.0 IP block. Though, no other combination seems to work, including private 10.0. For basic use from the computer, the naming in hosts works. Maybe, it depends on what I set my wlan0 to? Can I set multiple wlan's for multiple hostap access points?

As for DNS, I rather use hosts, and networks, with unbound that comes with the base system. I see how nsswitch.conf allows to choose between files and dns for setting names. If I have to fall back to DNS, I'll use dns/nsd with tools of dns/dnsutl.

I'm trying to set up a LAN behind my BSD computer, in a layout like:
  • ISP modem
    • wifi connections
    • possible wired connections
    • FreeBSD computer
      • ftp server
      • hostap wifi dhcp connections to phones/devices
 
Code:
option subnet-mask 255.255.255.224;
subnet 172.16.1.3 netmask 255.255.255.254 
option broadcast-address 10.0.0.255;
For some reason, 172.16.1.2 didn't work with dhcpd.
Code:
ifconfig_wlan0="inet 172.16.0.x/8 ssid ..."
ifconfig_wlan0_alias="inet 172.16.1.1/12"
Try to understand how subneting work. I often used this tool to see which addresses are in given subnet. There are some tools in ports which helps calculate subnets, for example net_mgmt/cidr or net_mgmt/netmask.
 
Back
Top