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. The
ifconfig command simply is used
for displaying current network configuration information, setting up an ip
address along with netmask or broadcast address to network interface, creating
an alias for network interface as well setting up hardware address and enable
or disable network interfaces.
Here is basic usages of ifconfig
command based on scenario
Ø
To view all activated network interfaces
root@server-82:~#
ifconfig
Ø To view the all network interface
root@server-82:~# ifconfig -a
Ø 3. To view specific network interface
root@server-82:~# ifconfig eth0
Ø 4. How to enable/disable network interface
root@server-82:~# ifconfig eth0 up or ifup eth0
root@server-82:~# ifconfig eth0 down or ifdown eth0
Ø To assign a Ip address/netmask
to network interface
root@server-82:~#
ifconfig eth0 10.10.10.1 netmask 255.255.255.0
Please note that the previous ip address of network interface will overlapped
with this new ip address assigned and is will temporarily assigned. If you donot want to change in its network configuration file for permanently assigned, you can put it in /etc/rc.local file for startup automatic ip address setup.
with this new ip address assigned and is will temporarily assigned. If you donot want to change in its network configuration file for permanently assigned, you can put it in /etc/rc.local file for startup automatic ip address setup.
Ø To assign a broadcast address
root@server-82:~#
ifconfig eth0 broadcast 10.10.10.255
Ø To change MTU for an network interface
root@server-82:~# ifconfig eth0
mtu 1454
Ø To enable/disable promiscuous mode
Generally when a packet is received by a network card, it verifies whether the packet belongs to itself or not, if not then it drops the packet however in promiscuous mode, the network card will accept all the packets passed through it.
root@server-82:~# ifconfig eth0 promisc (for enable)
root@server-82:~# ifconfig eth0 –promisc ( for disable)
Ø To add/remove new alias to network interface
The alias is needed when we need multiple range of ips in single interface or
when you are making your network interface using as trunk for manageable switch.
root@server-82:~# ifconfig eth0:0 10.11.11.1 netmask 255.255.255.0
Ø To change mac address of network interface
root@server-82:~# ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF
No comments :
Post a Comment