GNU/Linux Network Configuration Interface details


Example

Ifconfig

List all the interfaces available on the machine

$ ifconfig -a

List the details of a specific interface

Syntax: $ ifconfig <interface>

Example:

$ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          inet addr:x.x.x.x  Bcast:x.x.x.x  Mask:x.x.x.x
          inet6 addr: xxxx::xxx:xxxx:xxxx:xxxx/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4426618 errors:0 dropped:1124 overruns:0 frame:0
          TX packets:189171 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:382611580 (382.6 MB)  TX bytes:36923665 (36.9 MB)
          Interrupt:16 Memory:fb5e0000-fb600000 

Ethtool - query the network driver and hardware settings

Syntax: $ ethtool <interface>

Example:

$ ethtool eth0
Settings for eth0:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Speed: 1000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 1
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: on (auto)
    Supports Wake-on: pumbg
    Wake-on: g
    Current message level: 0x00000007 (7)
                   drv probe link
    Link detected: yes


ip - show / manipulate routing, devices, policy routing and tunnels

Syntax: $ ip { link | ... | route | macsec } (please see man ip for full list of objects)

Examples

List network interfaces

$ ip link show    

Rename interface eth0 to wan

$ ip link set dev eth0 name wan    

Bring interface eth0 up (or down)

$ ip link set dev eth0 up    

List addresses for interfaces

$ ip addr show    

Add (or del) ip and mask (255.255.255.0)

$ ip addr add 1.2.3.4/24 brd + dev eth0