Skip to content

Instantly share code, notes, and snippets.

@msoranno
Last active April 16, 2017 17:16
Show Gist options
  • Save msoranno/060d1590ed771f39ef8ac77e78970dda to your computer and use it in GitHub Desktop.
Save msoranno/060d1590ed771f39ef8ac77e78970dda to your computer and use it in GitHub Desktop.
Raspberri pi 3 Static IP wlan0
#solo pondremos fija la ip de la wifi.
#Averiguamos el gateway
ip route | grep default | awk '{print $3}'
-> 192.168.1.1
#Chequeamos los DNS
root@raspberrypi:/etc/network# cat /etc/resolv.conf
# Generated by resolvconf
nameserver 80.58.61.250
nameserver 80.58.61.254
#Trabajamos con el fichero /etc/network/interfaces
1. Le hacemos backup
2. Le editamos y le dejamos asi:
# 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
auto lo
iface lo inet loopback
iface eth0 inet manual
#allow-hotplug wlan0
#iface wlan0 inet manual
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
#----ip fija
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.43
netmask 255.255.255.0
gateway 192.168.1.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
#Reiniciamos los servicios o directamente la pi.
#-------------------------------------------------
Tambien existe el metodo dhcpcd method
Leave /etc/network/interfaces at its default (as above).
Edit /etc/dhcpcd.conf as follows:-
Here is an example which configures a static address, routes and dns.
interface eth0
static ip_address=10.1.1.30/24
static routers=10.1.1.1
static domain_name_servers=10.1.1.1
interface wlan0
static ip_address=10.1.1.31/24
static routers=10.1.1.1
static domain_name_servers=10.1.1.1
ip_address is the address and size from the command above (or another unused address on the same network),
routers is the address of your router (or gateway).
domain_name_servers is the DNS address(es) from /etc/resolv.conf.
(see man dhcpcd.conf)
There is a good article on dhcpcd at https://wiki.archlinux.org/index.php/dhcpcd The Fallback profile is an alternative to static IP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment