Thursday, March 29, 2007

Configuring Network Script

If you don't have any network cards, you are most likely not going to create any configuration files relating to network cards. If that is the case, you must remove the network symlinks from all the runlevel directories (/etc/rc.d/rc*.d)

Configuring default gateway
If you're on a network you may need to setup the default gateway for this machine. This is done by adding the proper values to the /etc/sysconfig/network file by running the following:


cat >> /etc/sysconfig/network << "EOF"
GATEWAY=192.168.1.2
GATEWAY_IF=eth0
EOF


The values for GATEWAY and GATEWAY_IF need to be changed to match your network setup. GATEWAY contains the IP address of the default gateway, and GATEWAY_IF contains the network interface through which the default gateway can be reached.

Creating network interface configuration files
Which interfaces are brought up and down by the network script depends on the files in the /etc/sysconfig/network-devices directory. This directory should contain files in the form of ifconfig.xyz, where xyz is a network interface name (such as eth0 or eth0:1)
If you decide to rename or move this /etc/sysconfig/network-devices directory, make sure you update the /etc/sysconfig/rc file as well and update the network_devices by providing it with the new path.
The following command creates a sample ifconfig.eth0 file:

cat > /etc/sysconfig/network-devices/ifconfig.eth0 << "EOF"
ONBOOT=yes
IP=192.168.1.1
NETMASK=255.255.255.0
BROADCAST=192.168.1.255
EOF


Of course, the values of those variables have to be changed in every file to match the proper setup. If the ONBOOT variable is set to yes, the network script will bring it up during boot up of the system. If set to anything else but yes it will be ignored by the network script and thus not brought up.

1 comment:

tanda tanda kehamilan said...

Very useful post. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up.

Related Titles

 
visitors since March 26 2007
©2007