/proc/sys/kernel/domainname empty?!

Is there a reason why there's no set domain name?

uci show system.@system[0].hostname

this variable in /etc/config/system ends up overwriting /proc/sys/kernel/hostname on startup
running grep '/proc/sys/kernel/' /etc/init.d/system
returns: echo "$hostname" > /proc/sys/kernel/hostname

But, grep -r '/proc/sys/kernel/domainname' /etc
doesn't return any matches (in /etc)

Why is this so?

Why should OpenWrt set a domainname? Do you have a domain assigned to your router/ip? What you try to achive? DDNS is not relying on internal hostname or domainname.

If you want to do sth. like redirect or overwrite a dns name you can do it as followed:

uci add_list dhcp.@dnsmasq[0].addnhosts=/etc/override.hosts
echo 'fqdn.example.com 127.0.0.1' >> /etc/override.hosts
/etc/init.d/dnsmasq restart

E. g. you can set forum.openwrt.org as a hostname. Its a fqdn also. You can set "OpenWrt" as a hostname also. But it's not a fqdn!

For Linux hostname and domainname are not exactly the same also.

You would do usually sth. like that:

setting "forum" as hostname
setting "openwrt.org" as domainname

https://www.man7.org/linux/man-pages/man5/procfs.5.html

2 Likes