Published Book on Amazon
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1 | |
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2 |
출판된 한글판 도서
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상) | |
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하) |
Original Book Contents
11.2.2 Setting Assignment Method of IP Address
Generally, in the way that a computer is assigned an IP address in a network, there are "automatic IP assignment" and "static IP assignment".
If the DHCP server is set to "automatic IP address assignment", it has the function of automatically assigning IP addresses to individual computers connected to the internal network managed by the server. Normally, IP address is automatically assigned one by one in the order that each computer is connected to the network. In this way, if the current IP address is assigned to 192.168.0.100, the next connected computer is given an IP address of 192.168.0.101.
However, if the IP address is automatically assigned, the IP address may be changed each time the network is connected. If the IP address is different each time and you need to use the IP address, you have to find the number, it is hard to remember and it is inconvenient to use, so you may fix the IP address. Also, according to the network management policy, it is possible to fix the IP address for each individual computer in order to manage the computers connected to the network.
The Raspberry Pi system is basically configured to automatically be assigned an IP address from the DHCP server when connecting to the network.
In the Raspberry Pi system, the IP address assignment method is defined in "/etc/network/interfaces" file that stores configuration information for the network. Typically, the contents as follows are included.
iface lo inet lookback
iface eth0 inet dhcp
Here "dhcp" means that an IP address will be automatically assigned from DHCP server, and if it is specified as "static", it means that the IP address specified by Raspberry Pi system will be assigned.