Ok, I've spend quite a bit of time, several days lately, and several weeks before.
My setup, Arris cable modem, FreeBSD system, with two NICs
em0 = external to cable modem
em1 = unmanaged switch
The broken way I can access the internet now, is by having a cable connect to a port on my Arris modem, basically bypassing the non working nat setup I'm trying to do.
rc.conf:
/etc/sysctl.conf
Two versions of pf.conf
CURRENT: (desperate attempt to do nat)
PREVIOUS: (no go)
To state the obvious, I'm not a networking expert. I copied these files from somewhere else, they might be old. I sort of understand a little, some of the concepts I guess. I've also read the manual and some man pages. For the life of me, I can't get this thing to work. Is there something wrong in the configs, or might it be some ghost in my computer?
My setup, Arris cable modem, FreeBSD system, with two NICs
em0 = external to cable modem
em1 = unmanaged switch
The broken way I can access the internet now, is by having a cable connect to a port on my Arris modem, basically bypassing the non working nat setup I'm trying to do.
rc.conf:
Code:
zfs_enable="YES"
nfs_server_enable="YES"
nfsv4_server_enable="YES"
nfsuserd_enable="YES"
nfscbd_enable="YES"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"
nfs_client="YES"
rpcbind_enable="YES"
mountd_flags="-r"
defaultrouter="192.168.0.1"
ifconfig_em0="inet 192.168.0.4 netmask 255.255.255.0"
ifconfig_em0_ipv6="inet6 accept_rtadv"
ifconfig_em1="inet 192.168.1.4 netmask 255.255.255.0"
ifconfig_em1_ipv6="inet6 accept_rtadv"
pf_enable="YES"
pf_flags=""
pf_rules="/etc/pf.conf"
pflog_enable="YES"
pflog_logfile="/var/log/pflog"
pflog_flags=""
gateway_enable="YES"
ipv6_gateway_enable="YES"
/etc/sysctl.conf
Code:
net.inet.ip.forwarding=1 # (default 0)
#net.inet.ip.fastforwarding=1 # (default 0)
#net.inet6.ip6.forwarding=1 # (default 0)
Code:
ifconfig
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
ether 00:25:90:68:8e:04
inet 192.168.0.4 netmask 0xffffff00 broadcast 192.168.0.255
inet6 fe80::225:90ff:fe68:8e04%em0 prefixlen 64 scopeid 0x1
inet6 2601:647:4501:db30:225:90ff:fe68:8e04 prefixlen 64 autoconf
nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
ether 00:25:90:68:8e:05
inet 192.168.1.4 netmask 0xffffff00 broadcast 192.168.1.255
inet6 fe80::225:90ff:fe68:8e05%em1 prefixlen 64 scopeid 0x2
inet6 2601:647:4501:db30:225:90ff:fe68:8e05 prefixlen 64 autoconf
nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
ether e0:46:9a:2c:d5:a1
inet 192.168.0.2 netmask 0xffffff00 broadcast 192.168.0.255
inet6 fe80::e246:9aff:fe2c:d5a1%re0 prefixlen 64 scopeid 0x3
nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
media: Ethernet autoselect (none)
status: no carrier
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
inet 127.0.0.1 netmask 0xff000000
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
groups: lo
pflog0: flags=141<UP,RUNNING,PROMISC> metric 0 mtu 33160
groups: pflog
CURRENT: (desperate attempt to do nat)
Code:
ext_if="em0"
int_if="em1"
nat on $ext_if from $int_if to any -> ($ext_if)
pass in all
Code:
ext_if="em0"
int_if="em1"
#int_if="em1"
localnet = $int_if:network
nat on $ext_if from $localnet to any -> ($ext_if)
#block in all
pass from { lo0, $localnet } to any keep state
client_out = "{ domain, auth, nntp, http, https }"
pass inet proto tcp from $localnet to any port $client_out flags S/SA keep state
udp_services = "{ domain, ntp }"
pass quick inet proto { tcp, udp } to any port $udp_services keep state