5-2 Configure Networking and Hostname Resolution Statically or Dynamically: Network Manager Flashcards
/etc/sysconfig/network-scripts
ex:
cat /etc/sysconfig/network-scripts/ifcfg-eth0
Location of all configuration files for network cards, etc.
Each connection to system is a configuration, each configuration is attached to a device, each device has a configuration file
ex: for eth0
ls /sys/class/net
nmcli dev status
2 ways to
View which network cards are attached to the system, or to list all the devices.
Display a list of connections
nmcli con show
Display “device” status
nmcli dev status
Display help for adding connections
nmcli con add help
Add a connection
nmcli con add con-name
“nameofthecon” type ethernet ifname eth0
ifname is the name of the Ethernet device; can find them by doing ls /sys/class/net
By not specifying a gateway or IP, the connection will attempt to go with DHCP
nmcli con add con-name “nameofthecon”
ifname eth0 autoconnect no type Ethernet ip4 ipaddress gw4 gateway
autoconnect will automatically bring up the network connection when the system starts
Modify an existing network connection
ex:
nmcli con mod “nameofthecon”
ex:
nmcli con mod “nameofthecon” connection.autocorrect yes
cat /etc/sysconfig/network-scripts/ifcfg-nameofthecon
see if ONBOOT=yes, which means this configuration will automatically connect. if device set to DEVICE=eth0, it will connect to configuration to eth0 device
Press tab twice for auto complete to show options
After modifying a network connection, you should reload the configuration
nmcli con reload
List all devices
nmcli dev status
Turn off a network device
nmcli dev disconnect “device”
Turn on a network device
nmcli dev connect “device”
List all connections (connections are con gurations that are attached to a device)
nmcli con show
Activate or “bring up” a connection
nmcli con up “connectionname”
Deactivate or “bring down” a connection
nmcli con down “connectionname”
Delete a connection
nmcli con del “connectionname”