I'm trying to set up a router with FreeBSD at my lab. I have configured the kernel so I could use PF and ALTQ. The topology of my lab is like
and I want to place a WRT54GL AP under my PC so I can use WiFi for client, so it will be
my PC has a static IP address 192.168.1.2 from the router.
I already installed isc-dhcp and the dhcpd.conf on /usr/local/etc/dhcpd.conf is like this
and I use PF to forward it. My pf configuration in /usr/local/etc/pf.conf is like
and this is my rc.conf:
and my sysctl.conf is
When I try to connect into the WRT54GL that I have configured as AP (I disabled the dhcp function so IP will come from the PC), I can get IP address 192.168.2.100 but I cannot ping into 192.168.2.1 and I cannot connect to internet. Can anybody tell me what I got wrong?
Best regards
Ryuu
Code:
internet == router == FreeBSD
and I want to place a WRT54GL AP under my PC so I can use WiFi for client, so it will be
Code:
internet == router == FreeBSD == AP
my PC has a static IP address 192.168.1.2 from the router.
I already installed isc-dhcp and the dhcpd.conf on /usr/local/etc/dhcpd.conf is like this
Code:
option domain-name-servers 203.6.149.145;
default-lease-time 3600;
max-lease-time 86400;
ddns-update-style none;
authoritative;
log-facility local7;
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.1 192.168.2.254;
option domain-name-servers 203.6.149.145;
option routers 192.168.2.1;
option broadcast-address 192.168.2.255;
}
and I use PF to forward it. My pf configuration in /usr/local/etc/pf.conf is like
Code:
ext_if="em0"
int_if="re0"
internal_net="192.168.2.0/24"
external_addr="192.168.1.2"
localnet = $int_if:network
tcp_services = "{ 20, 21, 22, 23, 25, 53, 80, 110, 113, 143, 161, 162, 220, 443,1680, 1870, 3000, 3001}"
port_2 = "{ 80, 81, 143, 220, 554, 993, 995, 3128, 3000, 3001, 8080, 8181 }"
sshport = "{ 22, 2222, 1870 }"
icmp_types = "echoreq"
priv_nets = "{ 127.0.0.0/8, 172.16.0.0/12, 10.0.0.0/8 }"
#table <spamd-white> persist
#set skip on lo
set block-policy drop
set loginterface $ext_if
set skip on lo0
#scrub in
scrub in all
nat on $ext_if proto {tcp, udp, icmp} from $int_if:network to any -> $ext_if
nat on $ext_if from any to any -> ($ext_if)
#block all
#block drop in quick on $ext_if from $priv_nets to any
#block drop out quick on $ext_if from any to $priv_nets
pass out quick on $ext_if proto tcp from any port $tcp_services to any keep state
pass in quick on $ext_if proto tcp from any to any port $tcp_services keep state
pass in on $ext_if inet proto tcp from any to ($ext_if) port $tcp_services flags S/SA keep state
pass in inet proto icmp all icmp-type $icmp_types keep state
pass out on $ext_if proto tcp all modulate state flags S/SA
pass out on $ext_if proto { udp, icmp } all keep state
pass out on $ext_if from 192.168.1.2 to $ext_if keep state
pass in on $int_if from $int_if:network to any keep state
pass out on $int_if from any to $int_if:network keep state
pass out on $ext_if from $localnet to $ext_if keep state
pass out on $int_if from $localnet to $int_if keep state
pass in on $ext_if from $localnet to $ext_if keep state
pass in on $int_if from $localnet to $int_if keep state
and this is my rc.conf:
Code:
pf_enable="YES"
pf_logd="YES"
pf_conf="/usr/local/etc/pf.conf"
pf_flags=""
pflog_enable="YES"
pflog_logfile="/var/log/pflog"
pflog_flags=""
gateway_enable="YES"
ifconfig_em0="inet 192.168.1.2 netmask 255.255.255.0"
ifconfig_re0="inet 192.168.2.1 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
hostname="127.0.0.1"
dhcpd_enable="YES"
dhcpd_ifaces="re0"
dhcpd_flags=""
dhcpd_conf="/usr/local/etc/dhcpd.conf"
and my sysctl.conf is
Code:
net.inet.ip.forwarding=1
Best regards
Ryuu