Assign a static IP to your Red Hat server
After completing this tutorial you will have a static IP assigned to your Red Hat server
Login to your Red Hat server via SSH and run the following command:
nano /etc/sysconfig/network-scripts/ifcfg-eth0
This will load the file that contains the configuration options for eth0. You will see something similar to this:
DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes TYPE=Ethernet
In order to switch from DHCP to a static IP address, we need to change a few of these values. In the following example, you will need to change the values so they match your network:
DEVICE=eth0 BOOTPROTO=static IPADDR=192.168.168.222 BROADCAST=192.168.168.255 NETWORK=192.168.168.0 NETMASK=255.255.255.0 ONBOOT=yes TYPE=Ethernet
In this file, we changed the BOOTPROTO configuration option and we added the IPADDR, BROADCAST, NETWORK, and NETMASK options. Leave everything else as is. Once you have updated this file to reflect your network settings, save the file by hitting Ctrl-O and then exit nano by hitting Ctrl-X. Now we need to restart the network service by running the following command:
service network restart
Once the service has been restarted run ifconfig and make sure the IP address has been assigned to the adapter.
What's Next
This is what was achieved and what was omitted in this tutorial.
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Copyright © 2011 MindTouch, Inc. Powered by