RedHat – Network interface configuration (static,dynamic,virtual)

Below you will find examples of configuration files for static and dynamic network interface configuration:

At first you need to have set  NETWORKING=yes in /etc/sysconfig/network file!

1.  Static configuration:

cat /etc/sysconfig/network-scripts/ifcfg-eth1

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth1
BOOTPROTO=static
BROADCAST=10.10.10.255
HWADDR=00:0C:29:26:9C:D8
IPADDR=10.10.10.7
NETMASK=255.255.255.0
NETWORK=10.10.10.0
ETHTOOL_OPTS=”autoneg off speed 100 duplex full”
ONBOOT=yes

ETHTOOL_OPTS – allow us to manually configure interface speed and duplex

2. Dynamic configuration:

cat /etc/sysconfig/network-scripts/ifcfg-eth1

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth1
BOOTPROTO=dhcp
HWADDR=00:0C:29:26:9C:D8
ONBOOT=yes

3. Virtual interface configuration:

cat /etc/sysconfig/network-scripts/ifcfg-eth1:1

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth1:1
BOOTPROTO=none
IPADDR=10.10.10.8
NETMASK=255.255.255.0
ONBOOT=yes

To manage our net interfaces we can use commands:

ifup <interface> – enable and configure interface using settings from file: /etc/sysconfig/network-scripts/ifcfg-<interface>

ifdown <interface> – disable interface

ifconfig -a, ip -s link show <interface>, ip addr show <interface> – displays interface status and configuration

mii-tool <interface> – display speed and duplex settings

Leave a Response