inetd.conf in linux

I need to put the following line in inetd.conf:
stats stream tcp nowait nobody /usr/local/bin/mrtgsysinfo mrtgsysinfo
but my version of linux don't seem to allow that, ie there is no inetd.conf. How do i set that up in linux (red hat enterprise 3).

Go to the /etc/xinetd.d directory. You'll need to create a file (usually named after the program) and put your entries in there. Something like this (don't take my word for it, check out the xinetd man page):

service stats
{
        server = /usr/local/bin/mrtgsysinfo
        user = nobody
        socket_type = stream
        protocol = tcp
        wait = no
}

Carl

However when i try to do the following , which works on all my solaris boxes.....

telnet otlnx001 7260
Trying 172.16.32.241...

I get....

telnet: Unable to connect to remote host: Connection refused

obviously i am missing something, both hosts.allow and hosts.deny are empty.

I also ran xinetd in debug mode. It gave me the following error:

06/10/24@11:37:08: ERROR: 366 {service_fill} Port not specified and can't find service:stats with getservbyname

That's why I said to man xinetd. I gave you a quick and dirty file that may have no relation to what you really need :slight_smile:

Based on the site you probably grabbed this from (http://www.dmzs.com/~dmz/projects/mrtgsystemload.html\) and your error message, you still need to update /etc/services.

It's not going to know what port to be listening on unless you add the info to /etc/services (or possibly in the xinetd file as a "port = 7260" line).

Carl

I already had the line in the services file. I also tried your ports= in the xinetd file but it did not change anything.

Could you please let me know which OS are you using? If you are using redhat or fedora. seems iptables are blocking the port.

Let me know

Prashant,

Red hat Enterprise ES3 v4. And there is no iptables firewalls turned on.

Based on your debug error, the system did get some sort of tickle or you wouldn't have received an error. So it appears to be running somehow. I set up my Mandrake box as it said in the instructions I posted and created a stat file but I wasn't able to get any response from my linux box. I do have iptables running so I might be blocked (yes, even locally). I didn't want to whack my iptables to try this out though. Still, from the error it sounds like it can't find the port. Are you sure you have it in your /etc/services file?

Carl

Yea, a quick google search on the debug error you posted indicated the entry is missing from /etc/services. You might double check just to make sure.

Carl

hello,

after you modified the inetd.conf
do inetdconv.

see the man.

cheers :slight_smile:

There is only and xinetd, no inetd in this version. it works on some of my linux es boxes and not on others.

hello,

newer linux use inetdconv to convert the inetd.conf file so it can be use by xinetd.
try to look the command:)
inetdconv - you should have it inside the system.

cheers.

It turns out that for some reason solaris and Linux read my NIS differently. On my solaris machines if i edited the local serivces file it worked but on my linux machines it would not read the local file but the NIS file. So i just modified my NIS version of services and published and then it started working.

thanks to all that helped

How weird is that? Thanks for posting the update. It helps the troubleshooting for next time.

Carl

That's name service priority. Reading services from NIS is considered bad in Solaris, it actually says as much in the supplied nsswitch.conf files. The order in important, in Solaris if files are before nis in nsswitch.conf that files are used first. It appears that your Linux machines are either giving priority to NIS or, are configured not to use local files.