How to configure a static IP for my desktop through /etc/config/dhcp


I'd like to configure a static IP address to my desktop computer on my home network so I can ssh into it from a laptop when I'm home. I configured my router to support VPN to that all computers on the network could benefit, but to do so I followed t tutorials which required me to directly edit my configuration files. I read elsewhere in the documentation that if I did this, I would lose the ability to use the uci or luci systems unless I wanted to break everything. I'm comfortable with editing configuration files if I can figure out what to put in them. So, I'm wondering if someone could provide me an example snippet for /etc/config/dhcp which would be equivalent to what luci would do if I added a static ip? Thanks in advance!


I saw in the WIki an example of how to use uci commands to get a static IP.

uci add dhcp host
uci set dhcp.@host[-1].name="mydesktop"
uci set dhcp.@host[-1].mac="11:22:33:44:55:66 aa:bb:cc:dd:ee:ff"
uci set dhcp.@host[-1].ip=""
uci set dhcp.@host[-1].duid="000100004fd454041c6f65d26f43"
uci set dhcp.@host[-1].hostid="123"

Is this still the right approach? How does this translate to the configuration file syntax?

config host
	option name 'mydesktop'
	option mac '11:22:33:44:55:66 aa:bb:cc:dd:ee:ff'
	option ip ''
    option duid '000100004fd454041c6f65d26f43'
    option hostid '123'

For reference, the semantics are here


Thank you so much! That appears to have worked out very well!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.