Tech Nuske

Tech Nuske

Thursday, 26 April 2012

IFCONFIG - changing interface configuration


Ifconfig is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed.
If no arguments are given, ifconfig displays the status of the currently active interfaces. Just type ifconfig on your linux terminal and check the interface on your system. The output is a list of details about the interface itself, like its IP address, MAC and its status, whether it is up or not. If a single interface argument is given, it displays the status of the given interface only.
Eg. You can write ifconfig eth0 to display information of that interface only.
 If a single -a argument is given, it displays the status of all interfaces, even those that are down. Otherwise, it configures an interface.
Now comes the fun part, you can change the status of your interfaces using this command
Ifconfig eth0 up  -  puts eth0 interface up.
Ifconfig eth0 down – puts it down back.
Suppose you have two network interface cards, and you want that all the data be routed through only one of those interfaces, you can put one of them down, and direct all packets via the other one.
Now suppose you want to set the IP address of any interface, all you need to do is:
Ifconfig eth0 10.102.1.3 netmask 255.255.255.0 up
And its done.
Now to change the MAC, you need the option ‘hw class’
Ifconfig eth0 hw class aa:08:ff:ee:12:50
This command also allows you to change the broadcast address, IP for a point to point link, multicast address, mtu, IPv6 address etc.

- Joohi Sinha
Stay tuned for more...


No comments:

Post a Comment