Networking
Basic Commands
|
ip a |
Display network inerfaces and details |
|
ip addr |
|
|
ifconfig |
|
|
hostnamectl set-hostname <hostname> |
set hostname |
NetworkManager
|
systemctl status NetworkManager |
NetworkManager status |
|
ps -ef | grep NetworkManager |
verify the process is running |
Network Configuration Methods
|
nmcli |
network manager cli (non gui) can be used in scripts |
|
nmtui |
text user interface |
|
nm-connection-editor |
full gui (via desktop/console) |
|
GNOME Settings |
|
Use nmcli to set a static ip address
|
nmcli connection |
connected interface UUIDs |
|
nmcli device |
connected interface status |
|
nmcli connection modify eth0 ipv4.addresses 192.168.50.X/24 |
set static ip address & subnet mask |
|
nmcli connection modify eth0 ipp4.gateway 192.168.50.1 |
set gateway |
|
nmcli connection modify eth0 ipv4.method manual |
configure eth0 to use static IP |
|
nmcli connection modify eth0 ipv4.dns 8.8.8.8 |
set dns to google.com |
|
nmcli connection down eth0 && nmcli connection up eth0 |
restart nmcli connection |
|
ip address show eth0 |
|
Use nmcli to configure a secondary static ip address
|
nmcli device status |
|
|
nmcli connection show --active |
|
|
ifconfig |
|
|
nmcli connection modify eth0 +ipv4.addresses 192.168.50.X/24 |
set secondary static ip address & subnet mask |
|
nmcli connection reload |
|
|
systemctl reboot |
|
|
ip address show |
|
nmtui (as root), nm-connection-editor or GNOME settings can also be used to activate a connection or change hostname
Network Files and Basic Commands
|
/etc/sysconfig/network-scripts |
|
|
/etc/hosts |
|
|
/etc/hostname |
|
|
/etc/resolv.conf |
DNS |
|
/etc/nsswitch.conf |
Set to use Files or DNS first (per command/request) |
|
ping |
verify network connectivity to a host |
|
ifconfig |
Display network interfaces and IP addresses |
|
ip addr |
|
|
ip a |
|
|
ifup |
brings up a specific network interface |
|
ifdown |
takes down a specific network interface |
|
traceroute |
track and display path (router/hops) that packets take to reach a destination host |
|
tcpdump -i eth0 |
capture and monitor live network traffic flowing through eth0 |
|
nslookup |
queries DNS servers to find ip adddress of a domain or vice versa |
|
dig |
|
|
ethtool eth0 |
display and modify physical hardware settings of eth0 such as link speed & duplex |