I'm working on some software, that runs on a Centos 5.xx installation. I'ts not allowed for our customers to log in to Linux, everything is done from Windows applications, developed by us.
So we have build a frontend for the user to configure network setup: Static/DHCP, ip-address, gateway, DNS, Hostname.
Right now I let the user enter the information in the Windows app, and then write it on the Linux server like this:
- Write to /etc/resolv.conf: Nameserver
- Write to /etc/sysconfig/network: Gateway and Hostname
- Write to /etc/sysconfig/network-scripts/ifcfg-eth0: Ipaddress, Netmask, Bootproto(DHCP or Static) I also (after some time) found out that I was unable to send mail, unless I wrote in /etc/hosts: 127.0.0.1 Hostname
All this seems to work, but is there a better/easier way to do this?
Also, I read the network configuration nearly the same way, but if I use DHCP, I miss som information, for instance the Ip-address. I know that I can get some information from the commandline (ifconfig), but I dont get for instance Hostname, Gateway and DNS. Is there a commandline tool that will display this?