1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 14:48:55 +00:00

Resolve localhost and current hostname

This commit is contained in:
Ivan Mikushin
2015-12-10 20:56:15 +05:00
parent 6e453ccbcd
commit f03486263b
7 changed files with 55 additions and 23 deletions

View File

@@ -273,6 +273,19 @@ func setupNetworking(config *Config) error {
return nil
}
hostname, err := os.Hostname();
if err != nil {
return err
}
tryCreateFile("/etc/hosts", `127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 `+hostname)
if len(config.DnsConfig.Nameservers) != 0 {
if _, err := resolvconf.Build("/etc/resolv.conf", config.DnsConfig.Nameservers, config.DnsConfig.Search, nil); err != nil {
return err