Trying to set a static IP with a fully qualified domain name on Redhat? But the command domainname still returns nothing? Here’s what you can do.
Backup the following files, then edit them:
(I’ve also seen “STATIC”, but mine is running with “none”)
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.2.201 black.testrac.com black
/etc/nsswitch.conf needs a line:
hosts: files dns
You can also use the GUI tool:
to set a number of these parameters
You can then reset the network with commands:
Stop the network:
Start the network:
However, I prefer a full reboot to be sure. Recently, I had issues after rebooting that were not presenting themselves before. Turns out that two active ethernet ports are not better than one if the second is not plugged in.
Then double check your results:
But if your experience is like mine, you still get nothing when you run the command: domainname
Here is the secret to get domainname to work:
add the line:
then, reinitialize the settings with: