LinuxCommandLibrary

ip-netns

Manage network namespaces

SYNOPSIS

ip netns { COMMAND | help }

PARAMETERS

add
    Create a new named network namespace.

delete
    Delete the named network namespace.

list
    List all named network namespaces.

exec
    Execute a command within the specified network namespace.

identify []
    Identify the network namespace of the specified process ID (or the current process if no PID is given).

pids
    List process IDs running within the named namespace.

monitor
    Monitor network namespace events.

help
    Show help text.

DESCRIPTION

The `ip netns` command is a powerful tool for managing network namespaces in Linux. Network namespaces provide network isolation by creating separate routing tables, network devices, and firewall rules for each namespace. This allows you to create isolated network environments on a single host, which is useful for testing, virtualization, and containerization. Using this command, you can create, delete, list, execute commands within, and monitor network namespaces. It integrates with other `ip` commands, such as `ip link` and `ip address`, to configure the network interfaces and addresses within each namespace. This allows to implement complex networking configurations, like virtual routers or isolated application environments, within a single system. It's a crucial component for technologies like Docker and Kubernetes.

USE CASES

Docker and Containers:
`ip netns` forms the foundation for container networking, isolating the network stacks of different containers.

Virtualization:
It can be used to create isolated network environments for virtual machines.

Testing:
It is useful for creating isolated test environments where network configurations can be tested without affecting the host system.

SEE ALSO

ip(8), ip-link(8), ip-address(8), nsenter(1)

Copied to clipboard