02Network - amagerard/TemplateVM GitHub Wiki

RedHat/TemplateVM.

1- Installation 2- Network 3- Firewall 4- Selinux
5- Logs 6- Certificates 7- Mail 8- PassphraseSSH
9- Sudo 10- GnomeShell 11- CloneVM 12- Volume
13- Troubleshoot

2. Network setup.

2.1 Change the name of the VM.

Modify or create the following files.
vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4  
# delete the line '::1         localhost localhost.localdomain localhost6 localhost6.localdomain6'  
# comment on this line because we are in dhcp.   
#<votre IP>  srv1.local.domain srv1  

vi /etc/hostname

srv1  

vi /etc/sysconfig/network

# Created by anaconda  
networking=yes  
HOSTNAME=srv1.local.domain  

2.2 Rename network interface to eth0 and remove Ipv6.

grubby --args ipv6.disable=1 --update-kernel DEFAULT
grubby --update-kernel=ALL --args=net.ifnames=0
reboot

2.3 configure eth0 with keyfiles.

2.3.1 Configuration in DHCP mode.

Example: device card ethernet is ens33.
nmcli con show
nmcli con delete "ens33"
nmcli dev connect eth0
nmcli con mod eth0 ipv6.method disabled
The result of configuration in DHCP mode is in:
more /etc/NetworkManager/system-connections/eth0.nmconnection
This file cannot be edited or deleted.
You have to go through nmcli commands.
ip a

2.3.2 Change in static mode.

Example:
IP: 192.168.40.50/24
Gateway: 192.168.40.254
Name Server: 192.168.90.41
Search domain: ol26modk.com
nmcli con mod eth0 ipv4.method "manual" ipv4.addresses 192.168.40.50/24
nmcli con mod eth0 ipv4.gateway 192.168.40.254
nmcli con mod eth0 ipv4.dns 192.168.90.41
nmcli con mod eth0 ipv4.dns-search ol26modk.com

Read the new network configuration.
more /etc/NetworkManager/system-connections/eth0.nmconnection

Apply the new network configuration.
ifconfig eth0 0.0.0.0
systemctl restart NetworkManager
ifconfig eth0

2.3.3 Return to DHCP mode.

mncli con delete eth0
nmcli dev connect eth0
nmcli con mod eth0 ipv6.method disabled

Read the new network configuration.
more /etc/NetworkManager/system-connections/eth0.nmconnection

Apply the new network configuration.
ifconfig eth0 0.0.0.0
systemctl restart NetworkManager
ifconfig eth0

⚠️ **GitHub.com Fallback** ⚠️