1. Validate Network Configuration
2. Configure Network
Networking is managed by a service called NetworkManager. It reads the network card configuration scripts located at /etc/sysconfig/network-scripts. Each network card can have one or many connections.
The commands to configure network are nmtui and nmcli. Another way is a GUI tool called nm-connection-editor.
nmtui is text based UI with limited options.
nmcli has rich features and you don't need to memorize. Here are nice ways to check it out.
- man -1 nm-settings : to check user command
- man -5 nm-settings : to check file formats and conventions
- man nmcil-examples : to find examples
- nmcli con show|add|mod|up...
- nmcli dev show...
To view or change the hostname, a few options are:
- Use nmtui
- Use hostnamectl
- hostnamectl status
- hostnamectl set-hostname
- Edit /etc/hostname
To set hostname resolution, you can use DNS and edit /etc/hosts.
The definitions in /etc/hosts will be applied before the hostname in DNS is used.
The definitions in /etc/hosts will be applied before the hostname in DNS is used.
Tips: /etc/hosts contains the local host and DNS servers.
/etc/hostname contains only the local server.
To communicate with the internet, you should set up the DNS. Here are a few options to set up the DNS:
- Use nmtui
- Use nmcli to find the static network card, do either of
- modify the parameters: DNS1 DNS2
- modify the option: ipv4.dns <ip-of-dns>
- Use a DHCP server
The configuration written here will show up in /etc/sysconfig/netowrk-scripts. NetworkManager service will pick this up and push it into /etc/resolv.conf.
After all, you can verify it's configured correctly by:
- getent hosts <servername>
It checks in both DNS and /etc/hosts to resolve the hostname.
Comments
Post a Comment