Lurker News

Comments (102) 11 threads

Earlier comments
grizzles3 replies#
Any chance for split horizon dns? The ability to perma-name all my home computers is something I've always wanted in a home router.
secure2 replies#
https://godoc.org/github.com/rtr7/router7/cmd/dnsd already resolves computer names from DHCP leases. Is that what you mean? If no, can you elaborate on what the use-case is?

Edit: forgot to mention, you can use static leases, too, permanently assigning an IP/hostname to a MAC address: just remove the expiration field in /perm/dhcp4d/leases.json :)

grizzles#
Oh cool re: dnsd
chrissnell1 reply#
Here's a use case that I am currently doing at home:

I have a live weather station [1] that pulls data from a Go-based service that I wrote and run on a server on my home network. When I'm outside of the house, mhkweather.com resolves to a Digital Ocean IP, where I run a proxy to forward requests back to home IP. However, when I'm at home, mhkweather.com resolves to a local 10.x.x.x IP and goes straight the the local service, no proxy. It faster this way. I want to be able to set DNS overrides for local things. I can do this with unbound but it would be nice if dnsd could do this for me.
[1] https://mhkweather.com

secure#
Thanks for elaborating.

For the time being, you’d need to modify dnsd to install your custom handler. It should be as simple as adding another server.mux.HandleFunc call in internal/dns/dns.go.
If this turns out to be a feature which many people would like, I’ll think about how to best structure the code to make this easier.

zamadatix1 reply#
Why do you need split horizon DNS for that?
grizzles3 replies#
So if I ssh into another computer by it's name everything works without me having to maintain a static device table somewhere w/scripts to deal with inevitable versioning issues.
chatmasta6 replies#
You don’t need split horizon dns as long as the router is running a resolver. Just configure the resolver to use some TLD (eg .local) as a local network so that it looks up any names ending in eg .local in its local /etc/hosts or equivalent.

Continue this thread — 6 replies

zamadatix#
Like the other person said that's just a normal DNS lookup, not split horizon. Use one of the private TLDs like .test or .local.
jethro_tell#
I posted how to do split horizon above. I get it. You don't want to change your ssh config and doing things on lan instead of going through the router interfaces is ideal.
Mister_Snuggles2 replies#
This seems to be a standard feature in many routers now. The computer name sent with the DHCP request will eventually land in the resolver's hosts table and it will respond to DNS requests as expected. It's client-controlled, which is kind of not great, but for home users it works as intended.

What I'd like to see is a home router that lets me put arbitrary rules in. Currently I use dnsmasq as a resolver and it basically does what I need, but I'd rather have it running on the router instead of needing another computer.
My current rule set is roughly:
* Resolve from local hosts file - this is where I put my statically assigned home servers/devices.
* If the domain request matches .domain.tld, forward it to a.b.c.d for resolution - this is a dnsmasq running on a remote box and covers off VMs that I run there. There is an IPSec tunnel (running on a small VM) and static routes on my router that handle getting to that box.
Finally, pass the request onto my router which will pass it onto my ISP or use its local DHCP-driven hosts table to resolve it.
I'd love it if an off-the-shelf router could do this. Currently I'm using a UniFi Security Gateway and it seems like this feature set would be a good fit. The router is professional-enough that advanced features like this make sense.

secure2 replies#
Have a look at router7’s dnsd, it’s not that complicated: https://github.com/rtr7/router7/blob/master/cmd/dnsd/dnsd.go You could easily fork it and extend it to implement your custom rules.

I’ve done Go cross-compilation for running on Ubiquiti gear before, and it worked. So, if you’re willing to spend the effort, you could do it :).

jethro_tell#
I have this set up in my house. I have a tld and internally I want the IP to resolve to the land IP and externally, to the ISP ip. I also have local caching for things like imap, but slow uploaded so I don't host my full email and web mail stack there.

I run 2 dns servers usually on the same box on different bind addresses. You'd run a caching resolver on the gw ip and forward requests for my.tld to the second resolver which is configured to be authoritative for my.tld. the hosts can then be configured either through DHCP or statically.
This is a pretty common technique to make enterprises Intranets.
Added benefit is that when you did a file transfer between Lan hosts with the globally accessable DNS, the transfer stays on the LAN. Also ssh host works in you ssh config regardless of location.

voltagex_1 reply#
Which Ubiquiti gear? I wasn't expecting one component to be on MIPS, one component to be on ARM7 without hardfloat and one component to be ARM7-A with vfp4.

I guess Go's cross compilation makes it easier.
PS: Without hardware offload, the 8 port POE switch only manages 12 megabits / second.

Continue this thread — 1 reply

voltagex_#
I'm running a similar setup (although without IPsec). My compromise was to have name.int.my.domain resolve internally and name.my.domain resolve externally (easier with ipv6).

dnsmasq should be able to do what you want to do and it can be enabled on the USG - at least from the controller.

voidmain00011 reply#
@secure: Are you using netfilter or nftables for the firewall / NAT services?
arminiusreturns#
So can you tell me what you think of nft? Details if you feel like it please. I'm a sysadmin type who has stared at way too much iptables and decided to start going full nftables. I haven't hit any showstopper yet but I figure it would be worth asking someone who has dealt with its complexities. I've been putting off Bpf because it feels like actual programming in yet another language. Did you try that?

One last comment, you might check out Dragonfly BSDs network stack if you haven't yet for ideas, the last benchmarks I ran were surprising.
To anyone listening, does Bpf enable us to get past the 10gbs dma issues on a Linux router?

tedchs#
This is super exciting as I've had this on my "hobby to do list" for a while... now I don't have to do it! :)
ejanus1 reply#
I am currently reading some source codes on tap-based IP/TCP stack and Babel. I have not wrapped my head around some of the concepts because I need to first understand some RFCs . I would be reading your code base soon, but can one fire it up to work on Raspberry Pi3 ? And can it work with something that is not fibre ?
secure2 replies#
You can fire it up on a Raspberry Pi 3, yes. That’s how I started developing it, to be sure the architecture works before I spend the effort of porting gokrazy to the apu2c4 :)

It can work with any ISP (not just fiber7) as long as you have an ethernet interface and the ISP uses DHCPv4 and DHCPv6 for configuration. If that’s not the case, you’d need to develop e.g. PPPoE support yourself.

pjmlp#
Love the gokrazy idea, I wasn't aware of it.

With some effort, it could become the new Inferno, just with Go instead of Limbo and the Dis VM.

avip1 reply#
Do you have some docs wrt Pi3 setup (or - there's no "setup" other than installing Router7?)
secure#
Unfortunately there are no docs, as the Raspberry Pi is not an actively used platform for router7 (I switched to the apu2 after prototyping).

That said, your guess is likely correct, this gokr-packer invocation should do the trick:
gokr-packer \ -hostname=router7 \ -overwrite=/dev/sdb \ -gokrazy_pkgs=github.com/gokrazy/gokrazy/cmd/ntp \ github.com/rtr7/router7/cmd/...
But note that you might need to rebuild https://github.com/gokrazy/kernel with some additional kernel options from https://github.com/rtr7/kernel, plus options for whichever USB ethernet adapter you’re going to use.
Note that you won’t have automated recovery (rtr7-recover), as that uses PXE boot, which Raspberry Pi’s don’t do by default (and rtr7-recovery-init has some hard-coded values which won’t work on the Raspberry Pi, at least not when using an SD card for storage).

Load more comments