Linux Network Configurations

Using ifconfig (obsolete and replaced by ip but it still works):
Synopsis: ifconfig ethX {address | up | down }
ifconfig ethX address #Assign an ip address.
more info on ifconfig

ip address can also be setup by editing ifcfg-ethX
vi /etc/sysconfig/network/ifcfg-eth0 #editing eth0 in openSUSE.
vi /etc/sysconfig/network-scripts/ifcfg-eth0 #editing  eth0 in RHEL 6.
Add: IPADDR=’x.x.x.x/x’ # Example: IPADDR=’192.168.1.7/24′

Using ip:
Synopsis: ip { link | addr | help} #common options use.
Examples:
ip link #shows the status of all NICs.
ip addr #shows the ip address of all NICs.

ip link set ethX { {up | down} | address | mtu | name }
Examples:
ip link eth2 up #enable eth2.

To configure gateway, use route.
route add default gw x.x.x.x #adding default gateway
route add -net x.x.x.x netmask x.x.x.0 dev ethX #gateway for specific NIC
route -e # To view Kernel IP routing table (route -n works also).

Ethtool – Display or change ethernet card settings.
Synopsis: ethtool ethX
ethtool –i ethX #shows the version of the NIC driver.