I used the following configuration to use different xinetd directives for a service depending on which interface the connection was initiated on. In the following example, my LAN interface has IP address 192.168.0.1, and my Internet interface has IP address 10.10.10.10. I used procedures very similar to these to configure to use two different sets of directives for an SMTP server on a system running RHEL5.

The first thing I did was create a new entry in the /etc/services file. I will use telnet as an example.

vi /etc/services

telnetnew 23/tcp

Create new service configuation file:

vi /etc/xinetd.d/telnetnew

service telnetnew
{
disable = no
flags = REUSE
wait = no
user = root
server = /usr/sbin/in.telnetd
socket_type = stream
protocol = tcp
log_on_failure += USERID
log_on_success += USERID
only_from = 192.168.0.0/24
instances = 100
bind = 192.168.0.1
}

Modify the existing /etc/xinetd.d/telnet configuration file with new directives:

vi /etc/xinetd.d/telnet

no_access = 192.168.0.0/24
instances = 1
bind = 10.10.10.10

Create the new service and enable it:

chkconfig –add telnetnew
chkconfig telnetnew on

Reload xinetd to implement the new configuration and the start the new service.

service xinetd reload

This configuration will enable only one telnet connection from the Internet and 100 from the LAN segment. I used this type of configuration for an SMTP server to reduced the number of connections from the Internet.