Assigning a permanent IP address?

Discussion in 'Hardware' started by kv4jw, Feb 18, 2020.

  1. kv4jw

    kv4jw New Member

    How do I assign a permanent IP address to my Rpi3/ADSBX?
     
  2. MDA

    MDA Administrator Staff Member

    It depends, you can set fixed IP on Pi itself or make IP reservation on router.
     
  3. kv4jw

    kv4jw New Member

    I think I'd like to do a fixed IP on the RPi. So basically if I do that, when the RPi boots up, it will request that specific IP address, right? Wouldn't it also be ideal to also reserve it on the router as well, so that the router wouldn't assign that IP to another device if I power off the RPi?
     
  4. MDA

    MDA Administrator Staff Member

    Edit the /etc/network/interfaces in your PI and add lines like this:
    Code:
    auto eth0
    iface eth0 inet static
    address 192.168.x.x
    netmask 255.255.255.0
    gateway 192.168.x.y
    dns-server 8.8.8.8 (optional)
    where address is Pi IP and gateway is router IP.
     
  5. wiedehopf

    wiedehopf Administrator Staff Member

    dns server isn't optional. (or does it default to the gateway?)
     
  6. Jhonny Monclair

    Jhonny Monclair Active Member

  7. MartyS

    MartyS Member

    I just do it on the router, get the MAC address of the Pi and assign a static IP address to it, on most routers the DHCP menu area has a table you can enter MAC and IP addresses.
     
  8. James

    James Guest

    Router tends to be easiest way using MAC Address ...
     
  9. JoePPi

    JoePPi New Member

    I use this to assign one or more/multiple permanent IP addresses to a single Pi but I am definitely not an expert. If you just want one use the eth0 and skip the eth0:2 etc. I like multiple IP's per Raspberry ;-)

    I believe this is not the "officially recommended" mode but it works great for me.

    And just in case you want to give each interface it's own MAC address, add:
    hwaddress ether xx:xx:xx:xx:xx:xx
    with a unique MAC address after the netmask line. I use the eth0 value + or minus 1 or 2 as long as it is unique.
     

    Attached Files:

    Last edited: Mar 30, 2020