Introduction aux commandes réseau : `ping`, `ip`, `netstat`
Découvrez les commandes de base permettant de vérifier la connectivité réseau et d’afficher la configuration du réseau.
Introduction aux commandes réseau : `ping`, `ip`, `netstat` est une leçon Linux Command Line Mastery gratuite sur CoddyKit. Ceci est la leçon 2 sur 4. Tu peux lire la leçon complète ci-dessous gratuitement — puis la pratiquer en direct dans le navigateur avec un éditeur de code intégré et un tuteur IA 24/7. Elle fait partie du parcours d'apprentissage Linux Command Line Mastery, et ta progression se synchronise sur le web et l'application CoddyKit. Le cours Linux Command Line Mastery comprend 4 leçons au total.
Certaines parties de cette leçon n'ont pas encore été traduites et s'affichent en anglais.
Intro to Network Commands
Welcome to this lesson on essential Linux networking commands! Understanding these tools is crucial for diagnosing network issues and viewing your system's network configuration.
We'll explore ping for checking connectivity, ip for comprehensive network interface management, and netstat for viewing active connections.
What is Ping?
The ping command is a fundamental tool used to test the reachability of a host on an Internet Protocol (IP) network. It sends small data packets to a target and waits for a response.
- Purpose: Check if a remote computer or server is online.
- Measurement: Calculates the Round-Trip Time (RTT) for packets to reach the host and return.
- Analogy: Think of it like a sonar pulse for your network!
Ping Your Network
Let's try using ping to check connectivity to a well-known website. The command will send continuous pings until you stop it (usually with Ctrl+C).
Observe the output: the time it takes for packets to return and the 'TTL' (Time To Live) value, which indicates how many 'hops' the packet can make before being discarded.
ping google.comPing Options: Limiting Pings
Sometimes you don't need continuous pings. The -c option allows you to specify the number of echo requests to send.
This is useful for a quick check without having to manually stop the command. After sending the specified number of packets, ping will provide a summary.
ping -c 4 google.comMeet the `ip` Command
The ip command is a modern and powerful utility for showing or manipulating routing, network devices, interfaces, and tunnels. It's designed to replace older tools like ifconfig and route.
ip is versatile, with many subcommands for different tasks. We'll look at ip addr for addresses and ip route for routing information.
Your IP Address with `ip addr`
To view the IP addresses assigned to your network interfaces, you use the ip addr show (or simply ip a) subcommand.
- lo: The loopback interface (127.0.0.1), used for communication within the same machine.
- eth0/wlan0: Your primary wired (Ethernet) or wireless interface.
Look for the inet lines to find your IPv4 addresses.
ip addr showNetwork Routes with `ip route`
The ip route show command displays your system's routing table. The routing table tells your computer how to send network traffic to different destinations.
A key entry is the default via route, which indicates your default gateway – the router your computer uses to send traffic to the internet or other networks it doesn't know directly.
ip route showWhat is Netstat?
netstat (network statistics) is a command-line tool that displays network connections (both incoming and outgoing), routing tables, and a number of network interface statistics.
While ip is often preferred for configuration, netstat remains useful for quickly checking what services are listening on your machine and what connections are established.
Active Connections with `netstat`
To see active network connections and listening ports, you can use netstat with several options:
- -t: Show TCP connections.
- -u: Show UDP connections.
- -l: Show only listening sockets.
- -p: Show the PID/program name owning the socket.
- -n: Show numerical addresses instead of trying to resolve hostnames.
Combining these, netstat -tulpn gives a comprehensive view.
netstat -tulpnNetwork Command Challenge
Test your understanding of the networking commands we've covered.
Recap: Network Basics
Great job! In this lesson, you've gained an introduction to fundamental Linux networking commands:
ping: For testing host reachability and measuring round-trip time.ip: A powerful, modern tool for viewing and configuring network interfaces and routing tables.netstat: Useful for displaying active network connections and listening ports.
Keep practicing these commands to become more comfortable with network diagnostics!
Apprends Linux Command Line Mastery avec un tuteur IA — gratuit
Écris et exécute du vrai code dans ton navigateur, obtiens de l'aide instantanée d'un tuteur IA disponible 24h/24, et reprends là où tu t'es arrêté sur le web ou dans l'app.
- Cours
- 12
- Leçons
- 48
Questions Fréquemment Posées
La leçon « Introduction aux commandes réseau : `ping`, `ip`, `netstat` » est-elle gratuite ?
Oui — le texte complet de « Introduction aux commandes réseau : `ping`, `ip`, `netstat` » est gratuit à lire ici sur le web. Pour la pratiquer de manière interactive (un éditeur de code intégré et un tuteur IA 24/7) et déverrouiller le reste du cours Linux Command Line Mastery, passe à CoddyKit PRO. Le cours Linux Command Line Mastery comprend 4 leçons au total.
Qu'est-ce que j'apprendrai dans « Introduction aux commandes réseau : `ping`, `ip`, `netstat` » ?
Découvrez les commandes de base permettant de vérifier la connectivité réseau et d’afficher la configuration du réseau. Tu pratiques Linux Command Line Mastery avec du code pratique que tu exécutes directement dans le navigateur, et un tuteur IA 24/7 répond à tes questions au fur et à mesure que tu avances dans la leçon.
Dois-je avoir de l'expérience pour commencer Linux Command Line Mastery ?
Aucune expérience préalable n'est requise. Linux Command Line Mastery sur CoddyKit est structuré pour les débutants jusqu'aux apprenants avancés, donc tu peux commencer ici ou depuis le début et avancer à ton rythme. Ceci est la leçon 2 sur 4.
Combien de temps prend la leçon « Introduction aux commandes réseau : `ping`, `ip`, `netstat` » ?
La plupart des leçons CoddyKit prennent environ 5–10 minutes. Chacune est courte et interactive, tu progresses régulièrement et tu repiques exactement où tu t'es arrêté sur le web et l'app.
Peux-tu écrire et exécuter du code dans cette leçon Linux Command Line Mastery ?
Oui. Chaque leçon Linux Command Line Mastery inclut un éditeur de code intégré, tu écris et exécutes du vrai code directement dans ton navigateur et tu reçois des retours IA instantanés — aucune configuration locale requise.
Toutes les leçons de ce cours
- Gérer les utilisateurs et les groupes : `useradd`, `usermod`, `groupadd`
- Introduction aux commandes réseau : `ping`, `ip`, `netstat`
- Accès distant sécurisé : `ssh` et `scp`
- Autorisations et propriété des fichiers avec chmod et chown