How to Configure Network Interfaces in Linux

First, use ifconfig -a to check which interface is in use. The following example uses eth0 to configure the settings:

#Edit:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
Contents
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.25
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
ONBOOT=yes
DNS1=8.8.8.8
DNS2=8.8.4.4
 
You can also set the DNS separately as follows: Open /etc/resolv.conf and fill in the DNS servers according to your situation:
 nameserver 8.8.8.8
 nameserver 8.8.4.4
The command to restart the network card is:
service network restart

Network card activation command:

ifup eth0

Leave a Comment

Your email address will not be published.