Network Namespace
Last updated
Last updated
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
A network namespace is a Linux kernel feature that provides isolation of the network stack, allowing kila network namespace kuwa na usanidi wake wa mtandao huru, interfaces, IP addresses, routing tables, and firewall rules. This isolation is useful in various scenarios, such as containerization, where each container should have its own network configuration, independent of other containers and the host system.
When a new network namespace is created, it starts with a completely isolated network stack, with no network interfaces except for the loopback interface (lo). This means that processes running in the new network namespace cannot communicate with processes in other namespaces or the host system by default.
Virtual network interfaces, such as veth pairs, can be created and moved between network namespaces. This allows for establishing network connectivity between namespaces or between a namespace and the host system. For example, one end of a veth pair can be placed in a container's network namespace, and the other end can be connected to a bridge or another network interface in the host namespace, providing network connectivity to the container.
Network interfaces within a namespace can have their own IP addresses, routing tables, and firewall rules, independent of other namespaces. This allows processes in different network namespaces to have different network configurations and operate as if they are running on separate networked systems.
Processes can move between namespaces using the setns()
system call, or create new namespaces using the unshare()
or clone()
system calls with the CLONE_NEWNET
flag. When a process moves to a new namespace or creates one, it will start using the network configuration and interfaces associated with that namespace.
Kwa kuunganisha mfano mpya wa mfumo wa /proc
ikiwa unatumia param --mount-proc
, unahakikisha kwamba nafasi mpya ya kuunganisha ina mtazamo sahihi na uliojitegemea wa taarifa za mchakato maalum kwa nafasi hiyo.
Pia, unaweza tu kuingia katika nafasi nyingine ya mchakato ikiwa wewe ni root. Na huwezi kuingia katika nafasi nyingine bila desktopa inayorejelea hiyo (kama /proc/self/ns/net
).
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)