Configuring interfaces at Linux

We can configure the interfaces at Linux in many ways. Let us talk about Debian first. In Debian we have to edit the file /etc/network/interfaces . We can edit the file with the following command:

vi /etc/network/interfaces

If there is no configured interfaces, then the file will be like:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

Here we have to add the interfaces. We must have to add like the following commands. In the following lines I have added two interfaces.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 221.120.96.233
netmask 255.255.255.224
network 221.120.96.224
broadcast 221.120.96.255
gateway 221.120.96.225

auto eth1
iface eth1 inet static
address 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255

At RedHat we can configure interfaces in many ways. Some ways are given below.

1. netconfig This command will open a window for configuring IP addresses just like windows.

Remind one thing, this command will configure interface eth0 automatically.

2. netconfig -d eth0 This command will open window for configuring eth0 interface. If we write eth1 instead of eth0, then the command will configure eth1 interface.

3. netconfig –device eth0 This command will work exactly as number 2 way.

4. setup This command will open a window containing a list of some option.

We have to choose network setup option here. After that the window just like netconfig command will appear.

5. We can also configure like Debian also. For this we have to go in the /etc/sysconfig/network-scripts/ directory. We can do this using the following command.

cd /etc/sysconfig/network-scripts/

Then we can view the list of file and directory name by using the ls command. If any interface is configured then we will find a file regarding that interface. If eth0 is configured then there will be a file named ifcfg-eth0 . If eth1 is configured then there will be a file named ifcfg-eth1 . We can edit these files with vi command.

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

Then we have write the following lines.

# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)

DEVICE=eth0

BOOTPROTO=static

HWADDR=12:34:56:78:9A:BC

IPADDR=10.10.29.66

NETMASK=255.255.255.192

And always remember one thing we have to must restart the interface. Otherwise after restarting the pc configuration will be removed. At Debian we can restart the interface with following command:

/etc/init.d/networking restart

At Redhat we can restart the interface with following command:

Way 1. /etc/init.d/network restart

Way2. service network restart

Wish to get advices related this issue.

About these ads

1 Comment »

  1. Sajjad Ali said

    Good work Reza, keep it up.

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: