วันพุธที่ 8 พฤศจิกายน พ.ศ. 2560

Raspberrypi: How to setting static IP

การตั้งค่า IP [Ethernet and WiFi]

+----------------------------------------------------+
$ sudo nano /etc/network/interfaces                |
+----------------------------------------------------+
# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

#iface eth0 inet manual
auto eth0
iface eth0 inet static
    address 192.168.100.10
    #gateway 192.168.100.1
    netmask 255.255.255.0
    network 192.168.100.0
    broadcast 192.168.100.255

allow-hotplug wlan0
#iface wlan0 inet manual
iface wlan0 inet static
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    address 192.168.1.160
    gateway 192.168.1.1
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    dns-nameservers 8.8.8.8 8.8.4.4


allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf




+----------------------------------------------------+
+----------------------------------------------------+
save and exit
Ctrl + X >> Y

+----------------------------------------------------+
Restart network or Reboot
# /etc/init.d/networking reload

# reboot

+----------------------------------------------------+
Show IP
# ifconfig


ไม่มีความคิดเห็น:

แสดงความคิดเห็น