보통 우리가 사용하는 DHCP의 예
$ sudo apt install isc-dhcp-server
$ sudo systemctl start isc-dhcp-server
$ sudo systemctl enable isc-dhcp-server
/etc/default/isc-dhcp-server
/etc/default/isc-dhcp-server
INTERFACESv4
에서 어떤 interface에서 DHCP 서버로서의 DHCP requests를 serve할 것 인지를 명시INTERFACESv4="eth0"
/etc/dhcp/dhcpd.conf
authoritative
활성화192.168.0.5
4c:bb:58:9c:f5:55
host [hostname] {
hardware ethernet 4c:bb:58:9c:f5:55;
fixed-address 192.168.0.5;
}
systemctl restart
subnet 100.100.100.0 netmask 255.255.255.0 { // DHCP를 적용할 네트워크
// 클라이언트에게 적용할 옵션은 {} 안에 명시
range 100.100.100.200 100.100.100.230; // IP 주소 범위 (100.100.100.200 ~ 100.100.100.230)
option routers 100.100.100.2; // Gateway 주소
option broadcast-address 100.100.100.255; // Broadcast 주소
option subnet-mask 255.255.255.0; // 서브넷 마스크
option domain-name-servers 8.8.8.8,8.8.4.4; // DNS 주소
default-lease-time 10000; // 기본 임대시간(sec)
max-lease-time 20000; // 최대 임대 시간(sec)
}
/var/lib/dhcpd/dhcpd.leases
$ vi /etc/network/interfaces
auto eth0
iface ens33 inet eth0
network-manager
대몬 재시작$ sudo systemctl restart network-manager
$ ifconfig
eth0 Link encap:Ethernet HWaddr 4c:bb:58:9c:f5:55
inet addr:192.168.0.5 Bcast:192.168.0.255 Mask:255.255.0.0
inet6 addr: 2401:4900:1955:16a2:1d:1e7:518d:6481/64 Scope:Global
inet6 addr: fe80::4ebb:58ff:fe9c:f555/64 Scope:Link
inet6 addr: 2401:4900:1955:16a2:4ebb:58ff:fe9c:f555/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:280316 errors:0 dropped:0 overruns:0 frame:0
TX packets:179641 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:321303950 (321.3 MB) TX bytes:36083350 (36.0 MB)
$ dhclient -r -v
$ dhclinet -v
$ vi /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
network-manager
대몬 재시작$ sudo systemctl restart network-manager
$ ifconfig
eth0 Link encap:Ethernet HWaddr 56:84:7a:fe:97:99
inet addr:192.168.0.11 Bcast:192.168.0.255 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:561189 (561.1 KB) TX bytes:561189 (561.1 KB)
$ dhclient -r -v
$ dhclinet -v