Two comman ways to make a connection with Raspberry PI.
1. LAN port physical network cable
2. Wifi connection
For LAN/ Ethernet type connection we can set a fixed ip for ease of access. If you were to use a router then a fixed ip can be reserved at router configuration page. Router will assign the same ip referring to device MAC address.
IP can be reserved for connection type 1 or 2.
Fixed IP for Wired connection without router
How if we need fixed ip conenction for device direct connection without router or DHCP server. Well we can configure at raspberry pi device itself as below;
Connect to Raspberry PI using SSH (need to establish connection using default auto ip config type. Can get the ip as in explained here
In the terminal type as below;
sudo nano /etc/dhcpcd.conf
Remove ‘#’ at following line and set your preferred IP address
#Example static IP configuration:
#static domain_name_servers=192.168.0.1 18.104.22.168 fd51:42f8:caae:d92e::1
Done. Press Ctrl+X then type ‘Y’ and enter.
Reboot Raspberry PI. Your fixed ip for LAN port should be working now. Make sure provide a fixed ip to your PC LAN port as well.