Setting a Fixed IP address


Home Forums Single board computers Raspberry Pi Setting a Fixed IP address

This topic contains 0 replies, has 1 voice, and was last updated by  PMB 4 years, 9 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1834

    PMB
    Keymaster

    To begin with the R-Pi gets it’s IP address via DHCP, so it can vary. Changing to fixed IP is very similar to the way it’s done in Ubuntu.

    To change to static IP address:

    sudo nano /etc/network/ interfaces

    replace line “iface eth0 inet dhcp” with:

    iface eth0 inet static
    address 192.168.1.20
    netmask 255.255.255.0
    gateway 192.168.1.10

    Check also that nameserver points to your gateway or ISP nameserver:

    sudo nano /etc/resolv.conf
    nameserver 192.168.1.10

    You can restart the network interface but it’s easier just to reboot:

    sudo reboot

    Wait a bit for the reboot then log in and check the new config:

    ifconfig

    NOTE: nano is my preferred editor. I also use mc for quick simple file management.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.