Working with the network Script

When your server boots, it starts the network script from /etc/init.d. This script reads the configuration that is stored in the /etc/sysconfig/network directory. In this directory, for every network interface there is a configuration file that can be recognized by the MAC address that is in the name of the file. For example, the network board with the MAC address 00:0c:29:c7:82:f6 has the name ifcfg-eth-id-00:0c:29:c7:82:f6. This configuration file stores the entire configuration of the network board. Listing 13-1 shows what a configuration looks like for an Ethernet network card that uses a fixed IP address.

Listing 13-1. Example Configuration for a Network Board

BOOTPROTO='static' BROADCAST= ' ' ETHTOOL_OPTIONS=' ' IPADDR= '192.168.1.125' MTU=' '

NAME='AMD PCnet - Fast 79C971'

NETMASK='255.255.255.0'

REMOTE_IPADDR=' '

STARTMODE='auto'

UNI0UE='rBUF.weGu09ywYPF'

USERCONTROL='no'

Now that you know where YaST stores its configuration, you can change it directly in this file. For example, if you want to change the IP address of your network card quickly, then change it in this file and restart the network card (rcnetwork restart); it will work immediately.

Tip When duplicating virtual machines in a VMware environment, you may encounter the situation that a new MAC address is generated for the virtual machine but this configuration file still has its old name. In that case, the name of the file and the MAC address of the machine that should use it don't match, and as a result, the network card can't be initialized. You can solve this problem by renaming the file so that it reflects the new MAC address that is used by your network card. The network card that your virtual machine is using is in the readable text file with the extension .vmx for your virtual machine.

As stated, you can use the /etc/init.d/network script to bring the network up or down. However, this method has a disadvantage; it brings up or down all network interfaces, and this is not always what you want. To change the status of just one network interface and not all of them, use one of the methods described next.

Was this article helpful?

0 0

Post a comment