Next steps for DIY router

This forum is for topics dealing with problems with software specifically in the ARMv7h repo.

Next steps for DIY router

Postby camosoul » Mon Oct 18, 2021 1:43 am

Building a cell phone tether router out of an XU4.

Stuff I've manage to do:
The wifi adapter autoconnects to the phone's hotspot.
The onboard Ethernet now has a static IP assigned.

Stuff I want to do but don't know what it's called:
I'd like this boi to provide DHCP, gateway, and Domain Lookup service to the network, just like my current Asus router does.
Then, I will disable this stuff in the Asus router and make it into a dumb Access Point.



My search-fu brings up a wide array of outdated, contradictory, wrong OS, and poor English results on the topic. Absolutely nothing is congruent.

Wut do next?
camosoul
 
Posts: 9
Joined: Sat Feb 29, 2020 3:40 pm

Re: Next steps for DIY router

Postby camosoul » Mon Oct 18, 2021 3:47 am

Out of frustration I gave up and installed dnsmasq. In spite of it's name, it does not do what it says it does. Apparently it's supposed to be a DHCP server and DNS server.

Unfortunately, after creating a systemd service and enabling that service, it fails to run with a fake error: port is already in use.

This is a lie.

Machines on the network end up with an autoconfig 169.254.xxx.xxx type address because there is, in fact, nothing on that port, and no, it is not in use.

How do I force dnsmasq to stop lying and making up fake excuses to refuse to do it's job?
camosoul
 
Posts: 9
Joined: Sat Feb 29, 2020 3:40 pm

Re: Next steps for DIY router

Postby camosoul » Mon Oct 18, 2021 4:19 am

$this->bbcode_second_pass_code('', 'Oct 18 00:16:08 [username] dnsmasq[817]: failed to create listening socket for port 53: Address already in use
')

No. It isn't. This error message is a lie.

I'm only specifying the adapter, not an address.

How can an address already be in use? Listen on port 53 on eth0. Just do your job and stop lying to me.

This error doesn't make sense and cannot be true.

I cannot fix what is not broken.
camosoul
 
Posts: 9
Joined: Sat Feb 29, 2020 3:40 pm

Re: Next steps for DIY router

Postby camosoul » Mon Oct 18, 2021 4:41 am

I guess I have to trash this project. dnsmasq is busted and keeps lying and refusing to do it's job.
camosoul
 
Posts: 9
Joined: Sat Feb 29, 2020 3:40 pm

Re: Next steps for DIY router

Postby graysky » Mon Oct 18, 2021 7:55 am

I don't have experience doing what you want but I would recommend using a distro like OpenWRT for such tasks although I do not believe that the ODROID hardware is supported. You can ask on their forums to double-check.
graysky
Developer
 
Posts: 1728
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: Next steps for DIY router

Postby armuseru » Mon Oct 18, 2021 8:52 am

$this->bbcode_second_pass_quote('camosoul', 'o')f outdated, contradictory, wrong OS
https://wiki.archlinux.org/title/Dnsmasq
https://www.youtube.com/results?search_query=turn+linux+to+router

other packages with similar functionality
pacman -Ss dns : bind, powerdns, smartdns, pdnsd
pacman -Ss dhcp : dhcp, kea
armuseru
 
Posts: 34
Joined: Sat Jan 09, 2021 9:36 am

Re: Next steps for DIY router

Postby summers » Mon Oct 18, 2021 5:23 pm

dnsmasq works - but is a bit of a hassle. You can also use dhcp4 described here https://archlinuxarm.org/forum/viewtopic.php?f=48&t=12623&p=57935.

But as network configuration is usual done via systemd-networkd, and that includes a dhcp server, I suggest using the one directly in systemd. Then everything is integrated, and its easier.

Your next hassle will be what number you give out - do you set up your own lan, or is the number part of the other connection out of the machine. If its part of the other connection, you need to check that the routing tables on the *whole* network are correct, and then know to route to the second machine via the first. You then also need to enable IP forwarding XU4.

If you don't go that direction, and set up the sub network as a new lan, then the addresses of the sub network won't be recognised in the wider network. In that case you'll need to set up a NAT on the XU4, masquerade mode is usually all you need - unless you need to allow incoming connections as well.

When I get home, I'll drop some of the scripts I've use to do this on here.

So in /etc/systemd/network/eth0.network you'll need something like the below - decide if you want to pass on DNS etc ...
$this->bbcode_second_pass_code('', '[Match]
Name=usb0

[Network]
DNS=192.168.2.1
DHCPServer=true
IPForward=true
IPv6AcceptRA=true

[Address]
Address=192.168.7.2/30

[Route]
Gateway=192.168.7.1

[DHCPServer]
EmitDNS=false
EmitNTP=false
EmitSIP=false
EmitRouter=false')
Then if you need NAT, and use nftables use something like:-
$this->bbcode_second_pass_code('', 'table ip nat {
chain prerouting {
type nat hook prerouting priority 0; policy accept;
}

chain postrouting {
type nat hook postrouting priority 100; policy accept;
masquerade
}
}
table inet filter {
chain input {
type filter hook input priority 0; policy accept;
ct state { related, established} accept
ct state invalid drop
iifname "lo" accept
ip protocol icmp accept
ip6 nexthdr ipv6-icmp accept
tcp dport ssh accept
meta nfproto ipv4 reject
}

chain forward {
type filter hook forward priority 0; policy accept;
}

chain output {
type filter hook output priority 0; policy accept;
}
}
')
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: Next steps for DIY router

Postby stefguy » Wed Oct 20, 2021 12:16 pm

dnsmasq is fine .. the issue that it cannot listen on port 53 on one/all of the interfaces can be caused by the systemd.resolvd stub resolver.

When you are going to implement a DNS server on an arch linux box .. or any linux box running systemd.resolvd .. you have to disable the stub resolver in /etc/systemd/resolved.conf by setting

$this->bbcode_second_pass_code('', '
DNSStubListener=no
')

then, restart systemd.resolvd or just reboot .. and dnsmasq should start up. for a small DIY router required to do all the basic networking stuff dnsmasq is a fine choice for a DNS server.

keep up .. ;-)

Stef
stefguy
 
Posts: 18
Joined: Fri Jul 13, 2018 2:55 pm


Return to ARMv7h

Who is online

Users browsing this forum: No registered users and 3 guests