Skip to content

Instantly share code, notes, and snippets.

@MaiLinhGroup
Created February 4, 2019 22:27
Show Gist options
  • Save MaiLinhGroup/87ac3001c3385b83930a3254b28c0b84 to your computer and use it in GitHub Desktop.
Save MaiLinhGroup/87ac3001c3385b83930a3254b28c0b84 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Assign static ip to raspberry pi:"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo "Choose unused IP adress not appear in following list:"
sudo arp-scan --interface=wlp4s0 --localnet
read -p "192.168.1." freeIP
rm eth0
touch eth0
echo "auto eth0" >> eth0
echo "allow-hotplug eth0" >> eth0
echo "iface eth0 inet static" >> eth0
echo "address 192.168.1.$freeIP" >> eth0
echo "netmask 255.255.254.0" >> eth0
echo "gateway 192.168.0.1" >> eth0
echo "Adjust path to sd card:"
df -h
read -p "path to sd card:" sdpath
echo $sdpath
rm $sdpath/etc/network/interfaces.d/eth0
cp eth0 $sdpath/etc/network/interfaces.d/eth0
#mkdir /run/media/mailngu/root/home/pirate/.ssh
#ssh-keygen -t ecdsa -f /run/media/mailngu/root/home/pirate/.ssh/id_ecdsa
echo "-------------------------"
cat $sdpath/etc/network/interfaces.d/eth0
echo "-------------------------"
#auto eth0
#allow-hotplug eth0
#iface eth0 inet static
#address 192.168.1.7
#netmask 255.255.254.0
#gateway 192.168.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment