Configuring host information
This section includes the following examples:
Setting the hostname of the system
Setting the domain name of the system
Mapping the IP address of the system to its hostname
Setting the default gateway
Creating an alias for the system
vyatta@vyatta# set system host-name R1 vyatta@vyatta# commit comment "setting host-name" vyatta@vyatta# exit vyatta@vyatta:~$ configure vyatta@R1# set system domain-name mydomain.com vyatta@R1# set system static-host-mapping host-name R1 inet 10.0.0.65 vyatta@R1# set protocols static route 0.0.0.0/0 next-hop 172.16.0.254 vyatta@R1# set system static-host-mapping host-name R1 alias finance1 vyatta@R1# compare [edit system] +domain-name mydomain.com +static-host-mapping { + host-name R1 { + alias finance1 + inet 10.0.0.65 + } +} [edit] +protocols { + static { + route 0.0.0.0/0 { + next-hop 172.16.0.254 + } + } +} vyatta@R1# commit comment "setting host information" vyatta@R1# exit
Hostname
The name of the DANOS vRouter is set by using the system host-name
command. A system name can include letters, numbers, and hyphens (-).
Line 1 shows setting the host-name to “R1”.
Domain
The name of the DANOS vRouter is set by using the system host-name command. A system name can include letters, numbers, and hyphens (-).
The system domain-name
and system domain-search
commands are mutually exclusive. Only one of the two commands can be configured at any one time.
Line 5 shows setting the domain to “mydomain.com”.
IP address
The IP address of the system can be statically mapped to its hostname for local DNS purposes by using the system static-hostmapping
command.
IP networks are specified in CIDR format—that is, in IP-address /prefix notation such as 192.168.12.0/24. For a single address, use dotted-quad format, that is, a.b.c.d. For a network prefix, enter a decimal number from 1 through 32.
A good practice is to map the hostname of the system to the loopback address because the loopback interface is the most reliable on the system. In this example, the loopback interface is given the 10.0.0.65 address. This address is configured for the loopback interface in the sample topology used in this guide.
Line 6 shows setting the mapping between R1 hostname and 10.0.0.65 IP address.
Default gateway
Line 7 shows setting the default gateway for the system to be 172.16.0.254.
Aliases
You can define one or more aliases for the system by mapping the IP address of the system to more than one hostname.
Line 8 shows setting the finance1 alias for the system.
Configuring DNS
DNS name servers
DNS name servers are specified by using the system name-server
command.
The order in which the DNS name servers are added to the configuration is the order in which they are
accessed.
The following example shows how to specify two DNS name servers for the system: one at 172.16.0.34 and the other at 10.10.40.34.
vyatta@R1# set system name-server 172.16.0.34 vyatta@R1# set system name-server 10.10.40.34 vyatta@R1# compare [edit system] +name-server 172.16.0.34 +name-server 10.10.40.34 vyatta@R1# commit comment "setting DNS name-servers" vyatta@R1# exit
Domain search order
You can specify a list of domains for the system to use to complete an unqualified hostname. To define this list, specify the order in which domains are searched by using the system domain-search
command.
The system domain-name
and system domain-search
commands are mutually exclusive. Only one of the two commands can be configured at any one time.
The system domain-search
command requires that you enter each domain name separately, specified in the order you want them searched. A domain name can include letters, numbers, hyphens (-), and periods (.).
The following example shows how to direct the system to attempt domain completion in the following order: first, mydomain.com; second, mydomain.net; and last mydomain.org.
vyatta@R1# set system domain-search domain mydomain.com vyatta@R1# set system domain-search domain mydomain.net vyatta@R1# set system domain-search domain mydomain.org vyatta@R1# compare [edit system] +domain-search { + domain mydomain.com + domain mydomain.net + domain mydomain.org +} vyatta@R1# commit comment "setting DNS domain-search" vyatta@R1# exit