(0) $ python3 -m vmware_static_dhcp.vmware_static_dhcp --help
usage: vmware_static_dhcp.py [-h] --hw-addr HW_ADDR --ip-addr IP_ADDR
--hostname HOSTNAME
updated_hosts_path updated_dhcpd_conf_path
positional arguments:
updated_hosts_path Path to updated hosts file
updated_dhcpd_conf_path
Path to update dhcpd.conf file.
optional arguments:
-h, --help show this help message and exit
--hw-addr HW_ADDR MAC address
--ip-addr IP_ADDR IP address to reserve
--hostname HOSTNAME hostname to associate with IP address.
-==< zach@endor:~/Sync/Projects/src/vmware-static-dhcp >==-
(0) $ python3 -m vmware_static_dhcp.vmware_static_dhcp ./new_hosts ./new_dhcpd.conf --hw-addr "aa:bb:cc:dd:ee:ff" --ip-addr "192.168.44.11" --hostname new-virtual-machine
Writing update dhcpd configuration to ./new_dhcpd.conf
-==< zach@endor:~/Sync/Projects/src/vmware-static-dhcp >==-
(0) $ diff -u /etc/hosts ./new_hosts
--- /etc/hosts 2019-11-08 15:46:00.000000000 -0800
+++ ./new_hosts 2019-11-08 15:46:48.000000000 -0800
@@ -9,3 +9,4 @@
::1 localhost
192.168.44.10 gargleblaster
+192.168.44.11 new-virtual-machine
-==< zach@endor:~/Sync/Projects/src/vmware-static-dhcp >==-
(1) $ diff -u /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf new_dhcpd.conf
--- /Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf 2019-10-01 18:56:04.000000000 -0700
+++ new_dhcpd.conf 2019-11-08 15:46:48.000000000 -0800
@@ -13,9 +13,9 @@
# Modification Instructions: This section of the configuration file contains
# information generated by the configuration program. Do not modify this
# section.
-# You are free to modify everything else. Also, this section must start
-# on a new line
-# This file will get backed up with a different name in the same directory
+# You are free to modify everything else. Also, this section must start
+# on a new line
+# This file will get backed up with a different name in the same directory
# if this section is edited and you try to configure DHCP again.
# Written at: 10/01/2019 18:56:04
@@ -42,7 +42,13 @@
}
####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######
-host gargleblaster{
+host gargleblaster {
hardware ethernet 00:0c:29:a5:fd:3a;
fixed-address 192.168.44.10;
}
+
+host new-virtual-machine {
+ hardware ethernet aa:bb:cc:dd:ee:ff;
+ fixed-address 192.168.44.11;
+}
+
-==< zach@endor:~/Sync/Projects/src/vmware-static-dhcp >==-
(1) $
Created
November 8, 2019 23:58
-
-
Save zcutlip/c89440e74975c5611803c8ef7a64170c to your computer and use it in GitHub Desktop.
Automatically adding a static DHCP reservation to VMWare's dhcpd.conf and to /etc/hosts
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment