We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

4 posts • Page 1 of 1
gilius
Posts: 121
Joined: Sun Apr 08, 2018 1:12 pm

Problems setting static IP address

Fri Sep 25, 2020 5:12 pm

I tried setting a static IP address as follows:

sudo nano /etc/dhcpcd.conf file with:
interface usb0
static ip_address=192.168.42.42/24

Unfortunately, it keeps changing from 192.168.42.XXX dynamically!

One thing I noticed between Raspbian and Gentoo on Pi is that the dhcpcd.conf file is empty on the former, but contains many entries in the latter.

Anyone know how to get the IP to stick in Gentoo?

K9spud
Posts: 29
Joined: Fri Nov 22, 2019 5:38 am

Re: Problems setting static IP address

Mon Sep 28, 2020 4:53 am

I just right click on the "NetworkManager" applet, "Edit Connections," and set up my wired connection with a static IP address there.

This seems to make stuff in /etc/NetworkManager/system-connections instead of messing with /etc/dhcpcd.conf. Maybe you should give the NetworkManager applet a try?

sakaki
Posts: 562
Joined: Sun Jul 16, 2017 1:11 pm

Re: Problems setting static IP address

Sat Oct 10, 2020 4:59 pm

Hi gilius,

as K9spud notes, using the NetworkManager applet is probably the easiest way to achieve what you want here.

You can also use the nmcli tool to configure a fixed IP address for an interface from the command line. For some simple examples of its use, please see this script.

hth, sakaki

pidd
Posts: 6603
Joined: Fri May 29, 2020 8:29 pm

Re: Problems setting static IP address

Sat Oct 10, 2020 5:12 pm

Have you rebooted the Pi or reloaded dhcpcd after setting the static IP?

Sometimes the router won't let go of the old IP assignment until lease times out. A way to speed this is up is to temporarily also set the static IP in the router, reboot the Pi, check the ip (sometimes it takes a few minutes to change over), then remove the static IP from the router. Don't leave the static IP set up in the router and the IP at the same time, they tend to have an argument when it comes to renew the lease.

I'm sure there are better ways but I know this works for me so I use it.

4 posts • Page 1 of 1

Return to "Gentoo"

AltStyle によって変換されたページ (->オリジナル) /