Network Configuration

From wiki.emacinc.com
Jump to: navigation, search
TODO: {{#todo:SEOKWREV (11.25.13-16:00->KY+);(11.26.13-19:30->MD+);(12.20.13-11:05->MW+);(03.04.14-15:30->BS-);(03.14.14-16:15->BS-);(03.17.14-15:20->BS+)|Klint Youngmeyer|oe 4,oe 5,ky,SEOKWREV,md,mw,bs}}

Linux is built with extensive networking capability, making it an ideal choice for a server. EMAC OE Linux includes a large range of networking options. Reliable network connections can be made easily, and many configuration options are available to suit the user's needs.

Network configuration is handled dynamically using a daemon called ifplugd, which manages automatic configuration of network connections based on the connection state. ifplugd automatically calls ifup to bring up the network interface when a link is detected and ifdown to deconfigure the interface when a network link is lost.. Network configuration options are read from the file /etc/network/interfaces by ifup and ifdown. As with most Linux systems, the default network interface is named eth0 unless otherwise noted for a particular hardware combination.

Network Interface Settings

The /etc/network/interfaces file holds the configuration settings for all interfaces on the system. Modify this file to change the way the system connects to the network. For information on how to edit a file directly on an EMAC OE system, please see this page. Each physical interface may be configured for static addressing or DHCP. On most systems, the default /etc/network/interfaces file looks like this:

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

Depending on the hardware, there may be additional entries for other interfaces, such as a second Ethernet interface or wireless connection. The first entry for the interface named "lo" is the local loopback interface -- a virtual network interface for local communication. The "eth0" entry controls the settings for the first network interface. The first line: allow-hotplug eth0 indicates that the connection should be managed dynamically by ifplugd and not automatically brought up by the system (as it would if the line read auto eth0). The second line iface eth0 inet dhcp indicates that the interface should be configured by DHCP.

Static Network Configuration

Depending on the network the system will connect to, it may be necessary to configure the board to use a static IP address rather than to acquire one using DHCP. This can be done by editing the eth0 configuration entry in /etc/network/interfaces. The following settings may be used for this configuration:

  1. address: The static IP address.
  2. netmask: The subnetwork mask.
  3. broadcast: The broadcast address (generally not required).
  4. gateway: The default gateway.

An example of a valid static network configuration for eth0 is shown below:

allow-hotplug eth0
iface eth0 inet static
    address 10.0.2.41
    netmask 255.255.255.0
    gateway 10.0.2.1

Once the static IP configuration has been set, the Domain Name System (DNS) resolver configuration should also be changed to match the network that the system is on. When the system is set to DHCP, this information is set automatically by the DHCP client. The resolver configuration is stored in the file /etc/resolv.conf. Because /etc/resolv.conf must be volatile to allow the DHCP client to make changes while the root filesystem is read-only, it is a symbolic link to the file /var/run/resolv.conf, which is stored in a ramdisk. On each system boot, the networking initialization script copies the contents of the default configuration /etc/default/resolv.conf to /var/run/resolv.conf. To make persistent changes to the static resolver configuration, edit /etc/default/resolv.conf directly.

The resolver configuration generally consists of one to three nameserver entries and a domain entry, though other options may be specified (see resolv.conf man page for more information). The example below shows a valid configuration:

nameserver 10.0.2.1
domain emacinc.com



Disabling Telnet

Telnet comes enabled by default for easy initial access but should be disabled when practical, as it is extremely insecure. EMAC recommends using SSH for all network sessions, particularly if the system is open to the Internet.

To disable the Telnet server, comment out the directive in the /etc/inetd.conf configuration file as in the example below. Note that this setting will not take effect until the system is rebooted or the inetd server is manually restarted.

#:STANDARD: These are standard services.
ftp             stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/ftpd
#telnet          stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/telnetd

Next Steps

Now that your EMAC OE system is set up, it is time to begin software development.