###### tags: `Linux` `Internet` Linux 網路設定 筆記 === ## Keywords - DHCP - citation: [DHCP-Study Area](http://www.study-area.org/network/network_dhcp.htm) - LAN(Local Area Netowrk) - WLAN(Wireless LAN) - WAN(Wide Area Network) ## Instructions - ```ifconfig``` - ```iwconfig``` - ```/etc/init.d/networking restart``` - 重啟網路 - ```sudo ifdown wlan0``` - 關閉wlan0 - ```sudo ifup wlan0``` - 開啟wlan0 > [time=Wen, July 18, 2018] - ```sudo iwlist scan``` - 掃描網路 - ```sudo iwlist wlan0 scan | grep ESSID``` - 只顯示e ssid ## Setup Wi-Fi - Step 1: ```sudo vi /etc/network/interfaces``` ``` # lo auto lo iface lo inet loopback # eth0 allow-hotplug eth0 iface eth0 inet dhcp # wlan0 auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf ``` - Step 2: ```sudo vi etc/wpa_supplicant/wpa_supplicant.conf``` ``` # allow all with cipher network={ ssid="your_ssid" psk="your_password" key_mgmt=WPA-PSK # 小心不要多加空格 } ``` ### Explain - 下次開機自動偵測網路 (設定完要記得重開機) ```auto eth0``` ```auto wlan0``` - 允許熱拔插 ```allow-hotplug eth0``` - DHCP (自動取得 IP) ```iface eth0 inet dhcp``` - Static ``` iface eth0 inet static address 192.168.1.90 netmask 255.255.255.0 gateway 192.168.1.254 ``` ## 測試網路連線 ```ping [wan address]``` - ex: ```ping google.com``` ### Reference [interfaces](https://manpages.debian.org/stretch/ifupdown/interfaces.5.en.html) [SETTING WIFI UP VIA THE COMMAND LINE](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up