Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
In the Linux environment, querying and routing are essential tasks for managing network connections and optimizing network traffic. Querying refers to the process of retrieving information about network interfaces, routes, and other network-related parameters. Routing, on the other hand, involves directing network traffic between different networks or subnets.
In Linux, querying and routing can be accomplished using various command-line tools and configuration files. These tasks are crucial for network administrators, system engineers, and anyone responsible for maintaining a Linux-based network infrastructure.
Examples:
ifconfig
command. Open a terminal and run the following command:ifconfig
This will display a list of all active network interfaces along with their IP addresses, MAC addresses, and other relevant details.
ip route
command. Open a terminal and run the following command:ip route
This will display the routing table, which includes information about the destination network, gateway, and interface through which the traffic is routed.
ip route add
command. Open a terminal and run the following command:sudo ip route add <destination_network> via <gateway> dev <interface>
Replace <destination_network>
with the network you want to reach, <gateway>
with the IP address of the gateway, and <interface>
with the network interface through which the traffic should be routed.
ip route del
command. Open a terminal and run the following command:sudo ip route del <destination_network> via <gateway> dev <interface>
Replace <destination_network>
, <gateway>
, and <interface>
with the respective values of the route you want to delete.