Clearly I lack some understanding in networking...
I have configured a VLAN interface on my router and host. I want the VLAN IP to only access its own subnet, nothing else. ifconfig and pf rules are at the end of the post.
What happens
-
-
What I want to happen
Why?
That part I don't know... what I think is going on is that
I'm not really sure how to test if my firewall config is correct.
router
host
I have configured a VLAN interface on my router and host. I want the VLAN IP to only access its own subnet, nothing else. ifconfig and pf rules are at the end of the post.
What happens
-
ping -c 1 -S 192.168.42.2 192.168.42.1
works as expected. tcpdump -i em0.42
shows the packets-
ping -c 1 -S 192.168.42.2 9.9.9.9
succeeds, but I want it to fail. tcpdump -i em0.42
doesn't show anything. tcpdump -i em0 host 9.9.9.9
shows the packets originating from 192.168.1.126
(the em0
non-VLAN IP)What I want to happen
ping -c 1 -S 192.168.42.2 9.9.9.9
should send packets out em0.42 and have them be rejectedWhy?
That part I don't know... what I think is going on is that
route -n get 9.9.9.9
uses the default route, which goes through em0.I'm not really sure how to test if my firewall config is correct.
ping -S
appears to not be using my em0.42
interface, even though that's the interface that the source IP is bound to.router
Code:
# ifconfig igb1.42
igb1.42: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=4600703<RXCSUM,TXCSUM,TSO4,TSO6,LRO,RXCSUM_IPV6,TXCSUM_IPV6,NOMAP>
ether 64:62:66:21:1c:75
inet 192.168.42.1 netmask 0xffffff00 broadcast 192.168.42.255
groups: vlan
vlan: 42 vlanproto: 802.1q vlanpcp: 0 parent interface: igb1
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
# pfctl -s rules
scrub in all fragment reassemble
block drop in all
pass out all flags S/SA keep state
pass in on igb1 proto tcp from any to any port = ssh flags S/SA keep state
pass inet from 192.168.1.0/24 to any flags S/SA keep state
block return inet from 192.168.42.0/24 to any
pass inet from 192.168.42.0/24 to 192.168.42.0/24 flags S/SA keep state
host
Code:
$ ifconfig em0
em0: flags=8963<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=4e504bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,LRO,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6,NOMAP>
ether 04:42:1a:ac:f7:1e
inet 192.168.1.126 netmask 0xffffff00 broadcast 192.168.1.255
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
$ ifconfig em0.42
em0.42: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=4600403<RXCSUM,TXCSUM,LRO,RXCSUM_IPV6,TXCSUM_IPV6,NOMAP>
ether 04:42:1a:ac:f7:1e
inet 192.168.42.2 netmask 0xffffff00 broadcast 192.168.42.255
groups: vlan
vlan: 42 vlanproto: 802.1q vlanpcp: 0 parent interface: em0
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>