Descent to Hades of Raspberry Pi

Welcome to the computer world of Raspberry!

OS installation

Get the image from its offical website and extract it into the SD card by using the command 7za x file.zip. On Linux, dd is the image writing tool:

1
dd bs=4M if=2019-07-10-raspbian-buster.img of=/dev/sdX status=progress conv=fsync

For Pi3, there exists wireless card, so use sudo raspi-config to enable it.

change source list:

https://mirror.tuna.tsinghua.edu.cn/help/raspbian/

Enable WiFi network

1
2
sudo apt install raspberry-headers
git clone

Share network to RPi by ethernet

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@inspiron-7537 shane]# iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i enp3s0f1 -o internet0 -j ACCEPT
[root@inspiron-7537 shane]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Then use arp we will find the address:

1
2
3
4
5
[root@inspiron-7537 shane]# arp
Address HWtype HWaddress Flags Mask Iface
apollo.archlinux.org (incomplete) enp3s0f1
192.168.137.244 ether b8:27:eb:80:22:52 C enp3s0f1
_gateway ether c4:ca:d9:38:48:e5 C wlp2s0

The IP of Pi is 192.168.137.244.

Config on Host Linux computer

First three commands

1
2
3
iptables -t nat -A POSTROUTING -o wlp2s0 -j MASQUERADE
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i enp3s0f1 -o wlp2s0 -j ACCEPT

If the first iptables is wrong, that’s because this arch has just upgraded its kernel so it needs reboot. But if it’s the problem of nat you might

1
2
sudo modprobe ip_tables
sudo echo "ip_tables" >> /etc/modules.

Second three commands

1
2
3
iptables -I INPUT -p udp --dport 67 -i enp3s0f1 -j ACCEPT
iptables -I INPUT -p udp --dport 53 -s 192.168.137.0/24 -j ACCEPT
iptables -I INPUT -p tcp --dport 53 -s 192.168.137.0/24 -j ACCEPT

Now it should be ok.

But sometimes we may face the problem of cannot connect to the wifi web. This is because the ip route takes ethernet as the default gateway. Check by ip route.
Then delete one: sudo route del default gw 192.168.137.1 enp3s0f1

RPi serving as NAS

turn on root

1
2
3
4
apt install samba
apt install ntfs-3g # mount ntfs
smbpasswd -a pi
sudo mkdir /mnt/ext4 /mnt/ntfs

Edit /etc/fstab

1
2
/dev/sda1   /mnt/ext4    ext4    defaults    0   0
/dev/sda2 /mnt/ntfs ntfs defaults 0 0

samba conf

For example

1
2
3
4
5
[linux-share]
comment = EXT4 Partition
path = /mnt/ext4
public = no
read only = no

Mount from Windows

我的电脑 > 右键”计算机” > 添加一个网络位置

Mounf from Linux

an example from /etc/fstab

1
//rpi4/win-share        /mnt/hard-disk-ntfs     cifs    _netdev,username=pi,password=shallwetalk,iocharset=utf8,uid=wsd,gid=wsd 0       0

离线下载

Install aria2c and webui-aria2

Driver development for Raspberry Pi Digital Signature

Comments

You forgot to set the shortname for Disqus. Please set it in _config.yml.
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×