Editing the Icecast Configuration File

The following is a working icecast.conf file that works well in most instances. Notice that all comments have been removed. Read through any and all comments included with the source prior to modifying any variables. Leave any items you might be uncertain about in their default setting.

Note

I highly recommend creating a backup of any distribution configuration file prior to making editing changes. This way if things do not work as anticipated you can always go back to a pristine copy.

Example 1. Example Icecast1 icecast.conf File

# -------- Sample icecast.conf Config File --------
location Linux Free Radio Server Room
rp_email me@mydomain.com
server_url http://icecast.mydomain.com/

max_clients 100
max_clients_per_source 100
max_sources 5
max_admins 5
throttle 10.0

use_meta_data 0
streamurllock 0
streamtitletemplate %s
streamurl http://icecast.mydomain.com
nametemplate %s desctemplate %s

mount_fallback 1

#encoder_password hackme
#admin_password hackme
#oper_password hackme
encoder_password g1zaS86gukERB
admin_password g1zaS86gukERB
oper_password g1zaS86gukERB

touch_freq 5
hostname 192.168.0.5
port 8000
server_name icecast.mydomain.com
force_servername 0

logfile icecast.log
accessfile access.log
usagefile usage.log
logfiledebuglevel 0
consoledebuglevel 0

reverse_lookups 0

console_mode 0

client_timeout 30

kick_clients 0

#staticdir @ICECAST_STATICDIR_INST@
#staticdir c:\windows\desktop
#staticdir /usr/local/icecast/static
staticdir /tmp

#templatedir @ICECAST_TEMPLATEDIR_INST@
templatedir /usr/local/icecast/templates

#logdir @ICECAST_LOGDIR_INST@
logdir /usr/local/icecast/logs
stats_log stats.log
statshtml_log stats.html
stats_time 60

alias freeradio http://192.168.0.100:8010

kick_relays 10

transparent_proxy 0

acl_policy 1
#deny all *
#allow all *.mydomain.com

# EOF

Though the comments included with the source should be sufficient to explain what each and every line does, the following is a brief overview of the important items included within this configuration.

Explaining the Configuration File

This section explains the basics behind each line listed in the previous configuration file. Some items may be listed here that are not shown in the above configuration file. Build upon the icecast.conf file included with the icecast1 source code and use the following for reference. The next few sections provide an overview for modifying the configuration to suit your streaming audio needs and purposes.

Server Location and Responsible Person

Define the physical location of your streaming audio server. This entry contains the server meta information. This data is displayed when listing directories, streams, and if the client supports it, other stream headers.

location

Anything can be placed here as it is mostly for show and is intended primarily for your own information.

rp_email

State your contact email address in case of failure. This, once again, is intended primarily for managerial use and is not meant to be seen by the average listeners.

server_url

This variable lists the actual URL of the streaming audio server. Users connect to either a Fully Qualified Domain Name (FQDN) or the IP address of the machine followed by the port number used by icecast.

Server Limits

These items describe the maximum number of simultaneous connections allowed. Once the pre-defined limits are reached, the server refuses further connections. A builtin bandwidth measuring tool is included inside the icecast server. When icecast thinks that it is using more than the "throttle" Mb/s limit, no further clients or sources are allowed until the bandwidth usage returns below the defined limit. Use this option with caution since the icecast bandwidth measurement option is not an exact science.

max_clients

The maximum amount of listeners that are allowed to connect to the icecast server.

max_clients_per_source

If using more than one source or if streaming more than one audio feed, this variable states the number of clients that can connect to each source.

max_sources

The maximum number of sources that can be handled by the icecast server. This variable is useful when broadcasting multiple streams at varying bitrates.

max_admins

The maximum number of administrators that can log into the server at any given time to remotely manage the server.

throttle

The amount of bandwidth in megabits (Mb/s) at which new connections are disallowed. This feature is useful in instances where an extraordinary amount of listeners are connecting and attempting to listen. Rather than exceed your allotted bandwidth or pay bursting charges, the icecast server throttles any and all new connections. If too many listeners are connecting or if your bandwidth is being consumed at an inordinate rate, lower this variable to something more manageable.

Stream Meta Data

This section is an experimental feature. It provides the stream meta data to the client. Use caution when enabling these items as when it does not work, it may cause the entire stream to be out of sync on the client side, resulting in major audio issues.

use_meta_data

This option controls whether the icecast server uses title streaming. It is turned off by default (hence the value of "0"), as it may cause chirps in the stream.

streamurllock

Lock the stream URL to the value specified by the "streamurl." The value of "0" disables this feature and is turned off by default.

streamtitletemplate

The template for the audio streaming title that is sent to the client and the directory server. The value "%s" is substituted for the actual filename.

streamurl

The default URL for the audio stream. If you wish to alter the URL to which listeners normally connect, define that variable here.

nametemplate

The template for the name of each stream. The default value is "%s".

desctemplate

A template describing each stream.

Mountpoint Fallback

By default, if a user requests a stream that is not found, the default stream is handed off to the user instead. The default stream is per default the oldest stream on the server, but this can be changed using the priority value in the modify command. If you do not want the user to receive the default mount, but instead a HTTP 404 Stream Not Found error, set this value to "0".

mount_fallback

If you have any other servers to which listeners should fall back on in the event your server dies, state whether or not that option is available here. This feature is enabled by default with a value of "1".

Server Passwords

Unless icecast is compiled with crypt support, i.e. using the --with-crypt option as an argument to the configure script, all passwords are in cleartext. If the icecast server does have crypt support enabled, create an encrypted version of the password. This is done using the included mkpasswd.c program, which may or may not be included with this older deprecated release of icecast. Compile it using the following command: gcc -o mkpasswd mkpasswd.c. Consider using the the -lcrypt option.

encoder_password

Define the password used when initiating the encoder.

admin_password

The administrator password for managing the icecast server.

oper_password

Specify the password for any additional operators.

Directory Servers

A directory server is a "meta-server" where icecast administrators can list their own icecast server gratis. This promotes an individual's streaming audio server and encourages more listeners to connect. The touch_freq option states how often the directory server should "update" with information from the local icecast server, e.g. the number of listeners, stream information, etc.

icydir

The YP server or URL of the referencing directory server. Multiple listings using this option can be entered. State the audio servers on which your icecast server should be listed here in multiple instances.

directory

List the local directory name or URL.

touch_freq

State the update rate in minutes that information from the local icecast server should update the remote server.

Server IP/Port Configuration

If a hostname is not specified, icecast listens on all available interfaces, i.e. INADDR_ANY. This is probably what you want. If you want icecast to only listen on a specific IP address, change the "hostname" parameter. The "port" parameter is self-explanatory. As of icecast 1.3.x, all connections use port 8000. No more messing with three different ports in the firewall rules.

The server_name option is specified only here, and only when starting the server. Changing it later does not have the desired effect. The server_name specifies the hostname of the server, so do not set it to an IP address. Using an IP address will probably work, but it does look nicer with a unique hostname. Also, changing the port here does affect the server when doing a rehash since binding to a port is done only once; when the server is started.

Users on dialup connections with dynamic IPs will experience difficulties. They will have to live without the virtual hosts support. There is no portable way of getting all the IP addresses to which the process is binding. Either edit this file before starting icecast and fill in the current IP address, or simply live with it. Setting the value to "dynamic", will tell the icecast server that there is no reliable hostname for this machine.

Administrators may also use multiple ports. The default port is the first one defined. Define the port variable, and then port+1 for shoutcast compatibility.

hostname

List the hostname of the icecast server. This can either be its FQDN or its IP address. I personally prefer IP address. Only use a hostname that actually resolves to an IP address over which you are responsible.

port

Define the port number to be used by the icecast server. This is normally port 8000 but instances of ports 8001, 8010, 8100 and others have been used by others with success.

server_name

Define the server name here. This is where adminstrators define the Fully Qualified Domain Name.

Directory Server Options

Force the directory server to use the server_name value instead of the originating IP address. This is unnecessary for most people, since this value is the same. For individuals behind proxies, however, this should be very useful.

force_servername

This variable forces the server to use its fully qualified domain name or to use its IP address instead. A value of "0" states it should keep its IP address, while "1" forces the use of the server_name variable. A "0" value is the default setting.

Main Server Logfiles

These files specify the location of all icecast information regarding connections, warnings, errors, and so forth. This cannot be changed in the admin console, but changing it here and then rehashing the server does work.

logfile

The file defines the icecast logfile name or icecast.log. This file is stored by default in the /usr/local/icecast/logs directory. A typical example can show any of the following items; a timestamp, a PID of the current action, whether it's a Source Thread or a Connection Handler, whether a client was kicked off or accepted, the IP address of the client, the mountpoint of the connection, the connection's duration, the amount of data transferred to the listener, and the number of clients currently connected.

The following is a sample extract from a typical icecast.log file.

02/Aug/2005:20:13:32] [1644:Connection Handler] Kicking unknown 1640
[64.147.136.64] [Stupid headers], connected for 0 seconds
[02/Aug/2005:20:17:51] [204:Source Thread] Kicking client 1608
[148.78.243.24] [Client signed off] [listener], connected for 48 minutes
and 35 seconds, 5824497 bytes transfered. 22 clients connected
[02/Aug/2005:20:18:32] [1645:Connection Handler] Kicking unknown 1641
[64.147.136.64] [Stupid headers], connected for 0 seconds
[02/Aug/2005:20:19:10] [1646:Connection Handler] Accepted client 1642 from
[67.172.233.36] on mountpoint [/live]. 23 clients connected
[02/Aug/2005:20:20:29] [204:Source Thread] Kicking client 1589
[63.78.215.34] [Client signed off] [listener], connected for 1 hours, 15
minutes and 8 seconds, 9013151 bytes transfered. 22 clients connected
accessfile

This file or access.log is stored in the same directory as that of the icecast.log file. It tracks the IP address of the connecting client followed by the timestamp. It also processes the HTTP request along with the type of agent used for listening to the live stream. An entry is made to this log files once the listener disconnects.

The following is another sample extract from the access.log file.

68.147.115.147 - - [02/Aug/2005:19:59:24 -0600] "GET /live HTTP/1.0" 2002521748 "-" "NSPlayer/9.0.0.2980 WMFSDK/9.0" 1263
67.161.210.165 - - [02/Aug/2005:20:00:05 -0600] "GET /live HTTP/1.0" 2009681 "-" "iTunes/4.5 (Macintosh; N; PPC)" 9
24.10.239.8 - - [02/Aug/2004:20:01:53 -0600] "GET /live HTTP/1.0" 200 81530 "-" "NSPlayer/9.0.0.2980 WMFSDK/9.0" 44
67.161.210.165 - - [02/Aug/2005:20:02:04 -0600] "GET /live HTTP/1.0" 200236457 "-" "iTunes/4.5 (Macintosh; N; PPC)" 121
204.246.149.66 - - [02/Aug/2005:20:09:36 -0600] "GET /live HTTP/1.0" 2002575628 "-" "Xaudio/1.0" 1289
65.103.225.203 - - [02/Aug/2005:20:11:23 -0600] "GET /live HTTP/1.0" 200156522 "-" "Xaudio/1.0" 82
148.78.243.24 - - [02/Aug/2005:20:17:51 -0600] "GET /live HTTP/1.0" 2005824497 "-" "Windows-Media-Player/7.10.00.3068" 2915
63.78.215.34 - - [02/Aug/2005:20:20:29 -0600] "GET /live HTTP/1.0" 2009013151 "-" "NSPlayer/9.0.0.2980 WMFSDK/9.0" 4508
12.110.19.201 - - [02/Aug/2005:20:24:18 -0600] "GET /live HTTP/1.0" 20036584441 "-" "NSPlayer/9.0.0.2980 WMFSDK/9.0" 18294
205.188.116.15 - - [02/Aug/2005:20:24:59 -0600] "GET /live HTTP/1.0" 2004207530 "-" "NSPlayer/9.0.0.2980 WMFSDK/9.0" 2107
148.78.243.24 - - [02/Aug/2005:20:28:35 -0600] "GET /live HTTP/1.0" 2006136 "-" "NSPlayer/7.10.0.3059" 6
209.63.147.19 - - [02/Aug/2005:20:31:51 -0600] "GET /live HTTP/1.0" 200126218 "-" "xmms/1.2.10" 66
209.63.147.19 - - [02/Aug/2005:20:31:56 -0600] "GET /live HTTP/1.0" 200188445 "-" "WinampMPEG/5.0" 97
usagefile

This file or usage.log tracks the connections to the icecast streamer. It calculates the amount of bandwidth consumed and exactly the number of active connections.

The following is another sample extract from a typical usage.log file.

[02/Aug/2005:20:14:47] [2:Calendar Thread] [02/Aug/2005:20:14:47]
Bandwidth:0.050000MB/s Sources:1 Clients:23 Admins:1
[02/Aug/2005:20:16:47] [2:Calendar Thread] [02/Aug/2005:20:16:47]
Bandwidth:0.033333MB/s Sources:1 Clients:23 Admins:1
[02/Aug/2005:20:18:47] [2:Calendar Thread] [02/Aug/2005:20:18:47]
Bandwidth:0.050000MB/s Sources:1 Clients:22 Admins:1
[02/Aug/2005:20:20:47] [2:Calendar Thread] [02/Aug/2005:20:20:47]
Bandwidth:0.050000MB/s Sources:1 Clients:22 Admins:1
[02/Aug/2005:20:22:47] [2:Calendar Thread] [02/Aug/2005:20:22:47]
Bandwidth:0.033333MB/s Sources:1 Clients:22 Admins:1
[02/Aug/2005:20:24:47] [2:Calendar Thread] [02/Aug/2005:20:24:47]
Bandwidth:0.050000MB/s Sources:1 Clients:21 Admins:1
[02/Aug/2005:20:26:47] [2:Calendar Thread] [02/Aug/2005:20:26:47]
Bandwidth:0.066667MB/s Sources:1 Clients:20 Admins:1
[02/Aug/2005:20:28:47] [2:Calendar Thread] [02/Aug/2005:20:28:47]
Bandwidth:0.050000MB/s Sources:1 Clients:21 Admins:1
[02/Aug/2005:20:30:47] [2:Calendar Thread] [02/Aug/2005:20:30:47]
Bandwidth:0.033333MB/s Sources:1 Clients:23 Admins:1
[02/Aug/2005:20:32:47] [2:Calendar Thread] [02/Aug/2005:20:32:47]
Bandwidth:0.050000MB/s Sources:1 Clients:22 Admins:1
[02/Aug/2005:20:34:47] [2:Calendar Thread] [02/Aug/2005:20:34:47]
Bandwidth:0.066667MB/s Sources:1 Clients:22 Admins:1
logfiledebuglevel

The debugging level for all output to the main logfile. Specify the amount of debugging to perform on the logs. A higher value means more debugging output. "0" is equal to no debugging output, while "1" and "2" are sensible values, "3" and "4" generate quite a bit of debugging information. At the present time "6" is the current maximum.

consoledebuglevel

Set the debug level for all data being piped to the console. This is the same as logfiledebuglevel, but regulates the output on the icecast console.

Reverse Lookups

Perform reverse DNS lookups on all IP addresses connecting to the icecast server.

reverse_lookups

Leave the value at "0" to disable this feature. DNS lookups can slow down the streaming server's performance. Set this value to "1" if you wish all connecting IPs to be looked up using reverse lookup. Leave the value at "0" if you just want the IP addresses, which is slightly faster.

Console Mode

This option specifies how the icecast server is started, and how the icecast TTY is used when running the icecast server in console mode. This variable specifies the mode in which to display outputs to the icecast console.

console_mode

The value "0" means use it as a admin console. Admins can send commands to the icecast server with logfile info while in this mode. This is the default and recommended method of running the icecast server in console mode.

The value "1" is the same as 0 but without logfile info.

The value "2" means use the console as a logfile window.

The value "3" means place the icecast server in the background, as a daemon process.

All console modes are not available on all platforms.

Client Timeout

This section explains how to deal with clients when no encoder or streamer is connected.

client_timeout

Set the amount of seconds for clients to time out inactive connections.

A negative value means the server should keep clients forever.

A "0" or zero value means the server should kick them out instantly when the encoder or streamer dies.

A value of X that is greater than 0 means keep the clients connected for X seconds. This is useful is you need to restart the encoder or streamer periodically and do not wish to lose connected clients.

Kicking Clients

This variable explains how to disconnect clients if a connection goes inactive.

kick_clients

If this value is set to "1", then clients whose source has disconnected will be kicked off the server. If set to "0", they will simply be moved to another stream. This setting only has an effect if the variable client_timeout is <= 0.

Static File Directory

This enables HTTP file streaming support in icecast. If you don't want to go through the trouble of setting up apache or the web server of your choice, you can simply specify a directory here, and then your static file located at http://your_server:port/file/file.mp3 will be equivalent to the value /staticdir/file.mp3.

HTTP server support is very limited so do not attempt to do anything fancy until you have tested your configuration. Only .mp3 files will be displayed.

staticdir

Specify the local directory from which to stream static audio files. If streaming live audio or if raw audio is being piped into your soundcard, set this directory to /tmp.

Templates

The icecast server uses templates to format output for the web page list.cgi and for various other icecast-related errors. Specify the directory from which these are read using absolute paths when possible.

templatedir

If using templates for administrative purposes, define the template directory here. The default directory is /usr/local/icecast/templates.

Statistics

The icecast server keeps verbose statistics when running. View these either by using the stats command or by examining the contents of the file specified by the stats_log variable. Icecast regularly updates this file with listener statistics. It can easily be parsed to produce a nice output on a webpage on how many listeners are connected to the icecast server and so forth. This is generally done by using the list.cgi command within a web browser connected to the icecast server.

For example, to view listener statistics on a sample icecast server, place the following URL in a web browser: http://icecast.mydomain.com:8000/list.cgi.

The statshtml_log is updated regularly and the contents are created by parsing templates/statistics.html file. Administrators can edit this file by hand and create a custom statistics file.

logdir

Define the default logging directory. The default and recommended location is /usr/local/icecast/logs.

stats_log

If logging statistics, define a stats.log file here.

statshtml_log

Define a static HTML web page for displaying all statistics.

stats_time

Set the refresh rate for the statistics page. The default value is "60" and means to update the page every 60 seconds. A value of "0" means that no statistics should be dumped. A value of X that is greater than "0" means icecast should dump stats every X seconds to the file specified by the stats_log variable.

Aliases and Virtual Host Support

In icecast servers prior to the 1.3 release, a typical icecast server could function as a relay for another icecast server by simply acting as a client on the other server and then by serving audio to local clients. This was a quick and easy method of increasing the number of possible listeners to your broadcast. An administrator could build a tree-like structure of relays and broadcast to 1000 listeners without problem with the originating stream on a cable modem or on some other high speed Internet connection.

In icecast 1.3.0 and above, this procedure is made all the simpler. To relay a stream from another server, simply add an alias for that server. For example, to relay a broadcast originating from the identified as icecast.mydomain.com:8000/icecast through another machine simply enter the following value under the alias setting on the machine performing the relaying:

alias icecast http://icecast.mydomain.com:8000/icecast

What happens is that when a listeners connects to the local relay server and requests the /icecast stream, that icecast server connects as a client to the orginating icecast server or icecast.mydomain.com, and then feeds the original stream to the listener via the local "client" server.

All subsequent requests to the local server for the /icecast stream uses the same feed from then originating server, i.e. only one connection is made to the primary icecast server. Icecast automagically disconnects the link from the primary icecast server when no one is listening or is connected to the local server. In this manner no bandwidth is wasted.

The old functionality of adding a static relay is still available, but must still be done from the admin console. Type in the following command at the admin console:

relay pull http://icecast.mydomain.com:8000/

This site will now be accessible as the following:

http://your_machine:port/icecast.mydomain.com:8000/

This can be modified using the -m option to relay pull.

There is also a possibity of doing this the other way around, starting at the originating server and doing a "push". Simply type the following:

relay push <source_id> host:port

The primary stream is then relayed to a remote server. In theory, this should enable virtual host support, as users can then specify an alias in the following manner within the configuration file:

alias http://virtual.host.com:port/whatever /something

This forces all requests to virtual.host.com:port/whatever to use the stream /something. This has not been thorougly tested, but it should work if the server_name value is correctly set, and the client is sending the valid Host: <host:port> HTTP header.

Kick Relays

This section explains how long to keep aliased sources when no clients are left listening to it.

kick_relays

Disconnect relays after a set time. When a remote source is mounted into the icecast server on a remote alias request, it will only keep the source connected while there is still someone listening. When all listeners has disconnected, it will keep the source for kick_relays seconds, and then kick it out. This saves on bandwidth costs.

Transparent Proxy

This is equivalent to forcing all requests to aliased sources. Instead of adding an alias for all the streams throughout the world, enable transparent proxy support. Using this on a server with streams of its own can be quite tricky. As usual it is very important the server_name variable is correct.

Most MP3 clients have support for listing HTTP proxies, i.e. x11amp and winamp. If listeners set your machine as their proxy for their MP3 client and you enable transparent_proxy, when a client requests http://whatever.com:port/whatever, your icecast server then connects to the whatever.com icecast server and feeds the whatever-stream to the client. All subsequent requests for this stream also use the same feed, just as if it were an alias.

When running icecast with your own broadcasts, this option should be turned off or anyone can bring your network down with multiple relaying connects. Do not turn this option on if you don't have a proper and valid server_name variable set.

transparent_proxy

Set this value at "0" to disable transparent proxy. Change to "1" to enable transparent proxy requests.

Access Control Lists

Icecast has two different methods of limiting who connects to the server. The first is by using libwrap, tcpd, tcp wrappers, or whatever you want to call it. It is a separate library written by Wietse Venema that over the years has become more or less a security standard in Unix. It should compile on every sane Unix platform.

libwrap uses the files hosts.deny and hosts.allow, usually found in the /etc or /usr/local/etc directories. You normally must be root to edit these files. Try the man pages for tcpd and hosts_access for more information.

There are four different icecast control items to use in hosts.deny/allow. first, simply add "icecast", which controls all connections, and are enabled before anything is written or read on the socket. If a connection is denied here then the connection request is dropped. If allowed, then depending on the type of the connection whether it be admin or client or source, the controls "icecast_client", "icecast_admin", "icecast_source" describes who is allowed in. To deny all clients except those matching *.edu, add the following to the hosts.deny file:

icecast_client: ALL EXCEPT *.edu

There are many different variations on how to build a complete defence. libwrap is a very powerful tool. Consult the manpages for more information.

The second method, though not always available, is to use icecast's internal acl lists. The functionality is the same, but it is not as powerful as libwrap when it comes to configuration and flexibilty. Specify acl rules either here in the icecast.conf file, or by using the admin console.

The acl syntax in icecast.conf is as follows:

allow <all|client|source|admin> <hostmask>
deny >all|client|source|admin> <hostmask>

When using a variation on the same rule as shown above, or by allowing only clients from *.edu domains, here is how acl rules would be added to the icecast.conf file or via the admin console:

deny <client> *
allow <client> *.edu

When using internal acl rules under icecast, specify a policy. This rule kicks in when there is no allow or deny rule affecting a connection. If you set the acl_policy variable to "0", connections that are not allowed by any allow rule are then denied. The same applies the other way around if the variable is set to "1".

acl_policy

If you wish to set any Access Control Lists (ACLs), enable this feature here.

Consult the comments included with the default configuration file for any additional items or information. Be aware that this icecast release is deprecated and is no longer supported by the icecast development team. Consult the included documentation files in regards to any questions you may have about these configuration items.