techforay
Posts: 47
Joined: Thu Dec 27, 2012 1:28 am
Location: Puyallup Wa. USA

Static IP Address [ARCH]

Thu Jun 11, 2020 12:07 am

I am trying to configure a static IP address for a raspberry pi that i am running arch arm on. I have a wired eth0 connection. I think i am supposed to edit the /etc/dhcpcd.conf file to add the following

Interface eth0
Static ip_address=the IP address i want as static
Static routers=gateway address
Static domain_name_servers+8.8.8.8 8.8.4.4

I have tried this several times and am not getting it to work. Can someone give me some help.

bassamanator
Posts: 49
Joined: Wed Jun 10, 2020 7:04 am

Re: Static IP Address

Thu Jun 11, 2020 4:32 am

I think you're just slightly off. Here's my dhcpcd.conf:

Code: Select all

# My static IP configuration for wired connection:
interface eth0
static ip_address=192.168.1.100/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 1.1.1.1 1.0.0.1

# My static IP configuration for wireless connection:
interface wlan0
static ip_address=192.168.1.101/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 1.1.1.1 1.0.0.1
| Raspberry Pi 4-8GB | 2.0GHz | over_voltage@5 |
| Raspberry Pi OS 32bit |
| https://github.com/bassamanator/raspberrypi-scripts |

techforay
Posts: 47
Joined: Thu Dec 27, 2012 1:28 am
Location: Puyallup Wa. USA

Re: Static IP Address

Thu Jun 11, 2020 6:35 am

Well I got it working by enabling dhcpcd. I dont know where i was get an ip address from before but i am concerned about something. When i run a ipconfig command it showsthe dynamic ip address 10.0.0.61/24. When i ssh into the pi can get in with both the dynamic and the static ip 10.0.0.75. Also when i run "ip addes show" i get the below info for the eth0 . It looks like i have two ip address assigned to eth0.

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether dc:a6:32:23:c6:af brd ff:ff:ff:ff:ff:ff
inet 10.0.0.61/24 brd 10.0.0.255 scope global dynamic noprefixroute eth0
valid_lft 85655sec preferred_lft 85655sec
inet 10.0.0.75/24 brd 10.0.0.255 scope global secondary noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::9b2a:f9bc:25a0:e392/64 scope link noprefixroute
valid_lft forever preferred_lft forever

Is this a problem. will it cause a conflict? I look at the router admin page for the connected devices. At first it shows the dynamic 10.0.0.62 and then changes to the static 10.0.0.75

dustnbone
Posts: 258
Joined: Tue Nov 05, 2019 2:49 am

Re: Static IP Address

Thu Jun 11, 2020 7:21 am

It shouldn't be a problem, you can assign multiple IPs to an interface.

But to avoid confusion I'd modify your dhcpcd.conf to prevent it from grabbing the dynamic IP from your router. Easiest way to do that is adding

Code: Select all

denyinterfaces eth0

techforay
Posts: 47
Joined: Thu Dec 27, 2012 1:28 am
Location: Puyallup Wa. USA

Re: Static IP Address

Thu Jun 11, 2020 4:19 pm

dustnbone wrote:
Thu Jun 11, 2020 7:21 am
It shouldn't be a problem, you can assign multiple IPs to an interface.

But to avoid confusion I'd modify your dhcpcd.conf to prevent it from grabbing the dynamic IP from your router. Easiest way to do that is adding

Code: Select all

denyinterfaces eth0
Where do i add this in the file. If i add it before my interface eth0 line it doesn’t grab the static address that i list and if i add it after the script i added it still grabs the dynamic address. I don’t think i am getting the dynamic IP address from the dhcpcd file. Dhcpcd was disabled and i was still getting the dynamic address. This statement may lack a lot of understanding. There is a lot i am still learning.

Return to “Arch”