Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Comments on Static IP on wired LAN

Parent

Static IP on wired LAN

+1
−0

I have an Arch Linux machine connected to a LAN by ethernet. The router runs OpenWRT.

DHCP assigns IPs to this machine like 192.168.1.* - quite typical. I want the IP to always be 192.168.1.10.

Ideally, I would like to do this through configuration on the machine only, without configuring anything on the router. The machine should know to request 192.168.1.10 from DHCP, rather than relying on DHCP to choose the correct IP address. It doesn't have to be through DHCP either (I don't know that much about how LAN IPs are assigned).

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

Post
+3
−0

There are a couple of ways of handling this (on PC's in general. I do use Linux, but not Arch, and this will work).

The first way is to statically assign an IP address. While you SHOULD be able to assign a static IP address in the DHCP range, it is better to assign it outside the range (the range is configured in the DHCP server - in this case your OpenWRT router). To statically assign an IP address, you need to specify the IP address, the Netmask, the Gateway, and the nameservers.

Here is a link on how to do this in Arch: https://ostechnix.com/configure-static-dynamic-ip-address-arch-linux/

I would argue the better way is to dynamically assign a static IP address. This is not strictly speaking what you asked, but is very relevant. The idea here is to map the MAC address of the Arch Linux LAN Interface to an IP, and have the DHCP server assign it dynamically. The nice thing here is you don't need to make any changes to your Arch box, and if you shift to another network, nothing needs to change to get connectivity.

https://openwrt.org/docs/guide-user/base-system/dhcp_configuration outlines how to do this on OpenWRT.

You can find your Arch box's IP address with a command like

  ip addr show 

The MAC address is the bit after the words link/ether for the appropriate device. You will need this information to tell OpenWRT's DHCP server how to identify this box (or, strictly speaking, this particular network interface).

History
Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

`ip addr show` doesn't need `sudo` (1 comment)
`ip addr show` doesn't need `sudo`
Canina‭ wrote 9 months ago

There might be some edge case where you need to use sudo for ip addr show, but generally, that's an unprivileged command. So there should be no need for sudo in this case.