System management

From VyOS Wiki
Jump to: navigation, search

After Basic setup the router should be ready for further configuration which is described in this chapter.

Configuring 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

Set a system host name: (Note: only letters, numbers and hyphens are allowed)

# set system host-name <hostname>

Show host name:

# show system host-name

Delete host name:

# delete system host-name <hostname>

Example: Set system hostname to 'RT01':

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

Domain

Set the system's domain: (Note: only letters, numbers, hyphens and periods are allowed)

# set system domain-name <domain>

Show domain:

# show system domain-name

Remove domain name:

# set system delete domain-name <domain>

Example: Set system domain to example.com:

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

IP address

How to assign IPs to interfaces is described in Basic setup, this section shows how to statically map a system IP to its host name for local DNS resolution:

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

Show static mapping:

# show system static-host-mapping

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

# 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
  }

Default gateway

Set a default gateway address for the system:

# set system gateway-address <IP address>

Show default gateway:

# show system gateway-address

Delete gateway address:

# delete system gateway-address

Example: Set the system's default gateway address to 10.20.30.40:

# set system gateway-address 10.20.30.40
# commit
# show system gateway-address
  gateway-address 10.20.30.40

Aliases

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

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

Show aliases:

# show system static-mapping

Delete alias:

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

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

# 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
  }

Configuring DNS

This section describes configuring DNS name services on the system, namely:

  • DNS name servers
  • Domain search order

DNS name servers

One or more DNS servers can be specified for the system to be used for DNS lookups (IPv4 and IPv6 addresses are supported):

# set system name-server <IP>

To set a second (third, etc.) DNS server repeat the above command with the desired IP address(es).

Show the specified DNS name servers:

# show system name-server

Delete name server entry:

# delete system name-server <IP>

Example: Google's public DNS servers are used, two IPv4 addresses and two IPv6 addresses:

# set system name-server 8.8.8.8
# set system name-server 8.8.4.4
# set system name-server 2001:4860:4860::8888
# set system name-server 2001:4860:4860::8844
# commit
# show system name-server
  name-server 8.8.8.8
  name-server 8.8.4.4
  name-server 2001:4860:4860::8888
  name-server 2001:4860:4860::8844

Domain search order

In order for the system to use and complete unqualified host names a list can be defined which is used for domain searches (Note: domain names can include letters, numbers, hyphens and periods with a maximum length of 253 characters. Up to 6 entries can be specified):

# set system domain-search domain <domain>

Show the domain search list:

# show system domain-search

Delete a list entry:

# delete system domain-search domain <domain>

Example: The system is configured to attempt domain completion in the following order - example.com (first), example.net (second) and example.org (last):

# set system domain-search domain example.com
# set system domain-search domain example.net
# set system domain-search domain example.org
# commit
# show system domain-search
  domain example.com
  domain example.net
  domain example.org


DHCPv6 client

For the system to be able to acquire an IPv6 address from a DHCPv6 server a DHCPv6 client needs to be enabled on an interface.

# set interface ethernet eth0 address dhcpv6

Show DHCPv6 client leases

Show information for interfaces configured as DHCPv6 clients:

$ show dhcpv6 client leases

Release DHCPv6 client leases

Release a DHCPv6 client lease on an interface (from operational mode):

$ release dhcpv6 interface <interface>

Renew DHCPv6 client leases

Renew a DHCPv6 client lease on an interface:

$ renew dhcpv6 interface <interface>


Configuring date, time & NTP

This section covers setting date and time on the system manually and automatically by synchronising with one or more NTP servers.

  • Setting the date and time
  • Manual synchronisation with NTP server
  • Setting time zone
  • Automatic synchronisation with NTP server

Setting the date and time

The system time can be set manually, the format is MMDDhhmmCCYY. Alternate formats MMDDhhmm, MMDDhhmmYY and MMDDhhmmCCYY are allowed as well:

# set date <date&time>

Show the current system date and time (from operational mode):

$ show date

Show the current system date and time in UTC:

$ show date utc

Example: Setting the date and time to 2018-Jan-28, 13:30PM (Note: the 24h time format is being used):

# set date 012813302018
  Sun Jan 28 13:30:00 GMT 2018

Manual synchronisation with NTP server

A manual, one-time synchronisation with an NTP server can be carried out in operational mode like this:

$ set date ntp <IP address>

Example: Synchronise the system's date and time with an NTP at 10.20.30.40:

$ set date ntp 10.20.30.40

Setting time zone

A system time zone must be specified, this can be done by either specifying the zone as Region/Location or as offset from UTC, the system's default zone is GMT. When the Region/Location format is being used, daylight savings time (DST) adjustments are done automatically. To set a zone, <Tab>-completion can be used to display the various options, be aware that these are case sensitive:

# set system time-zone <zone>

To delete a time-zone:

# delete system time-zone

Show current time zone:

# show system time-zone

Example 1: Set the system time zone to US/Pacific time:

# set system time-zone US/Pacific
# commit
# show system time-zone
  time-zone US/Pacific

Example 2: To set a UTC offset use Etc/<offset>, use the positive sign (+) for west of Greenwich and the negative sign (-) for east of Greenwich (POSIX compliance); A timezone 8 hours west of Greenwich (behind UTC) would be 'Etc/GMT+8':

# set system time-zone Etc/GMT+8
# commit
# show system time-zone
  time-zone Etc/GMT+8

Automatic synchronisation with NTP server

In order for the system to automatically synchronise its date and time, associations with one or more NTP servers must be created:

# set system ntp server <IP address or hostname>

Show the current status of connections to NTP servers, how often they are being polled and updating the system's clock, an Asterisk (*) next to a NTP server entry indicates a successful synchronisation:

# show system ntp

Show the status of a specific NTP server by specifying its IP address or hostname:

# show system ntp <server>

Example: Configure the system to use a NTP server defined by its IP address (10.20.30.40) and another one defined by hostname:

# set system ntp server 10.20.30.40
# set system ntp server pool.ntp.org
# commit
# show system ntp server
  server 10.20.30.40
  server pool.ntp.org