Linux, like it's UNIX parents, was designed to be networked.
Static IP vs. DHCP
/etc/sysconfig/network-scripts/ifcfg-<foo> for the interface configuration. <foo> will be eth0, eth1, bond0, wlan0 (for wireless). A file for eth0 running DHCP looks like
The full list of configurable parameters from RedHat's networking site is
The DEVICE= line must match the device name in the ifcfg-<device> filename.
It is also possible to have virtual interfaces (VIP). Simply create an ifcfg-eth0:1 file with the device named eth0:1. It can have separate IP space from the physical device. The parameters that refer to hardware should be excluded from the ifcfg- file for VIPs as it makes no sense.
DNS is configured using the
/etc/resolv.conf file. Note the misspelling (missing "e" on the end). For system using DHCP, DNS is usually handled automatically by the dhclient process as seen here:
The first line begins with a ";" which is a valid comment as is "#". The
search line defines the default domain to append to a bare host name. The rest is simply the nameservers to use in order of preference.
Firewalling with iptables
iptables is a very potent firewall process. It uses configuration files found in
/etc/sysconfig/ and includes both an IPv4 and IPv6 configuration. The
ip6tables-config are high-level configuration files controlling the general operation of iptables. The
ip6tables files contain the actual rules used for the process when it is started by init. The rules files are only rw for the root user for security reasons. The iptables howto on the CentOS wiki is an excellent starter for iptables fundamentals. The RHEL 5.5 Firewall pages and the RHEL 5.5 iptables pages are essential reading for a solid background.
Commands for network control and informationThe network system(s) will typically start at boot time from the init scripts.
/etc/init.d/networkcontrols the start and stop of the networking while
/etc/init.d/NetworkManageris used (in RHEL5) to make the best connection the default one for use. As is expected for init scripts, they typically require being run as root:
/etc/init.d/<script> start|stop|restart|status. Another way is
service <init script> start|stop|restart|status
Occasionally only a single network interface needs to be stopped or started.
ifconfig <interface name> up|down
Networking tools and testing
pingping is a first line check to see if a system is network-alive.
ping -c 1 <host>will send a single icmp request