Code:
FreeBSD 10.2-RELEASE #0 r286666: Wed Aug 12 19:31:38 UTC 2015
I would like to use this FreeBSD machine as an Internet gateway (with a firewall) but I haven't been able to get it configured correctly using only the handbook.
I copied /etc/defaults/rc.conf to /etc/rc.conf - Actually, I did a
cat /etc/defaults/rc.conf >> /etc/rc.conf then cleaned things up a bit. This way I can see all of the options and syntax. The relevant parts are probably:
Code:
hostname="insomnia.bohemia.net"
pf_enable="YES" # Set to YES to enable packet filter (pf)
pflog_enable="YES" # Set to YES to enable packet filter logging
ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration.
ifconfig_re0="inet 192.168.0.1 netmask 255.255.255.0"
wlans_ath0="wlan0" # wlan(4) interfaces for ath0 device
ifconfig_wlan0="WPA DHCP"
local_unbound_enable="YES" # local caching resolver
sshd_enable="YES" # Enable sshd
ntpd_enable="YES" # Run ntpd Network Time Protocol (or NO).
gateway_enable="YES" # Set to YES if this host will be a gateway.
/etc/pf.conf
Code:
set block-policy return
set loginterface wlan0
set skip on lo
nat on wlan0 from re0:network to any -> (wlan0)
block all
pass from { lo0, re0:network } to any keep state
Code:
net.inet.ip.forwarding=1
net.inet.ip.random_id=1
On the FreeBSD machine:
ping -c1 www.google.com
Code:
ping: cannot resolve www.google.com: Host name lookup failure
ping -c1 8.8.8.8
Code:
PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: Operation not permitted
^C
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
sudo pfctl -d
Code:
No ALTQ support in kernel
ALTQ related functions disabled
pf disabled
ping -c1 8.8.8.8
Code:
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=55 time=172.983 ms
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 172.983/172.983/172.983/0.000 ms
ping -c1 www.google.com
Code:
PING www.google.com (74.125.21.103): 56 data bytes
64 bytes from 74.125.21.103: icmp_seq=0 ttl=42 time=102.675 ms
--- www.google.com ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 102.675/102.675/102.675/0.000 ms
NAT doesn't seem to be working at all. The LAN machine can ssh into the FreeBSD Gateway machine but can't access the Internet.