Linux: Network Configuration - Paiet/Tech-Journal-for-Everything GitHub Wiki

  • Viewing Configuration
    • ip addr
    • ifconfig
    • ip route
  • Configuration for a NIC on Redhat
    • Stored in /etc/sysconfig/network-scripts
    • First part of name
      • en = Ethernet
      • wl = Wireless
      • ww = Cellular (WWAN)
    • Second part of name
      • o = On-board
      • p = PCI card
      • s = Hotplug slot
    • /etc/sysconfig/network-scripts/ifcfg-eno1

Network Manager CLI

Viewing Status

nmcli device status nmcli device show <int_name> nmcli connection show nmcli connection show <int_name>

Configuring an Adapter

nmcli connection edit <int_name> set connection.autoconnect yes set ipv4.method manual set ipv4.addr 192.168.0.2/24 set ipv4.dns 8.8.8.8 set ipv4.gateway 192.168.0.1 save <temporary/persistent> quit

Manual Configuration

DEVICE=eno1
TYPE=Ethernet
BOOTPROTO=none
IPADDR0=192.168.0.2
PREFIX0=24
GATEWAY0=192.168.0.1
DEFROUTE=yes
DNS1=8.8.8.8
ONBOOT=yes

  • /etc/sysconfig/network
    • Configurations that apply to all NICs
    • GATEWAY=192.168.0.1
  • Name Lookups
    • /etc/resolv.conf
      • DNS Servers
      • Shouldn't be modified if using the Network Manager
      • NM copies DNS settings from the ifcfg files when the service starts
    • /etc/hosts
      • Overrides DNS
    • /etc/hostname
      • hostname <name> is not normally persistent
      • Defines a machines hostname
      • To modify:
        • hostnamectl set-hostname <name>
      • To verify:
        • hostnamectl status
    • /etc/nsswitch.conf
      • Controls lookup system beyond just DNS
      • NIS+ Servers
        • hosts: files dns
  • Restarting the network service
    • Most changes require restarting the network service
    • service network restart
    • systemctl restart network.service
    • NMCLI
      • nmcli connection reload
      • nmcli connection down <int_name>
      • nmcli connection up <int_name>
⚠️ **GitHub.com Fallback** ⚠️