@@ -6,23 +6,49 @@ categories: [examples]
6
6
tags : [cli]
7
7
---
8
8
9
- Notice how the hostname in the prompt does not change until the change
10
- is committed by issuing the leave command.
9
+ A common task for initial setup of your operating system is to change
10
+ the hostname of a device. The default is a unique name composed from
11
+ the built-in default name suffixed by the last three octets of the base
12
+ MAC address.
13
+
14
+ ```
15
+ admin@infix-c0-ff-ee-:/>
16
+ ```
17
+
18
+ In this example the built-in name is ` infix ` and the last three octets
19
+ resemble my favorite morning drink. The built-in name depends on the
20
+ Infix build and can be [ tailored to your product] [ 0 ] .
21
+
22
+ The hostname can be changed from the system configuration context:
11
23
12
24
```
13
- admin@host :/> configure
14
- admin@host :/config/> edit system
15
- admin@host :/config/system/> set hostname example
16
- admin@host :/config/system/> leave
25
+ admin@infix-c0-ff-ee :/> configure
26
+ admin@infix-c0-ff-ee :/config/> edit system
27
+ admin@infix-c0-ff-ee :/config/system/> set hostname example
28
+ admin@infix-c0-ff-ee :/config/system/> leave
17
29
admin@example:/>
18
30
```
19
31
20
- The hostname is advertised over mDNS-SD in the ` .local ` domain. If
21
- another device already has claimed the example.local CNAME, in our case,
22
- mDNS will advertise a "uniqified" variant, usually suffixing with an
23
- index, e.g., ` example-1.local ` . Use an mDNS browser to scan for
24
- available devices on your LAN.
32
+ Notice how the hostname in the prompt does not change until the change
33
+ is committed by issuing the leave command.
34
+
35
+ There are a few format specifiers available:
36
+
37
+ - ` %h ` : built-in hostname, here ` infix `
38
+ - ` %i ` : built-in identity, here ` infix ` (depends on branding)
39
+ - ` %m ` : last three octets of base MAC address (may be 00-00-00)
40
+ - ` %% ` : literal ` % ` character
41
+
42
+ One good reason to maintain a unique hostname, e.g., using ` %m ` , is that
43
+ it is advertised over mDNS-SD in the ` .local ` domain. If another device
44
+ already has claimed the ` example.local ` CNAME, mDNS will notice this and
45
+ advertise a "uniqified" variant, usually suffixing with an index, e.g.,
46
+ ` example-1.local ` . Use an mDNS browser to scan for available devices on
47
+ your LAN.
25
48
26
49
> Critical services like syslog, mDNS, LLDP, and similar that advertise
27
50
> the hostname, are restarted when the hostname is changed.
28
51
{: .prompt-info }
52
+
53
+
54
+ [ 0 ] : https://github.com/kernelkit/infix/blob/main/doc/branding.md
0 commit comments