IP Network Interface - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
IP Network Interface Troubleshooting for Beginners
Table of Contents
- :pencil: What is ip?
- :zap: Basic Commands
- :wrench: Interface Management
- :bulb: Common Troubleshooting
:pencil: What is ip?
ipis the modern replacement for older network commands likeifconfig,route, andarp- Part of the
iproute2package (usually pre-installed) - More powerful and feature-rich than legacy commands
- Used for configuring and troubleshooting network interfaces
What ip can do:
- Show network interface information
- Configure IP addresses
- Manage routing tables
- Show network statistics
- Troubleshoot network connectivity
:zap: Basic Commands
Show All Network Interfaces
ip addr show
Short form:
ip a
What this does:
- Shows all network interfaces and their IP addresses
- Displays interface status (UP/DOWN)
- Shows IPv4 and IPv6 addresses
Example output:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether ec:75:0c:66:f1:7b brd ff:ff:ff:ff:ff:ff
inet 192.168.2.152/24 brd 192.168.2.255 scope global dynamic noprefixroute enp6s0
valid_lft 231092sec preferred_lft 231092sec
inet6 fe80::ee75:cff:fe66:f17b/64 scope link noprefixroute
valid_lft forever preferred_lft forever
What it shows:
- Interface name (lo, enp6s0, etc.)
- Interface state (UP/DOWN)
- MAC address (link/ether)
- IP addresses (inet for IPv4, inet6 for IPv6)
- Network mask and broadcast address
Show Specific Interface
ip addr show enp6s0
Short form:
ip a show enp6s0
Shows information for a specific network interface.
Show Link Information
ip link show
Short form:
ip l
What this does:
- Shows link layer information (Layer 2)
- Displays interface status and MAC addresses
- Shows if interface is UP or DOWN
Example output:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether ec:75:0c:66:f1:7b brd ff:ff:ff:ff:ff:ff
Show Routing Table
ip route show
Short form:
ip r
What this does:
- Shows the routing table
- Displays default gateway
- Shows network routes
Example output:
default via 192.168.2.1 dev enp6s0 proto dhcp src 192.168.2.152 metric 100
192.168.2.0/24 dev enp6s0 proto kernel scope link src 192.168.2.152 metric 100
What it shows:
- Default route (default via)
- Network routes (192.168.2.0/24)
- Interface used (dev)
- Source IP (src)
:wrench: Interface Management
Bring Interface Up
sudo ip link set enp6s0 up
What this does:
- Activates a network interface
- Brings interface online
Bring Interface Down
sudo ip link set enp6s0 down
What this does:
- Deactivates a network interface
- Takes interface offline
Add IP Address to Interface
sudo ip addr add 192.168.1.100/24 dev enp6s0
What this does:
- Adds an IP address to an interface
/24is the subnet mask (255.255.255.0)
Remove IP Address from Interface
sudo ip addr del 192.168.1.100/24 dev enp6s0
What this does:
- Removes an IP address from an interface
:bulb: Common Troubleshooting
Check Interface Status
ip link show enp6s0
Look for state UP or state DOWN.
Verify IP Address
ip addr show enp6s0
Check if interface has an IP address assigned.
Check Default Gateway
ip route show
Look for default via entry.
Test Connectivity
ping -c 4 8.8.8.8
Tests internet connectivity.
:keyboard: Quick Reference
ip a # Show all addresses
ip a show enp6s0 # Show specific interface
ip l # Show all links
ip r # Show routing table
sudo ip link set enp6s0 up # Bring interface up
sudo ip link set enp6s0 down # Bring interface down
For network connections, see the SS Network Troubleshooting Guide.