瀏覽代碼

moved dhcp static ips to mounted data

tags/v2.0.0
Robin Thoni 6 年之前
父節點
當前提交
e54eaa695f
共有 5 個檔案被更改,包括 9 行新增6 行删除
  1. 4
    0
      data/isc-dhcp/config/static_ips.conf
  2. 2
    1
      docker-compose.yml
  3. 1
    1
      isc-dhcp/Dockerfile
  4. 1
    4
      isc-dhcp/config/dhcpd.conf
  5. 1
    0
      isc-dhcp/run.sh

+ 4
- 0
data/isc-dhcp/config/static_ips.conf 查看文件

@@ -0,0 +1,4 @@
1
+host my_computer {
2
+  hardware ethernet 01:23:45:67:89:ab;
3
+  fixed-address 10.15.100.254;
4
+}

+ 2
- 1
docker-compose.yml 查看文件

@@ -18,7 +18,8 @@ services:
18 18
         container_name: dhcp-isc-dhcp
19 19
 #        restart: unless-stopped
20 20
         volumes:
21
-            - ./data/isc-dhcp:/data
21
+            - ./data/isc-dhcp/data:/data
22
+            - ./data/isc-dhcp/config:/etc/dhcp/config
22 23
         network_mode: host
23 24
         env_file:
24 25
             - env

+ 1
- 1
isc-dhcp/Dockerfile 查看文件

@@ -20,7 +20,7 @@ COPY ./run.sh /run.sh
20 20
 
21 21
 RUN mkdir "${CONFIG_DIR}"
22 22
 
23
-COPY dhcpd.conf "${CONFIG_DIR}"/dhcpd.conf
23
+COPY ./config "${CONFIG_DIR}"
24 24
 
25 25
 EXPOSE 80
26 26
 

isc-dhcp/dhcpd.conf → isc-dhcp/config/dhcpd.conf 查看文件

@@ -73,10 +73,7 @@ subnet DHCP_SUBNET netmask DHCP_NETMASK {
73 73
 
74 74
   # Static IP hosts
75 75
   group {
76
-    #host  {
77
-    #  hardware ethernet ;
78
-    #  fixed-address 10.15.100.;
79
-    #}
76
+    include "/etc/dhcp/config/static_ips.conf";
80 77
     ddns-domainname "DHCP_SITE_DOMAIN";
81 78
     option host-name = host-decl-name;
82 79
     ddns-hostname = config-option host-name;

+ 1
- 0
isc-dhcp/run.sh 查看文件

@@ -6,4 +6,5 @@ replace_files
6 6
 
7 7
 touch /data/dhcpd.leases
8 8
 
9
+#exec cat /etc/dhcp/dhcpd.conf /etc/dhcp/config/static_ips.conf && dhcpd -t -cf /etc/dhcp/dhcpd.conf && dhcpd -4 -f --no-pid -d -cf /etc/dhcp/dhcpd.conf -lf /data/dhcpd.leases
9 10
 exec dhcpd -4 -f --no-pid -d -cf /etc/dhcp/dhcpd.conf -lf /data/dhcpd.leases

Loading…
取消
儲存