Red hat enterprise Linux : configure the network card
You can configure network card by editing text files stored in /etc/sysconfig/network-scripts/directory. First change directory to /etc/sysconfig/network-scripts/:
# cd /etc/sysconfig/network-scripts/
You need to edit / create files as follows:
- /etc/sysconfig/network-scripts/ifcfg-eth0 : First Ethernet card configuration file
- /etc/sysconfig/network-scripts/ifcfg-eth1 : Second Ethernet card configuration file
To edit/create first NIC file, type command:
# vi ifcfg-eth0
Append/modify as follows:
# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=static
DHCPCLASS=
HWADDR=00:30:48:56:A6:2E
IPADDR=10.10.29.00
NETMASK=255.255.255.192
ONBOOT=yes
Save and close the file. Define default gateway (router IP) and hostname in /etc/sysconfig//network file:
# vi /etc/sysconfig/network
Append/modify configuration as follows:
NETWORKING=yes
HOSTNAME=www1.seafer.co.id
GATEWAY=10.10.29.00
Save and close the file. Restart networking:
# /etc/init.d/network restart
Make sure you have correct DNS server defined in /etc/resolv.conf file:
# vi /etc/resolv.conf
Setup DNS Server as follows:
nameserver 10.0.80.xx
nameserver 10.0.80.xx
nameserver 202.67.222.xxx
Save and close the file. Now you can ping the gateway/other hosts:
$ ping google.com
Output:
PING google.com (74.125.71.103) 56(84) bytes of data. 64 bytes from hx-in-f103.1e100.net (74.125.71.103): icmp_seq=1 ttl=56 time=63.7 ms 64 bytes from hx-in-f103.1e100.net (74.125.71.103): icmp_seq=2 ttl=56 time=63.7 ms 64 bytes from hx-in-f103.1e100.net (74.125.71.103): icmp_seq=3 ttl=56 time=49.8 ms
You can also check for Internet connectivity with nslookup or host command:
$
nslookup google.com
Output:
Non-authoritative answer: Name: google.com Address: 74.125.71.106 Name: google.com Address: 74.125.71.147 Name: google.com Address: 74.125.71.99 Name: google.com Address: 74.125.71.103 Name: google.com Address: 74.125.71.104 Name: google.com Address: 74.125.71.105
You can also use host command:
$ host google.com
Output:
google.com has address 74.125.71.99 google.com has address 74.125.71.103 google.com has address 74.125.71.104 google.com has address 74.125.71.105 google.com has address 74.125.71.106 google.com has address 74.125.71.147 google.com mail is handled by 10 aspmx.l.google.com. google.com mail is handled by 20 alt1.aspmx.l.google.com. google.com mail is handled by 30 alt2.aspmx.l.google.com. google.com mail is handled by 40 alt3.aspmx.l.google.com. google.com mail is handled by 50 alt4.aspmx.l.google.com.
Leave a Reply