Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
# ---- ip command (modern, preferred) ---- # Show all interfaces and their addresses ip addr show ip a # Shorthand # Show a specific interface ip addr show eth0 # Show only IPv4 addresses ip -4 addr show # Bring an interface up/down sudo ip link set eth0 up sudo ip link set eth0 down # Add an IP address to an interface sudo ip addr add 192.168.1.100/24 dev eth0 # Delete an IP address sudo ip addr del 192.168.1.100/24 dev eth0 # Show routing table ip route show ip r # Shorthand # Add a default gateway sudo ip route add default via 192.168.1.1 # Add a specific route sudo ip route add 10.0.0.0/8 via 192.168.1.254 # Show network statistics ip -s link show eth0 # ---- ifconfig (legacy) ---- ifconfig # Show all interfaces ifconfig eth0 # Show specific interface sudo ifconfig eth0 up # Bring interface up sudo ifconfig eth0 192.168.1.100 netmask 255.255.255.0 # ---- DNS resolution ---- cat /etc/resolv.conf # DNS server configuration resolvectl status # systemd-resolved status nslookup google.com # Query DNS dig google.com # Detailed DNS query dig +short google.com # Just the IP host google.com # Simple hostname lookup
Result
Open