Hi there,
I am trying to solve a problem with my gateway setup.
My FreeBSD machine is basically a gateway RaspberryPI which has two NIC: ue0 (Connected to external network, let's call it Internet) and ue1 (is an interface for internal LAN, dhcpd and dnsmasq spinning on it).
My current setup is using ipfw and nat in order to gain internet access for the lan clients, however, when I am trying to reach TFTP (10.1.1.33) server on external network from any of the clients, I can see that request is passing through, however, when the server replying to the client, the gateway (12.1.1.15) seems to be dropping the packets and replying that the port is unreachable.
So it seems to me that I am missing some sort of simple keep-state rule that I am too ignorant in firewalls to realize.
net.inet.ip.fw.one_pass=0
What am I missing?
Thank you in advance
I am trying to solve a problem with my gateway setup.
My FreeBSD machine is basically a gateway RaspberryPI which has two NIC: ue0 (Connected to external network, let's call it Internet) and ue1 (is an interface for internal LAN, dhcpd and dnsmasq spinning on it).
My current setup is using ipfw and nat in order to gain internet access for the lan clients, however, when I am trying to reach TFTP (10.1.1.33) server on external network from any of the clients, I can see that request is passing through, however, when the server replying to the client, the gateway (12.1.1.15) seems to be dropping the packets and replying that the port is unreachable.
Code:
IP 10.1.1.33.49137 > 12.1.1.15.44798: UDP, length 516
IP 12.1.1.15 > 10.1.1.33: ICMP 12.1.1.15 udp port 44798 unreachable, length 552
So it seems to me that I am missing some sort of simple keep-state rule that I am too ignorant in firewalls to realize.
Code:
WAN=ue0
ADD='ipfw add'
ipfw -q flush
ipfw nat 1 config if $WAN
$ADD 00010 allow ip from any to any via ue1
$ADD 00020 allow ip from any to any via lo0
$ADD 00100 nat 1 log ip from any to any in via $WAN in
$ADD 00105 check-state
$ADD 00110 skipto 1000 tcp from any to any in via $WAN setup keep-state
$ADD 00111 skipto 1000 udp from any to any in via $WAN keep-state
$ADD 00114 skipto 1000 tcp from any to any out via $WAN setup keep-state
$ADD 00115 skipto 1000 udp from any to any out via $WAN keep-state
$ADD 00900 allow tcp from any to me via $WAN in setup keep-state
$ADD 01000 nat 1 ip from any to any via $WAN out
$ADD 65000 pass all from any to any
What am I missing?
Thank you in advance