summaryrefslogtreecommitdiff
path: root/docs/system/host-information.rst
blob: 788f7bccfb9ac78aaf9b4b4be7bd1cd6cf2af84e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
.. _host-information:

Host Information
----------------

This section describes the system's host information and how to configure them,
it covers the following topics:

* Host name
* Domain
* IP address
* Default gateway
* Aliases

Host Name
^^^^^^^^^

A hostname is the label (name) assigned to a network device (a host) on a
network and is used to distinguish one device from another on specific networks
or over the internet.

Set a system host name:

.. code-block:: sh

  set system host-name <hostname>

.. note:: Only letters, numbers and hyphens are allowed.

Show host name:

.. code-block:: sh

  show system host-name

Delete host name:

.. code-block:: sh

  delete system host-name <hostname>

Example: Set system hostname to 'RT01':

.. code-block:: sh

  set system host-name RT01
  commit
  show system host-name
    host-name RT01

Domain Name
^^^^^^^^^^^

A domain name is the label (name) assigned to a computer network and is thus
unique.

Set the system's domain:

.. code-block:: sh

  set system domain-name <domain>

.. note:: Only letters, numbers, hyphens and periods are allowed.

Show domain:

.. code-block:: sh

  show system domain-name

Remove domain name:

.. code-block:: sh

  set system delete domain-name <domain>

Example: Set system domain to example.com:

.. code-block:: sh

  set system domain-name example.com
  commit
  show system domain-name
    domain-name example.com

Static host mappings
^^^^^^^^^^^^^^^^^^^^

How to assign IPs to interfaces is described in chapter
:ref:`interfaces-addresses`. This section shows how to statically map a system
IP to its host name for local (meaning on this VyOS instance) DNS resolution:

.. code-block:: sh

  set system static-host-mapping host-name <hostname> inet <IP address>

Show static mapping:

.. code-block:: sh

  show system static-host-mapping

Example: Create a static mapping between the system's hostname `RT01` and
IP address `10.20.30.41`:

.. code-block:: sh

  set system static-host-mapping host-name RT01 inet 10.20.30.41
  commit
  show system static-host-mapping
    host-name RT01 {
        inet 10.20.30.41
    }

Aliases
*******

One or more system aliases (static mappings) can be defined:

.. code-block:: sh

  set system static-host-mapping host-name <hostname> alias <alias>

Show aliases:

.. code-block:: sh

  show system static-mapping

Delete alias:

.. code-block:: sh

  delete system static-host-mapping host-name <hostname> alias <alias>

Example: Set alias `router1` for system with hostname `RT01`:

.. code-block:: sh

  set system static-host-mapping host-name RT01 alias router1
  commit
  show system static-host-mapping
    host-name RT01 {
        alias router1
        inet 10.20.30.41
    }

Default Gateway/Route
^^^^^^^^^^^^^^^^^^^^^

In the past (VyOS 1.1.8) used a gateway-address configured in the system tree
(`set system gateway-address <IP address>`) this is no longer supported and
existing configurations are migrated to the new CLI commands.

It is replaced by inserting a static route into the routing table using:

.. code-block:: sh

  set protocols static route 0.0.0.0/0 next-hop <gateway ip>

Delete the default route from the system

.. code-block:: sh

  delete protocols static route 0.0.0.0/0

Show default route:

.. code-block:: sh

  vyos@vyos$ show ip route 0.0.0.0
  Routing entry for 0.0.0.0/0
    Known via "static", distance 1, metric 0, best
    Last update 3d00h23m ago
    * 172.16.34.6, via eth1