Linux - Network                                 Home : www.sharetechnote.com

 

 

 

View the current  NIC configuration

 

Example : # ifconfig

 

Example : # ifconfig eth0

    eth0 : Network Interface Card Name (you can figure out this name for your PC by 'ifconfig'

 

 

Assign an IP address for a network interface card (NIC)

 

Example : # ifconfig eth0 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255 up

    eth0 : Network Interface Card Name (you can figure out this name for your PC by 'ifconfig'

    192.168.1.2 : IP address to be assigned for the NIC

    netmask 255.255.255.0 : set subnet mask to be 255.255.255.0

    up : This is not mandatory, but I recommend this to make it sure that NIC is enabled after this command

 

 

Enable an IP address for a network interface card (NIC)

 

Example : # ifconfig eth0 up

    eth0 : Network Interface Card Name (you can figure out this name for your PC by 'ifconfig'

 

 

Disable an IP address for a network interface card (NIC)

 

Example : # ifconfig eth0 down

    eth0 : Network Interface Card Name (you can figure out this name for your PC by 'ifconfig'

 

 

Change MTU

 

Example : # ifconfig eth0 mtu 1500

    eth0 : Network Interface Card Name (you can figure out this name for your PC by 'ifconfig'

    mtu 1500 : set mtu to be 1500

 

 

Promiscuous Mode

 

Example (Enable the promiscuous mode) : # ifconfig eth0 promisc

 

Example (Disable the promiscuous mode) : # ifconfig eth0 -promisc

 

 

Allowing Wireshark to capture packets

 

Sometimes you would see the error message on Wireshark saying "You didn't specify on which to capture packets".

Then you may open "Capture" dialog and try to select "Interface",but don't see any interface name in it. In this case, you may try following.

 

Example : # setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/dumpcap