2016 - Linux Namespaces - UTS namespace
The Slovak original of this document: 2016 - Linux Namespaces - UTS namespace (slovensky).
UTS (UNIX time-sharing system) namespaces in Linux
1 Úvod
The UTS namespace (UNIX time-sharing system) isolates two system identifiers: the node name (host name) and the domain name, both returned by the "uname()" system call.

2 Working with UTS namespaces
2.1 Checking the host name in the default namespace
In terminal 1 (TERM1), check the host name.
TERM1# uname -n ---------------------------------------------------------------------------------------------------------------- server1.domena.sk
2.2 Creating a new UTS namespace
In terminal 2 (TERM2), create a new UTS namespace.
[1]TERM2# unshare -u /bin/bash [2]TERM2# echo $$ ---------------------------------------------------------------------------------------------------------------- 6012 [3]TERM2# hostname uts1.domena.sk [4]TERM2# uname -n ---------------------------------------------------------------------------------------------------------------- uts1.domena.sk
- [1] - Create a UTS namespace (-u) and run the BASH shell in it.
- [2] - Find the PID of the BASH process.
- [3] - In the new UTS namespace, change the host name to "uts.domena.sk".
- [4] - In the new UTS namespace, check the host name.
2.3 Checking that the new UTS namespace exists
In terminal 1 (TERM1), check that the new UTS namespace exists with "namespaces-info.sh", printing only the non-default namespaces (the -n switch).
TERM1# ./namespaces-info.sh -n ---------------------------------------------------------------------------------------------------------------- ---------- + ---------- + -------------------- + ---------------------------------------- PID | PPID | NAMESPACE | COMMAND ---------- + ---------- + -------------------- + ---------------------------------------- 18 | 2 | mnt:[4026531856] | [kdevtmpfs] ---------- + ---------- + -------------------- + ---------------------------------------- 585 | 1 | mnt:[4026532423] | /usr/lib/systemd/systemd-udevd ---------- + ---------- + -------------------- + ---------------------------------------- 720 | 1 | mnt:[4026532450] | /usr/bin/vmtoolsd ---------- + ---------- + -------------------- + ---------------------------------------- 755 | 1 | mnt:[4026532451] | /usr/sbin/NetworkManager ---------- + ---------- + -------------------- + ---------------------------------------- 854 | 755 | mnt:[4026532451] | /sbin/dhclient ---------- + ---------- + -------------------- + ---------------------------------------- 6012 | 5995 | uts:[4026532424] | /bin/bash ---------- + ---------- + -------------------- + ----------------------------------------