ip
Illia has given her lecture on network services to the new Red Hat employees. Now she needs to show and explain to them 5 examples of how to use the ip command. She also wants to show them examples of starting, stopping, enabling, disabling and checking the status of network services. Please write up what Illia should present to the new employees.
Title: Practical Examples: Using the 'ip' Command and Managing Network Services in RHEL
Introduction: Now that we have covered the theoretical aspects of network services in RHEL, let's dive into practical examples to reinforce your understanding. In this session, we will explore the 'ip' command and demonstrate how it can be used to configure network interfaces. Additionally, we will cover starting, stopping, enabling, disabling, and checking the status of network services. These examples will provide you with hands-on experience and make you more proficient in managing network services on RHEL.
- Using the 'ip' Command to Configure Network Interfaces: The 'ip' command is a versatile tool for managing network interfaces in RHEL. Here are five examples showcasing its usage:
Example 1: Displaying Network Interface Details To view information about network interfaces, use the following command:
ip addr show
This command displays details such as interface names, IP addresses, subnet masks, and MAC addresses.
Example 2: Bringing Up an Interface To activate a network interface, use the 'ip link set' command. For example:
sudo ip link set eth0 up
This command brings up the 'eth0' interface.
Example 3: Assigning an IP Address to an Interface To assign a static IP address to an interface, use the 'ip addr add' command. For instance:
sudo ip addr add 192.168.1.100/24 dev eth0
This command assigns the IP address '192.168.1.100' with a subnet mask of '24' to the 'eth0' interface.
Example 4: Modifying Default Gateway To modify the default gateway for a specific interface, use the 'ip route' command. For example:
sudo ip route add default via 192.168.1.1 dev eth0
This command sets the default gateway to '192.168.1.1' for the 'eth0' interface.
Example 5: Deleting an Interface To remove a network interface, use the 'ip link delete' command. For instance:
sudo ip link delete eth0
This command deletes the 'eth0' interface.
- Managing Network Services: Now let's move on to managing network services on RHEL. Here are examples demonstrating how to start, stop, enable, disable, and check the status of network services.
Example 1: Starting a Service To start a network service, use the 'systemctl start' command. For example:
sudo systemctl start network.service
This command starts the 'network.service' service.
Example 2: Stopping a Service To stop a network service, use the 'systemctl stop' command. For instance:
sudo systemctl stop network.service
This command stops the 'network.service' service.
Example 3: Enabling a Service To enable a network service to start automatically at boot, use the 'systemctl enable' command. For example:
sudo systemctl enable network.service
This command disables the 'network.service' service.
Example 5: Checking Service Status To check the status of a network service, use the 'systemctl status' command. For example:
sudo systemctl status network.service
This command displays the current status and some additional information about the 'network.service' service.
Conclusion: Congratulations! You have now seen practical examples.