COP 4343 Unix System Administration Unit 12: basic network services concepts dhcpd, named superserver
Basic Network Services service listens on port for requests examples: http uses port 80 ssh uses port 22 firewall must allow IP packets through /etc/sysconfig/iptables service iptables restart
/etc/sysconfig/iptables # ftp -A RH-Firewall-1-INPUT -p tcp --dport 20 -j ACCEPT -A RH-Firewall-1-INPUT -p tcp --dport 21 -j ACCEPT # ssh -A RH-Firewall-1-INPUT -p tcp --dport 22 -j ACCEPT # http -A RH-Firewall-1-INPUT -p tcp --dport 80 -j ACCEPT # mail -A RH-Firewall-1-INPUT -p tcp --dport 25 -j ACCEPT -A RH-Firewall-1-INPUT -p tcp --dport 143 -j ACCEPT -A RH-Firewall-1-INPUT -p tcp --dport 587 -j ACCEPT
Basic Network Services examples: dhcpd: UPD ports 67 and 68 named: UPD port 53 superserver: can be configured to listen on any port
dhcpd server install dhcpd package configuration file: /etc/dhcpd.conf enable in run-level
dhcpd configuration example subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.2 192.168.0.8; Range of available IP addresses default-lease-time 604800; Default lease time in seconds max-lease-time 604800; Maximum time a lease will be given option subnet-mask 255.255.255.0; subnetmask given to clients option domain-name-servers 1.2.3.4, 1.2.3.5; List of name server IP addresses option domain-name "your.domain.name"; option routers 192.168.0.1; Gateway router }
named server implements domain name server (DNS) Configuration file: /var/named/chroot/etc/named.conf example: zone "ege.com" { type master; file "ege.hosts"; };
Example: ege.hosts @ IN SOA ege.com. raimund.ege.com. ( 75 8H ; refresh 2H ; retry 1W ; expire 1H) ; min time to live NS ns3.ege.com. NS ns4.ege.com. MX 10 mail.ege.com. TXT "Ege Consulting Inc" A 131.94.130.39 mail A 131.94.130.39 ns3 A 131.94.130.39 ns4 A 66.92.213.193 instructor A 131.94.132.84 www.instructor A 131.94.132.84
Superserver configurable server to handle multiple network services xinetd xinetd.conf xinetd.d listens on multiple network ports and starts the appropriate service when a client connects to that port traditional Unix: inetd
example configuration file service echo { type = INTERNAL id = echo-stream socket_type = stream protocol = tcp user = root wait = no disable = yes }
example configuration file service ntalk { disable = yes socket_type = dgram wait = yes user = root group = tty server = /usr/bin/ktalkd }
xinetd security enable port in firewall host specific: iptables /etc/hosts.allow /etc/hosts.deny
xinetd to enable: disable = no reload xinetd service service xinetd reload test via telnet host port
example services port 7: echo port 19: chargen port 9: discard repeats back whatever you type port 19: chargen returns a character stream until control-D port 9: discard like /dev/null port 37: time returns a number corresponding to the current time port 13: daytime returns the current date/time in human-readable form
Services Beyond the Superserver services do not rely on superservers: Apache Web SMTP FTP ... run as service in run level