Solved Static ethernet configuration doesn't get a reachable domain unlike DHCP

Hi,

Recently I have been disabled ntpd on boot and got avoid from DHCP because bootup delay while there isn't a link since my old second router (openwrt wifi bridge with relayd) is still booting.

I have a nginx server running for my poudriere builds to check from phone when I'm laying down or something. Entering local domain of my computer to address bar works if I enabled and used DHCP to retrieve connection, otherwise, with static IP configuration, I am only able to do it with the ip of computer, domain way doesn't work like it's unknown to others.

Thanks in advance, I hope that's the right category for my thread.
 
Do you properly configured default route and DNS?
And if you're using local_unbound, you'll need to tell it working DNS accessible via default route or properly configured local network.
 
Do you properly configured default route and DNS?
And if you're using local_unbound, you'll need to tell it working DNS accessible via default route or properly configured local network.
I have set defaultrouter variable of rc.conf to main router's IP already. DNS is set to the one the resolvconf set via DHCP before I got rid of it and it is true with search home.arpa argument (my local lan DHCP domain).

No, I don't use something like unbound on my computer but nextdns on my router.

Thanks for commenting so quickly 🙂
 
I've never tried, but if your DHCP server allows, configuring DHCP server to give static IP address (guessing it's IPv4) for your MAC address could be an option.
If it's IPv6 (I have no experience, though, as my ISP gives IPv4 only for the service I've contracted before IPv6 service was available), does router advertizement (RA) handled properly on your server? IIRC, global IPv6 address is auto-generated in conjunction with RA and the nework interface's MAC address.
 
With the little I glean from this thread, it sounds like the OPs static IP config isn't complete. No correct default router and/or DNS, but that stuff is dome automatically when they get a DHCP lease. My advise is to copy down the route and DNS server info from the DHCP and add it to the local machine's static IP configuration and then don't use DHCP at all. DHCP isn't really useful in a SOHO environment.

NAT, on the other hand, most defilitely is useful and expected. Handle all that stuff in the openWRT firewall.
 
I've never tried, but if your DHCP server allows, configuring DHCP server to give static IP address (guessing it's IPv4) for your MAC address could be an option.
That is what I do. I use DNSMasq and add static IP's to dnsmasq.conf

Code:
dhcp-host=fc:aa:14:ff:e8:b4,GIGABYTE_BMC,192.168.1.90
dhcp-host=00:25:90:fe:68:c7,X10DRI_BMC,192.168.1.91
dhcp-host=00:e0:81:cf:6f:26,S7052_BMC,192.168.1.92
dhcp-host=0c:c4:7a:44:d5:58,X10DRL_BMC,192.168.1.93
dhcp-host=00:25:90:ae:88:ae,X9DRW_BMC,192.168.1.94
dhcp-host=00:25:90:aa:87:a6,X9SRL_BMC,192.168.1.95
dhcp-host=ac:1f:6b:4a:41:8a,X10SRI_BMC,192.168.1.96
dhcp-host=3c:ec:ef:2e:b2:51,X10DRX_BMC,192.168.1.97
 
I've never tried, but if your DHCP server allows, configuring DHCP server to give static IP address (guessing it's IPv4) for your MAC address could be an option.
Do I need to use DHCP for that instead? Or giving my computer static ip from router would work without dhcp involved too? I use OpenWRT on both of my routers.

With the little I glean from this thread, it sounds like the OPs static IP config isn't complete. No correct default router and/or DNS, but that stuff is dome automatically when they get a DHCP lease.
Then, let me give some information about configuration in my computer.
Code:
% netstat -rn -4
Routing tables

Internet:
Destination        Gateway            Flags         Netif Expire
default            192.168.1.1        UGS             re0
127.0.0.1          link#2             UH              lo0
192.168.1.0/24     link#1             U               re0
192.168.1.109      link#2             UHS             lo0

% cat /etc/resolv.conf
# Generated by resolvconf
search home.arpa
nameserver 192.168.1.1

# /etc/rc.conf
hostname="freebsd.home.arpa"
ifconfig_re0="inet 192.168.1.109 netmask 255.255.255.0"
defaultrouter="192.168.1.1"

% ifconfig re0
re0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
        ether xx:xx:xx:xx:xx:xx
        inet 192.168.1.109 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

Also i can't ping my hostname from my computer either. I guess i need to edit /etc/hosts for that but would that let my phone access my computer with domain?
Code:
% ping freebsd
ping: cannot resolve freebsd: Name does not resolve
 
Oops, it was easy. Thanks y'all.
 

Attachments

  • Screenshot_2025-07-29-10-56-14-108_com.android.chrome.jpg
    Screenshot_2025-07-29-10-56-14-108_com.android.chrome.jpg
    234.7 KB · Views: 126
  • Screenshot_2025-07-29-10-56-32-996_com.android.chrome.jpg
    Screenshot_2025-07-29-10-56-32-996_com.android.chrome.jpg
    105.3 KB · Views: 131
In order for your hostname to resolve it needs an entry in the DNS server, your router probably registers them automagically when you use DHCP. If you use static addresses you will need to add the DNS entries yourself.
 
In order for your hostname to resolve it needs an entry in the DNS server, your router probably registers them automagically when you use DHCP. If you use static addresses you will need to add the DNS entries yourself.
Oh, got it, thanks for explaining.
 
Do I need to use DHCP for that instead?
No. But if DHCP works fine while manual static configs doesn't, it would be worth trying.

Or giving my computer static ip from router would work without dhcp involved too?
If I understand correctly, it would work for IPv6. Precisely, if your router supports IPv6 and configured to activate it, it should invocate router advertizement (RA) to all interfaces on its local-side network. And each drivers for network interfaces supporting IPv6 that received RA should generate its global IPv6 address using RA (for network address) and MAC address of itself (for interface address).
 
Yes with static IP only, for your local hostnames to work, you need to use /etc/hosts
Hmm, thanks, but setting dns records directly on the router seems to be easier and more universal between devices. I guess the hosts file on my computer is only will be affecting my computer usage?
 
For small local network like home/SOHO environment that local DNS server is too messy, /etc/hosts is handy. But it's applicable only for local network, not for Internet.
You need to configure resolver with resolv.conf yourself, if you're not enabling local-unbound(8) as cache DNS server nor using DHCP, for Internet.
For IPv6, it depends. If the router propagating RA supports RFC5006 and client computers (from the view of router) supports it, DNS would be configured automatically using RA. If not and DHCPv6 is available && client supports it, DNS would be configured using it.
Otherwise, you need to configure resolver manually, to choose IPv6-capable (having usually AAAA record) DNS.
 
I guess the hosts file on my computer is only will be affecting my computer usage?
Yes, they will work but only on the computer that has the modified hosts file. As a matter of fact, hosts also overrules whatever is in DNS. Which can be quite useful for testing purposes but also a source of strange connection problems if you're not aware of it.

nsswitch.conf(5):
Code:
#
# nsswitch.conf(5) - name service switch configuration file
#
group: compat
group_compat: nis
hosts: files dns
netgroup: compat
networks: files
passwd: compat
passwd_compat: nis
shells: files
services: compat
services_compat: nis
protocols: files
rpc: files

This tells the system to resolve hosts, first through files (which is /etc/hosts) then try DNS. If a host is found in hosts it will not query DNS.
 
Back
Top