Armbian hostname and WiFi configuration
In previous post i have described installation of Armbian on Orange Pi PC Plus. Now is the time for some initial configuration
(hostname and WIFI setup).
Table of Contents
Changing hostname
- Check current hostname with
hostname
- Check current fully qualified domain name (or FQDN) with
hostname --fqd
- Set new hostname:
sudo hostname pi
- Update
/etc/hostname
for Debian to get new hostname after reboot Update
/etc/hosts
so that FQDN is before short localhost next to IP:127.0.0.1 pi.example.com pi localhost
::1 pi.example.com pi localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Reboot with
sudo reboot
Configuring WIFI to work with WPA2
There are various ways for configuring WIFI with wpa_suplicant. You may consider settings things up in /etc/network/interfaces
if you want WIFI
to be started automatically upon system startup. I have decided on another approach: using script for starting all manually.
- wpa_supplicant should be installed but needs to be run as root:
sudo wpa_supplicant -v
.` - In the next steps you will need BSSID (access point MAC address) and channel. Turn on your WIFI card with
sudo ifconfig wlan0 up
and scan for
your network withsudo iwlist wlan0 scan | egrep 'Address|ESSID|Channel'
. - Prepare configuration file for wpa_supplicant in
/etc/wpa_supplicant
folder. You could have more files there with different names. Our file
will be namedwifi.conf
. Adjust the content of the file: replace
00:14:6C:AE:EA:AE
,my-wifi
andP@ssw0rd
with
your access point MAC address, your WIFI network name and your WIFI password respectively:ctrl_interface=DIR=/var/run/wpa_supplicant
network={
bssid=00:14:6C:AE:EA:AE
ssid="my-wifi"
scan_ssid=1
key_mgmt=WPA-PSK
psk="P@ssw0rd"
}
Create a script and add execute permissions. Replace
my-wifi
,8
andwifi.conf
with
your WIFI name, channel and WPA supplicant configuration file name:#!/usr/bin/env bash
DEV=$(iw dev | awk '/Interface/ {interf=$2} END {print interf}')
DHCL_PIDFILE=/var/run/dhclient-$DEV.pid
WPA_PIDFILE=/var/run/wpa_supplicant-$DEV.pid
if [[ -f $DHCL_PIDFILE ]] && kill -9 $(cat $DHCL_PIDFILE)
then
dhclient -v -r $DEV
echo "IP address released"
fi
if [[ -f $WPA_PIDFILE ]] && kill -9 $(cat $WPA_PIDFILE)
then
echo "WPA supplicant killed"
fi
killall wpa_supplicant
echo "wpa_supplicant killed :)"
ifconfig -v $DEV down
sleep 1
ifconfig -v $DEV up
echo "$DEV interface is up again"
iwconfig $DEV essid 'my-wifi' channel 8
echo "starting wpa_supplicant.."
sleep 2
wpa_supplicant -B -dd -i$DEV -P$WPA_PIDFILE -c/etc/wpa_supplicant/wifi.conf
sleep 2
echo "getting IP address.."
dhclient -v -pf $DHCL_PIDFILE $DEV
Run the script as root
Armbian hostname and WiFi configuration的更多相关文章
- 最简单的RASPBERRY PI wifi配置
Setting up Wifi with the Command Line SIMON MONK This tutorial works best if your router is broad ...
- Docker Network Configuration 高级网络配置
Network Configuration TL;DR When Docker starts, it creates a virtual interface named docker0 on the ...
- 树莓派 Zero W——随身钥匙扣
前言 原创文章,转载引用务必注明链接.水平有限,如有疏漏,欢迎指正. 本文使用Markdown写成,为获得更好的阅读体验和正确的格式显示,请访问我的博客原文: http://www.cnblogs.c ...
- 【译】Android 6.0 Changes (机翻加轻微人工校对)
Android 6.0 Changes In this document Runtime Permissions Doze and App Standby Apache HTTP Client Rem ...
- Android M新特性之Behavior Changes
1.Runtime Permissions On your apps that target the M Preview release or higher, make sure to check f ...
- 分布式Hadoop安装(一)
本文旨在介绍通过两台物理节点,实现完全分布式hadoop程序的部署 writen by Bob Pan@20140609 环境介绍: 主机名 机器IP 用途 描述 Hadoop0 192.168.80 ...
- hadoop完全分布式模式的安装和配置
本文是将三台电脑用路由器搭建本地局域网,系统为centos6.5,已经实验验证,搭建成功. 一.设置静态IP&修改主机名&关闭防火墙(all-root)(对三台电脑都需要进行操作) 0 ...
- Hadoop1.1.2伪分布式安装笔记
一.设置Linux的静态IP 修改桌面图标修改,或者修改配置文件修改 1.先执行ifconfig,得到网络设备的名称eth0 2.编辑/etc/sysconfig/network-scripts/if ...
- 智传播客hadoop视频学习笔记(共2天)
第一天:1.答疑解惑• 就业前景• 学习hadoop要有什么基础• hadoop会像塞班一样,热一阵子吗• hadoop学习起来容易还是困难• 课堂上的学习方法(所有实验必须按照要求做,重原 ...
随机推荐
- [洛谷P1750]KC喝咖啡
题目大意:给你n个物品,每个物品有一个价值$v_i$和一个时间$t_i$,要你取m个物品,使得他们的美味度($\frac{\sum v_i}{\sum t_i}$)最大,求这个美味度. 解题思路:由于 ...
- ajax 不执行
1.get形式访问: 一个相同的URL 只有一个结果,所以 第二次访问的时候 如果 URL字符串没变化 浏览器是 直接拿出了第一次访问的结果,post则不会 解决办法: 1.url+new Date( ...
- jquery IE7 下报错:SCRIPT257: 由于出现错误 80020101 而导致此项操作无法完成
非IE(内核)浏览器运行正常,在IE中运行异常,一般考虑为js中多了符号. 常见的有: 1.上面的html注释"<!-- -->",这种 ...
- ubuntu 各种窗体操作
通用 ctrl+alt+0~9 改变窗体大小和是否显示 alt+F4 关闭窗体菜单键+相应启动器位置的编号打开程序 ctrl+pageup/pagedown 在tab间移动 ctrle+shift+p ...
- 智课雅思词汇---十、pend是什么意思
智课雅思词汇---十.pend是什么意思 一.总结 一句话总结:[词根含义]:悬挂,垂;称量;支付 词根:-pend-, -pens- [词根含义]:悬挂,垂;称量;支付 [词根来源]:来源于拉丁语动 ...
- BZOJ 4448 主席树+树链剖分(在线)
为什么题解都是离线的-- (抄都没法抄) 搞一棵主席树 1 操作 新树上的当前节点设成1 2 操作 查max(i-xx-1,0)那棵树上这条路径上有多少个点是1 让你找经过了多少个点 查的时候用dee ...
- jsp输出金字塔
<% String str = ""; for(int i = 1; i <= 5; i++){ for(int j = 1; j <= 5-i; j++){ s ...
- P3227 [HNOI2013]切糕
题目描述 经过千辛万苦小 A 得到了一块切糕,切糕的形状是长方体,小 A 打算拦腰将切糕切成两半分给小 B.出于美观考虑,小 A 希望切面能尽量光滑且和谐.于是她找到你,希望你能帮她找出最好的切割方案 ...
- poj2823/hdu3415 - 数据结构 单调队列
poj2823 题目链接 长度为N的数组,求宽度k的滑动窗口在数组上滑动时窗口内的最大值或最小值 如果用单调队列做,求最小值时,队列应该严格递增的.所以插入时,队尾大于等于插入值的元素都应被舍弃,因为 ...
- sql习题--转换(LEFT/RIGTH)
/* 转换为100-5 0100-000051-998 0001-0099812-1589 0012-01589*/IF EXISTS(SELECT * FROM sys.objects WHERE ...