Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Manage Network Connections in Linux

Network connections are a fundamental aspect of any operating system, including Linux. Understanding how to manage these connections is crucial for systems administrators, network engineers, and anyone responsible for maintaining the health and security of a networked environment. This article will guide you through the essential commands and configurations for managing network connections in Linux. We'll cover how to view network configurations, set up new connections, and troubleshoot common network issues.

Examples:

  1. Viewing Network Configuration: To view the current network configuration, you can use the ifconfig or ip command.

    # Using ifconfig
    ifconfig
    
    # Using ip
    ip addr show

    These commands will display the IP addresses, subnet masks, and other network interface details.

  2. Setting Up a New Network Connection: To configure a new network connection, you can use the nmcli command, which is part of the NetworkManager tool.

    # Create a new connection
    nmcli con add type ethernet ifname eth0 con-name my-eth0
    
    # Configure IP address
    nmcli con modify my-eth0 ipv4.addresses "192.168.1.100/24"
    nmcli con modify my-eth0 ipv4.gateway "192.168.1.1"
    nmcli con modify my-eth0 ipv4.dns "8.8.8.8 8.8.4.4"
    nmcli con modify my-eth0 ipv4.method manual
    
    # Bring up the connection
    nmcli con up my-eth0
  3. Troubleshooting Network Issues: If you encounter network issues, tools like ping, traceroute, and netstat can be invaluable.

    # Check connectivity to a host
    ping google.com
    
    # Trace the route to a host
    traceroute google.com
    
    # Display network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
    netstat -tuln
  4. Managing Network Services: Sometimes network issues are related to services. You can manage network services using systemctl.

    # Restart the NetworkManager service
    sudo systemctl restart NetworkManager
    
    # Check the status of the NetworkManager service
    sudo systemctl status NetworkManager

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.