addnwstr - Linux
Overview
addnwstr is a command-line tool used to add a new network namespace (netns) for network management and isolation. It can be employed in various scenarios, such as containerization, virtualization, and network testing.
Syntax
addnwstr [OPTIONS] NETNS_NAME
Options/Flags
- -b, –bridge BRIDGE_NAME: Create a bridge interface within the new netns and attach it to the specified physical bridge.
- -c, –container CONTAINER_ID: Add the new netns to the specified Docker or Podman container.
- -n, **–netlink NETLINK_SOCKET: Use a different netlink socket for communication with the kernel.
- -v, –verbose: Enable verbose output to provide additional details during execution.
- -h, –help: Print usage information and exit.
Examples
Create a new netns named "my-netns":
addnwstr my-netns
Add the new netns to a container named "container-1":
addnwstr -c container-1 my-netns
Create a bridge interface named "br0" within the netns "my-netns" and attach it to the physical bridge "eth0":
addnwstr -b eth0 my-netns
Common Issues
"addnwstr: Operation not permitted": Ensure that you have sufficient privileges (i.e., root access) to create network namespaces.
Integration
addnwstr can be integrated with other network management tools for advanced use cases:
- ip: Manage network interfaces and routing within the created netns.
- tc: Configure traffic control rules and shaping parameters.
- ip link: Create and manipulate network interfaces.
Related Commands
- ip netns
- netns
- bridge