To configure the network and set the static hostname with the provided information, you can use the nmcli
command in Linux. Here's how you can do it step by step:
- Set the static IP address, netmask, gateway, and DNS server:
nmcli connection add type ethernet con-name eth0 ifname epls0 ipv4.addresses 172.25.250.10/24 ipv4.gateway 172.25.250.254 ipv4.dns 172.25.250.254
This command creates a new Ethernet connection named "eth0" with the specified IP address (172.25.250.10), netmask (255.255.255.0), gateway (172.25.250.254), and DNS server (172.25.250.254).
nmcli
: This is the command-line interface for NetworkManager, a program for managing network connections in Linux.connection add
: This sub-command is used to add a new connection.type ethernet
: This specifies the type of connection being added, which is Ethernet in this case.con-name eth0
: This sets the name of the connection to "eth0". The name "eth0" is a common naming convention for Ethernet connections in Linux, indicating the first Ethernet interface.ifname epls0
: This specifies the interface name, which is "epls0" in this case. The interface name represents the physical network interface through which the connection will be established.ipv4.addresses 172.25.250.10/24
: This sets the IPv4 address and subnet mask for the connection. The IP address is 172.25.250.10, and the subnet mask is /24, which translates to a netmask of 255.255.255.0. This means that the first 24 bits of the IP address are used for the network portion, and the remaining 8 bits are used for hosts on the network.ipv4.gateway 172.25.250.254
: This specifies the IPv4 gateway address for the connection. The gateway is the router's IP address through which traffic outside of the local network is routed.ipv4.dns 172.25.250.254
: This sets the IPv4 DNS server address for the connection. The DNS server is responsible for resolving domain names to IP addresses.
- Set the static hostname:
hostnamectl set-hostname your-desired-hostname.lab.example.com
Replace your-desired-hostname
with the hostname you want to set.
This command sets the hostname to the desired value (e.g., your-desired-hostname.lab.example.com). Make sure to replace "your-desired-hostname" with the hostname you prefer.
After running these commands, your network configuration will be updated with the provided IP address, netmask, gateway, and DNS server, and your hostname will be set accordingly.