A Standard Linux Network Configuration
A very common setup for a Linux system is to have a single Ethernet interface and be a member of a network, as either a client, a server, or both. Here are the network settings that must be configured in order for a Linux system to communicate via TCP/IP over an Ethernet network:
A compatible Ethernet card must be installed and recognized by the kernel. See information about the commands lsmod, lspci, and dmesg in previous chapters for more information about hardware troubleshooting.
An IP address and subnet mask must be assigned to the Ethernet interface (eth0). These can be assigned manually (static values saved in a configuration file) or assigned from a DHCP server on the local subnet. On RPM-based systems such as CentOS, Red Hat, and Fedora Linux, the network configuration file is /etc/sysconfig/network-scripts/ifcfg-eth0. Values from this file are read by the startup script /etc/init.d/network, which in turn calls the command ifconfig with the appropriate values.
In order to communicate with other subnets, a default gateway route must be configured. This is the IP address of the device on the local network that will send your packets on to other networks. This may be a dedicated device, such as a router, or it may be a general-purpose computer (with multiple Ethernet cards) running routing software. A lower-end PC running Linux is often a good choice for a router in this instance. The default gateway route is defined in the file /etc/sysconfig/network. ...