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.6.2 How to Set up Static IP Address in Raspberry Pi
The default setting for the IP address in the Raspberry Pi system is stored in "/etc/network/interfaces" file. Normally, the contents as follows are stored.
iface lo inet lookback
iface eth0 inet dhcp
iface wlan0 inet dhcp
wpa-ssid "wifissid"
wpa-psk "wifipassword"
To fix IP address in the Raspberry Pi system, you need to modify the contents of the "/etc/network/interfaces" file.
To fix the IP address of wired network, change the contents of the "eth0" adapter. To fix the IP address of wireless network, change the contents of the "wlan0" adapter. Change the DHCP method to "static" for the item to fix IP address, and modify the contents as follows. The following is an example of fixing IP address to a wired network.
iface eth0 inet static
address 192.168.1.202
netmask 255.255.255.0
gateway 192.168.1.0
Specify the desired static IP address for the "address" field, set "255.255.255.0" for the "netmask" field, and specify the IP address of the DHCP server (network server, router) for the "gateway"
After changing the file in this way and rebooting, the Raspberry Pi system is given an IP address of "192.168.1.202".