I want to do port fowarding of my raspberry Pi, so first I need to set static ip. I searched in Google but didn't find any easy answer.
1 Answer
If you are using Raspbian then dhcpcd
is used for network configuration. Just look into /etc/dhcpcd.conf
. At the end you will find some examples for static IP configuration. For further information look at man dhcpcd.conf
. For searching in Google you should use raspbian static ip address.
-
1How about etc/network/interfaces? I saw in some article about that?! Oct 24, 2019 at 17:18
-
1Beware that older versions of Raspbian did not use
dhcpcd
, they used Debian's networking system;/etc/network/interfaces
is part of the latter. If you are curious seeman interfaces
-- but do not use it, usedhcpcd.conf
.– goldilocks ♦Oct 24, 2019 at 19:24 -
@goldilocks Do you wanted to address Thetips4you? Or do you asked me to update my answer and refer to an unsupported Raspbian version? If there are problems with Debian networking and dhcpcd I like to link to Differences between /etc/dhcpcd.conf and /etc/network/interfaces?.– IngoOct 24, 2019 at 21:24
-
Yeah, that last comment was to the OP, and no, I don't think you need to show two different ways to accomplish this if the simpler one (
dhcpcd.conf
) works. Technically that comment (of mine) is a bit wrong in that you can make use of/etc/network
stuff with the current dhcpcd service, but it isn't necessary here and may create unwanted complications.– goldilocks ♦Oct 24, 2019 at 22:51