Linux Network Config¶
Ethernet¶
In Linux, ethernet interfaces are labelled as eth0, eth1, …
Display Interface Information¶
ip addr
ip link
ip -s link
#ifconfig # obsolete
Enable/Disable Interfaces¶
ifup eth0
ifdown eth0
Network Config Files¶
This changes for different distributions.
Read the document for your linux distribution to understand how to config those.
Debian Interface Config¶
man interfaces
sudo vim /etc/network/interfaces
DNS Config¶
/etc/resolv.config
Hostname Config¶
hostname
hostname <some-name>
sudo vim /etc/hostname
Network Testing Commands¶
Test connection
ping IP
ping URL
DNS
host URL
dig URL
Display routing table
ip route
Trace route (traces the routing devices)
traceroute URL/IP
# there might be some restrictions for output
Both traceroute and ping
- Updates dynamically
- Continuously send packets to calculate the loss rate
- Contact the network provider of the ones with high loss rate
mtr URL
Network Troubleshoot¶
From lower to higher, from inner to outer.
- Check config files
- ip
- subnet mask
- gateway
- DNS
- ping gateway
- DNS
- host