Archive for November, 2010

Centos Network Hints

0

The following is a sample ifcfg-eth0 file for a system using a fixed IP address:

DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
NETWORK=10.0.1.0
NETMASK=255.255.255.0
IPADDR=10.0.1.27
USERCTL=no

The values required in an interface configuration file can change based on other values. For example, the ifcfg-eth0 file for an interface using DHCP looks different because IP information is provided by the DHCP server:

DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes

The Network Administration Tool (system-config-network) is an easy way to make changes to the various network interface configuration files (refer to Chapter 14, Network Configuration for detailed instructions on using this tool).

However, it is also possible to manually edit the configuration files for a given network interface.

Below is a listing of the configurable parameters in an Ethernet interface configuration file:

BOOTPROTO=

where is one of the following:

*

none — No boot-time protocol should be used.
*

bootp — The BOOTP protocol should be used.
*

dhcp — The DHCP protocol should be used.

BROADCAST=

where

is the broadcast address. This directive is deprecated, as the value is calculated automatically with ifcalc.
DEVICE=

where is the name of the physical device (except for dynamically-allocated PPP devices where it is the logical name).
DHCP_HOSTNAME

Use this option only if the DHCP server requires the client to specify a hostname before receiving an IP address.
DNS{1,2}=

where

is a name server address to be placed in /etc/resolv.conf if the PEERDNS directive is set to yes.
ETHTOOL_OPTS=
where
are any device-specific options supported by ethtool. For example, if you wanted to force 100Mb, full duplex:

ETHTOOL_OPTS=”autoneg off speed 100 duplex full”

Note

Changing speed or duplex settings almost always requires disabling autonegotiation with the autoneg off option. This needs to be stated first, as the option entries are order-dependent.
GATEWAY=

where

is the IP address of the network router or gateway device (if any).
HWADDR=

where is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:FF. This directive is useful for machines with multiple NICs to ensure that the interfaces are assigned the correct device names regardless of the configured load order for each NIC’s module. This directive should not be used in conjunction with MACADDR.
IPADDR=

where

is the IP address.
MACADDR=

where is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:FF. This directive is used to assign a MAC address to an interface, overriding the one assigned to the physical NIC. This directive should not be used in conjunction with HWADDR.
MASTER=

where is the channel bonding interface to which the Ethernet interface is linked.

This directive is used in conjunction with the SLAVE directive.

Refer to Section 13.2.3, “Channel Bonding Interfaces” for more information about channel bonding interfaces.
NETMASK=

where is the netmask value.
NETWORK=

where

is the network address. This directive is deprecated, as the value is calculated automatically with ifcalc.
ONBOOT=

where is one of the following:

*

yes — This device should be activated at boot-time.
*

no — This device should not be activated at boot-time.

PEERDNS=

where is one of the following:

*

yes — Modify /etc/resolv.conf if the DNS directive is set. If using DHCP, then yes is the default.
*

no — Do not modify /etc/resolv.conf.

SLAVE=

where is one of the following:

*

yes — This device is controlled by the channel bonding interface specified in the MASTER directive.
*

no — This device is not controlled by the channel bonding interface specified in the MASTER directive.

This directive is used in conjunction with the MASTER directive.

Refer to Section 13.2.3, “Channel Bonding Interfaces” for more about channel bonding interfaces.
SRCADDR=

where

is the specified source IP address for outgoing packets.
USERCTL=

where is one of the following:

*

yes — Non-root users are allowed to control this device.
*

no — Non-root users are not allowed to control this device.

Comma Usage

0

http://theoatmeal.com/comics/semicolon

Go to Top