Skip to content

Instantly share code, notes, and snippets.

@deanpodgornik
Created May 13, 2016 22:02
Show Gist options
  • Save deanpodgornik/d0e23363596835a96c8b6e3036b8bf06 to your computer and use it in GitHub Desktop.
Save deanpodgornik/d0e23363596835a96c8b6e3036b8bf06 to your computer and use it in GitHub Desktop.
Raspberry Pi 2 - Raspbian - Configuration for enabling SSH over Wifi (without the need for the ethernet cable)
#Filename: /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
allow-hotplug eth0
iface eth0 inet loopback
iface eth0 inet static
address 192.168.1.70
netmask 255.255.255.0
gateway 192.168.1.254
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.80
netmask 255.255.255.0
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
post-up /var/helpers/wifi.sh
#!/bin/bash
#Filename: /var/helpers/wifi.sh
#wait a little bitch!
sleep 30
#change the metric (priority) of the route (for the wlan0 interface) - outgoing
sudo route add -net default gw 192.168.1.254 netmask 0.0.0.0 dev wlan0 metric 0
sudo route del -net default gw 192.168.1.254 netmask 0.0.0.0 dev wlan0 metric 303
#change the metric (priority) of the route (for the wlan0 interface) - outgoing
sudo route del -net default gw 192.168.1.254 netmask 0.0.0.0 dev eth0 metric 0
sudo route add -net default gw 192.168.1.254 netmask 0.0.0.0 dev eth0 metric 2
#change the metric (priority) of the route (for the wlan0 interface) - incoming
sudo route del -net 192.168.1.0 gw 0.0.0.0 netmask 255.255.255.0 dev eth0 metric 202
sudo route del -net 192.168.1.0 gw 0.0.0.0 netmask 255.255.255.0 dev eth0 metric 0
sudo route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0 metric 400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment