Catalog / Networking Utilities Cheatsheet (ifconfig, ip)
Networking Utilities Cheatsheet (ifconfig, ip)
A quick reference guide to using `ifconfig` and `ip` commands for network configuration and troubleshooting on Linux systems.
Basic Interface Configuration (ifconfig)
Displaying Interface Information
|
|
|
Configuring IP Address and Netmask
|
Assigns an IP address and netmask to the specified interface. |
|
Assigns an IP address using CIDR notation. |
Enabling/Disabling Interfaces
|
Brings the specified interface up. |
|
Brings the specified interface down. |
Setting the MTU
|
Sets the Maximum Transmission Unit (MTU) for the specified interface. |
Modern Interface Configuration (ip)
Displaying Interface Information
|
|
|
|
Managing IP Addresses
|
Adds an IP address to the specified interface. |
|
Removes an IP address from the specified interface. |
Managing Link State
|
Brings the specified interface up. |
|
Brings the specified interface down. |
|
Sets the MTU for the specified interface. |
Managing Routes
|
Adds a default gateway. |
|
Deletes a default gateway. |
Advanced `ip` Commands
Working with VLANs
|
Creates a VLAN interface. |
|
Brings the VLAN interface up. |
|
Assigns an IP address to the VLAN interface. |
Managing Network Namespaces
|
Creates a new network namespace. |
|
Executes a command within a network namespace. |
|
Moves an interface to a network namespace. |
Using `ip monitor`
|
|
|
|
Troubleshooting and Examples
Common Problems and Solutions
Problem: Cannot connect to the internet. |
Problem: Interface is down. |
Problem: IP address conflict. |
Problem: Incorrect MTU size. |
Example Scenarios
Scenario: Assign a static IP address to eth0.
|
Scenario: Create a VLAN interface on eth0 with VLAN ID 20 and IP address 192.168.20.1/24.
|
Scenario: Move interface eth1 to network namespace ns1.
|