Tuesday, November 8, 2011

How to configure network interface on Redhat

Interface name starts with ethx on redhat. If you have nore than 1 interface it starts like eth0, eth1 and so on.h1 and so on.


1. List the plumbed interfaces.
# ifconfig

2. If IP is not assigned, use ifconfig command to assign.
# ifconfig eth0 192.168.0.155 up

3. To bring the interface down.
# ifconfig eth0 down

4. To configure the interface using GUI
# system-config-network


5. If you want to make it permanent, edit the interface file on /etc/sysconfig/network-scripts/ifcfg-eth0. i.e. interface instance is eth0

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
ONBOOT=yes
USERCTL=no
BOOTPROTO=none
NETMASK=255.255.255.0
IPADDR=192.168.0.155
PEERDNS=no

check_link_down() {
return 1;
}
GATEWAY=192.168.0.1
TYPE=Ethernet
HWADDR=00:00:00:00:00:00

# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.0.155 Bcast:195.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::250:56aa:febe:7a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:65734108 errors:0 dropped:0 overruns:0 frame:0
TX packets:29311081 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26973738977 (25.1 GiB) TX bytes:24118414406 (22.4 GiB)



6. Check the entry on network file.
# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
IPV6INIT=no
HOSTNAME=devi.bhusal.com
NOZEROCONF=yes

7. If you want to restart network services use the following command. If you are changing the hostname on the server, you have to reboot the server.
# service network restart

8. Verify the ip address, routing information.
# ifconfig -a
# route -rn


9. If you want to use configuration window, run the following command at the prompt.
# system-config-network

10. If you want to set up a dns, you have to add entry on nsswitch.conf file..
1. vi /etc/nsswitch.conf

hosts: files dns

2. Add entry on /etc/resolv.conf file

NOTE: Starting Redhat 6 EP, you can use dns on interface file as follow,

DNS1=192.168.0.125

3. Use dig command to verify the dns information..
# dig devi.bhusal.com

if you get problem, ping the server.
# ping devi.
if you still get issue resolve your ip issue and dns issue second.

No comments:

Post a Comment