Skip to content

ifconfig Command on ChromeOS Linux Environment

The ifconfig command is a network configuration utility used to view and manage network interfaces. While ifconfig is considered deprecated in favor of ip in many modern Linux distributions, it is still included in several systems and remains a useful tool for network management. On ChromeOS Linux (Crostini), ifconfig can help users diagnose and configure network interfaces.


Syntax

The basic syntax of the ifconfig command is:

ifconfig [interface] [options]

Key Components:

  • interface: Specifies the network interface (e.g., eth0, wlan0).
  • options: Modifies the behavior or displays specific information.

Examples of Usage

View All Network Interfaces

To display information about all network interfaces:

ifconfig

Example Output:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.100  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::1e6f:65ff:fe7a:1c21  prefixlen 64  scopeid 0x20<link>
        ether 00:1e:65:7a:1c:21  txqueuelen 1000  (Ethernet)
        RX packets 12345  bytes 987654 (987.6 KB)
        TX packets 6789  bytes 432109 (432.1 KB)

Display Information for a Specific Interface

To view details about a specific interface, such as eth0:

ifconfig eth0

Enable a Network Interface

To activate a network interface:

sudo ifconfig eth0 up

Disable a Network Interface

To deactivate a network interface:

sudo ifconfig eth0 down

Assign an IP Address

To manually assign an IP address to a network interface:

sudo ifconfig eth0 192.168.1.150 netmask 255.255.255.0

Change the MTU Size

To modify the Maximum Transmission Unit (MTU) size of a network interface:

sudo ifconfig eth0 mtu 1400

Add an Alias to an Interface

To create an alias for a network interface:

sudo ifconfig eth0:1 192.168.1.200 netmask 255.255.255.0

Troubleshooting

Check for ifconfig Availability

If ifconfig is not installed, you can add it by installing the net-tools package:

sudo apt update
sudo apt install net-tools

Permission Denied

Administrative privileges are required for certain operations. Use sudo when needed:

sudo ifconfig eth0 up

Interface Not Found

Ensure the specified interface exists by listing all interfaces:

ifconfig -a

Deprecation Notice

Although ifconfig is still available on many systems, it has been replaced by the ip command for modern network configuration tasks. For example:

  • To display interfaces:

    ip addr
    
  • To activate an interface:

    sudo ip link set eth0 up
    
  • To assign an IP address:

    sudo ip addr add 192.168.1.150/24 dev eth0
    

Best Practices

  1. Prefer ip for New Scripts: Use the ip command for modern network management tasks.
  2. Verify Interface Names: Check interface names with ifconfig -a or ip addr before making changes.
  3. Use with Caution: Changes made with ifconfig are temporary and reset after a reboot unless configured in network scripts.

The ifconfig command is a legacy tool but remains useful for quick diagnostics and configuration in the ChromeOS Linux environment. For long-term or complex tasks, consider transitioning to the ip command.