Linux 7 Configuring a Network Interface: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 54: Line 54:


<pre>
<pre>
DEVICE=eth0
HWADDR="08:00:27:CD:3F:EE"
IPADDR="172.20.1.3"
IPADDR="172.20.1.3"
PREFIX="16"
NETMASK="255.255.0.0"
NETMASK="255.255.0.0"
PREFIX="16"
HWADDR="08:00:27:CD:3F:EE"
</pre>
</pre>



Revision as of 03:11, 4 April 2017

External

Internal

Overview

The configuration files corresponding to the network interfaces are located in /etc/sysconfig/network-scripts.

ifcfg-eth0 example:

DEVICE="eth0"
NAME="eth0"
TYPE="Ethernet"
ONBOOT="yes"
IPADDR="192.168.1.9"
NETMASK="255.255.255.0"
PREFIX="24"
GATEWAY="192.168.1.1"
DNS1="192.168.1.1"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_PRIVACY="no"

Configuration

IPADDR

NETMASK

PREFIX

UUID

HWADDR

Specifying the hardware or MAC address using the HWADDR directive will influence the device naming procedure.

DEVICE

Change the IP Address

DEVICE=eth0
HWADDR="08:00:27:CD:3F:EE"
IPADDR="172.20.1.3"
PREFIX="16"
NETMASK="255.255.0.0"

Configure a Network Interface after Cloning a VM Image

You want to generated a different Mac address when cloning an image, to avoid collisions.

If "HWADDR" is set pointing to the old hardware address, we want to remove it from the cloned configuration file, because if it stays there, and the hardware address is not available, the interface won't start.