ipv6 routing

andygoblins

Ars Centurion
268
Subscriptor
I'm trying to teach myself ipv6 and wrap my head around routing without port forwarding. This sounds like it should be simpler on paper, but I haven't been able to get it working. Here's what I have so far:

- My server has a public ip6 address and it can access the internet over ip6 through my router.
- My server hosts a web page on 443. In ip4, I would add a forward rule on my router for this port and device, but that shouldn't be necessary for ip6. So I tried adding a simple "allow" firewall rule instead:
Code:
pass in egress log inet6 proto tcp to <server IP> port 443
but that didn't work. I can see in the logs that the rule fires when I try to visit my web page, but the page never loads.

I know the web page works; devices on the same switch as the server can access it just fine. So I'm guessing I don't have routing set up right for external connections. From the router, I can run "route get <server's ip6 address>" and it prints the right destination interface, but clearly, this isn't enough.

Any suggestions?
 

andygoblins

Ars Centurion
268
Subscriptor
Ha! after tracing the packets carefully through my network, I solved it. I removed the "in egress" part of my rule:
Code:
pass log inet6 proto tcp to <server IP> port 443

In ipv4, the only interface that really matters is egress/wan. It's the one receiving the outside world traffic and rewriting the destination to your internal, RFC1918 network and vice versa.

But in ipv6, you're directly routing all packets, which means both the incoming and outgoing interfaces are important. My original rule passed inbound traffic on the wan interface, but my default "block" firewall rule was still dropping the outgoing packets as they left the lan interface.

As usual, the moral of the story is, "be really careful about making rules specific to traffic direction"
 

Frennzy

Ars Legatus Legionis
85,841
You should look at less like "IPv6 routing" and more like "firewalling without NAT."

You're not doing any complicated routing, you're setting up a default gateway for your hosts. That box will have its own default gateway. This is in no way different than routing IPv4. What's different is address assignment, neighbor discovery, etc. Your provide will handle the actual routing to/from you.

You'll want security policies to define access to your v6 hosts...this is not routing in and of itself. Your router/gateway will do the routing, between a remote host and a connected subnet (or multiples thereof). It should also do DPI/state/NGFW/UTM whatever else you want to call it or add to it.

You *may* want to add policy routes at some point...but you may not. Easier to not if you don't have to.

Keep in mind you'll still want to maintain a strict security stance on your public facing hosts in addition to any filtering/security policies on your firewall/gateway.
 

andygoblins

Ars Centurion
268
Subscriptor
fair point; it really is more security policy than routing. When I started this thread, I thought my issue was routing, but it turns out that was all configured correctly and it was the security policies I did wrong.

One idea I've been kicking around is to take advantage of the fact that a host will have both a public IP and a ULA: I could have my www reverse proxy respond differently to requests from a ULA address than from a public address, maybe treating them as slightly higher privilege.

Obviously, this isn't a replacement for proper 2-factor authentication at the application layer, having an NGFW, etc, but it seems like a fairly easy level of segmentation to implement. Does that seem like a resonable idea, or are there pitfalls that I'm not thinking through correctly?
 

sryan2k1

Ars Legatus Legionis
46,882
Subscriptor++
One idea I've been kicking around is to take advantage of the fact that a host will have both a public IP and a ULA: I could have my www reverse proxy respond differently to requests from a ULA address than from a public address, maybe treating them as slightly higher privilege.


That's a bad road to go down, and adds complexity for no real security.
 

andygoblins

Ars Centurion
268
Subscriptor
Yeah, you're probably right.

The old way of doing it was to have an entirely separate internal reverse proxy to host the internal stuff, and split-horizon DNS to resolve to the correct proxy depending on location. The "internal" proxy would have to be protected from the outside by routing rules or use RFC1918

In my theoretical, head-spaced design, I keep split-horizon DNS, but eschew the extra reverse proxy to have a single proxy that responds with "internal" resources to ULAs and with "external" for everything else.

But as I think about it more, this is a bad idea from a security angle, because now if the external proxy gets compromised, it will have access to all the internal resources. I should keep a separate internal server, but I could still only serve it from a ULA address, guaranteeing it stays accessible from the internal network only.