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;
}
}
')