Table of Contents

IP Address

Temporary

# ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up

Permanent

# cd /etc/sysconfig/networking/devices
# vi ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0C:29:DE:94:8B
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
NETMASK=255.255.255.0
IPADDR=192.168.0.100
GATEWAY=192.168.0.1
# cd /etc
# vi resolv.conf
search your-dns-search-path
nameserver dns1-ip-address
nameserver dns2-ip-address
nameserver dns3-ip-address
# ifdown eth0
# ifup eth0

Redhat 7.X

ifconfig

The minimal install does not include ifconfig. To install ifconfig run the following:

yum install net-tools

EnsXXX

In Redhat 7.X, the interface naming convention has changed from ethX to EnsXXX. To restore the default behavior, do the following:

  1. Edit /etc/default/grub to add the lines to the kernel paramaters:
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
  1. grub2-mkconfig -o /boot/grub2/grub.cfg
  2. Rename /etc/sysconfig/network-scripts/ifcfg-enXXX to ifcfg-eth0
  3. Set Name=eth0 and Device=eth0 in /etc/sysconfig/network-scripts/ifcfg-eth0
  4. reboot