[PATCH phosphor-networkd] Enable DHCP

OpenBMC Patches openbmc-patches at stwcx.xyz
Tue Feb 2 11:50:28 AEDT 2016


From: Adriana Kobylak <anoo at us.ibm.com>

Enable DHCP when network service starts by creating an 80-dhcp.network
file. Only setup if file doesn't exist already, this allows for a one
time setup.
---
 netman.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/netman.py b/netman.py
index c63921f..8ddeb93 100755
--- a/netman.py
+++ b/netman.py
@@ -51,6 +51,15 @@ class NetMan (dbus.service.Object):
         self.name = name
         dbus.service.Object.__init__(self,bus,name)
 
+        #Setup DHCP
+        dhcpfile = "/etc/systemd/network/80-dhcp.network"
+        if (not os.path.isfile(dhcpfile)):
+            with open(dhcpfile, 'w') as f:
+                f.write('[Match]' + '\n')
+                f.write('Name=eth0' + '\n')
+                f.write('[Network]' + '\n')
+                f.write('DHCP=yes' + '\n')
+
     def setNetworkProvider(self, provider):
         self.provider = provider
 
-- 
2.6.4




More information about the openbmc mailing list