Configuring Linux Network

Posted by Reiler on Server Fault See other posts from Server Fault or by Reiler
Published on 2009-12-26T15:42:33Z Indexed on 2010/04/08 4:53 UTC
Read the original article Hit count: 299

Filed under:

Hi 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?

© Server Fault or respective owner

Related posts about network