### Set Fix IP Address

To set a fixed IP address, options shared for OS Stretch, Jessie and Raspian.
Note
The examples are using the Ethernet port eth0.
The same can be applied for the WLAN port, like wlan0.
To check the configuration, use the command $ifconfig.
Check Network Devices
ifconfig
Obtain Gateway Address
netstat -r -n
OS Stretch - Set Fix IP Address
Edit:
sudo nano /etc/dhcpcd.conf
Add (with example data):
Static IP address
For Ethernet - note the change of eth0 to enxb827eb11442e
interface enxb827eb11442e
static ip_address=192.168.0.59/24
static routers=192.168.0.1
For wlan
interface wlan0
static ip_address=192.168.0.60/24
static routers=192.168.0.1
Then restart dhcp or reboot.
sudo systemctl restart dhcpcd
OS Jessie - Set Fix IP Address
Edit:
sudo nano /etc/dhcpcd.conf
Add (with example data):
Static IP address
interface eth0
static ip_address=192.168.0.79/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
Then restart dhcp or reboot.
sudo systemctl restart dhcpcd
OS Raspian - Set Fix IP Address
Edit:
sudo nano /etc/network/interfaces
Replace:
iface eth0 inet dhcp
By (with example data):
iface eth0 inet static
address 192.168.178.28
netmask 255.255.255.0
gateway 192.168.178.1
Then reboot.
Note: if the WLAN is up, but no internet connection, then check:
ping 8.8.8.8
if OK, then nameserver issue.
Check
sudo nano /etc/resolv.conf
Change the nameserver entry to the gateway adress.

Changed: 2018-06-02 13:11, Category: Raspberry Pi, File: T6C234M1716.htm, ID: 1716