summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos/ifconfig.py')
-rw-r--r--python/vyos/ifconfig.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index 987f0b13e..d9f28c8ef 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -17,9 +17,6 @@
import sys
import os
-import re
-import json
-import socket
import subprocess
import ipaddress
@@ -360,11 +357,15 @@ class Interface:
pidfile = dhclient_conf_dir + self._ifname + '.pid'
leasefile = dhclient_conf_dir + self._ifname + '.leases'
+ hostname = 'vyos'
+ with open('/etc/hostname', 'r') as f:
+ hostname = f.read().rstrip('\n')
+
a = [
'# generated by interface_config.py',
'option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;',
'interface \"' + self._ifname + '\" {',
- '\tsend host-name \"' + socket.gethostname() + '\";',
+ '\tsend host-name \"' + hostname + '\";',
'\trequest subnet-mask, broadcast-address, routers, domain-name-servers, rfc3442-classless-static-routes, domain-name, interface-mtu;',
'}'
]