(1) Cent OS Linux
(2) Fedora Core Linux
(3) Red Hat Enterprise Linux (RHEL) 3/4/5
Method # 1: GUI tool system-config-network
# system-config-network & |
Method # 2: Command line tool system-config-network-tui
If you don’t have X windows GUI installed type the following command at shell prompt:
# system-config-network-tui & |
Method #3: Edit configuration files stored in /etc/sysconfig/network-scripts/
You can configure network card by editing text files stored in /etc/sysconfig/network-scripts/ directory.
1) /etc/sysconfig/network-scripts/ifcfg-eth#
Where # can be 0 ,1 ,2 .. .. depending on the number of Ethernet Adapter or NIC
2) /etc/sysconfig/network
In this tutorial you will use the following Internet Protocol Version 4 (TCP/IPv4) Properties including IP,default gateway, and preferred DNS servers as an example:
IP Address : 192.168.1.10Netmask: 255.255.255.0Hostname: server.vjetnamnet.comDomain name: vjetnamnet.comGateway IP: 192.168.1.1DNS Server 1: 8.8.8.8DNS server 2: 8.8.4.4 |
Task 1 : Edit the file /etc/sysconfig/network as below example using vi:
# vi /etc/sysconfig/network |
NETWORKING=yesHOSTNAME=server.vjetnamnet.comGATEWAY=192.168.1.1 |
Task 2: Edit /etc/sysconfig/network-scripts/ifcfg-eth0 as below example using vi and assign “StaticIP Address” “192.168.1.10″:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0 |
DEVICE=eth0BOOTPROTO=staticTYPE=EthernetHWADDR=00:50:56:97:02:FDIPADDR=192.168.1.10NETMASK=255.255.255.0GATEWAY=192.168.1.1BROADCAST=192.168.1.255ONBOOT=yesDNS1=8.8.8.8DNS2=8.8.4.4PEERDNS=yesNM_CONTROLLED=yes |
Explanations:
DEVICE: Specifies the device to use for the configuration.
IPADDR: The static IP for the network interface
NETMASK: The network mask for the device
HWADDR: The MAC address for the device
NM_CONTROLLED: Determines if the device can be controlled by the network manager.
ONBOOT: Determines if the device should be initialized when booted
DNS1: Specifies the DNS server for the device. This is needed for name resolution. You may also add DNS2 and DNS3 if you have additional servers.
Task 3: Edit /etc/resolv.conf and setup DNS servers as below example using vi:
# vi /etc/resolv.conf |
search vjetnamnet.comnameserver 192.168.1.1nameserver 8.8.8.8nameserver 8.8.4.4 |
Task 4: Restart the network services
# service network restart |
Task 5 : Verify new “Static IP Address” configuration for eth0 as below:
# ping server.vjetnamnet.com# ifconfig eth0# ping google.com |
