+++ date = "2025-03-05T18:11:13+00:00" lastmod = "2025-03-05T18:11:13+00:00" tags = [ "gists", "linux" ] +++ There's a [quick](/tdro/messages/unshare/#tdro-messages-unshare) way to test the offline behaviour of programs on Linux. ```shell{ caption="Run bash in a new network [namespace](https://www.man7.org/linux/man-pages/man1/unshare.1.html)" } unshare -c -n bash ``` {{< disclose >}} Then only loopback is available. {{</ disclose >}} ```shell $ ip addr 1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 ``` List network namespaces with [`lsns`](https://www.man7.org/linux/man-pages/man8/lsns.8.html). ```shell $ lsns -t net NS TYPE NPROCS PID USER NETNSID COMMAND 999 net 2 111 user 3 systemd 888 net 1 222 user unassigned └─bash ```