DHCP 設定

技術筆記

Server

CentOS

CentOS 7: Install dhcpd and run DHCP server

  • lease: /var/lib/dhcpd/dhcpd.leases
  • config: /etc/dhcp/dhcpd.conf
    option domain-name "calee.xyz";
    option domain-name-servers 140.113.235.1, 1.1.1.1, 9.9.9.9, 8.8.8.8;
    
    default-lease-time 600;
    max-lease-time 7200;
    
    # Use this to send dhcp log messages to a different log file (you also
    # have to hack syslog.conf to complete the redirection).
    log-facility local7;
    
    # A slightly different configuration for an internal subnet.
    subnet 192.168.1.0 netmask 255.255.255.0 {
      range 192.168.1.0 192.168.1.254;
      option domain-name-servers 140.113.235.1, 1.1.1.1;
      option domain-name "pve.calee.xyz";
      option routers 192.168.1.1;
      option broadcast-address 192.168.1.254;
      default-lease-time 600;
      max-lease-time 7200;
    }
    host DESKTOP-A6UOSVB {
        hardware ethernet 82:20:3d:cf:32:79;
        fixed-address 192.168.1.2;
    }
    
    host DESKTOP-04E99PF {
        hardware ethernet 72:0e:c8:c3:6c:1c;
        fixed-address 192.168.1.3;
    }
    

Client

Linux

  • Renew: dhclient -r

Windows

  • Renew: ipconfig /renew

MacOS

comments powered by Disqus

Related