Code: Select all
#!/bin/bash # This script adds the fixed IP address in /etc/network/interfaces # © Renaud Olgiati 2013 Feel free to copy or modify. #Check that the script is run as root, if not relaunch with sudo if [ $UID != 0 ]; then echo "mkinitrd must be run as root." echo " " sudo /home/ron/fixed-IP exit 1 else echo "fixed-IP now running as Root" echo " " # Check eth0 is in DHCP mode if grep "iface eth0 inet dhcp" interfaces >/dev/null 2>&1; then # Modify below the addresses for your LAN; if needed ask your network administrator sed -e '/iface eth0 inet dhcp/a\ address 192.168.1.1\ netmask 255.255.255.0\ gateway $192.168.1.25\ broadcast $255.255.255.255 /iface eth0 inet dhcp/i\ s/iface eth0 inet dhcp/iface eth0 inet static/' /etc/network/interfaces > /etc/network/interfaces.tmp cp -f /etc/network/interfaces.tmp /etc/network/interfaces && rm -f /etc/network/interfaces.tmp echo Now restarting the network on teh0 echo " " ifdown eth0 && ifup eth0 else echo " " echo Fixed addresses are already present in the /etc/network/interfaces file; echo if needed edit with the following command echo sudo nano /etc/network/interfaces echo " " fi fi
Canonical (nonsensical) answer: Don't do that! Use ssh (& friends) instead!BMardle wrote:Thanks, rolgiati.
Anyone know what packages (if any) need to be installed so I can telnet and ftp to my Pi (says I in a fit of laziness)?