Hi!
I want my OpenWRT devices to set a static IP if no DHCP is available in the network, or if DHCP fails for whatever reason. Is there an OpenWRT-Way of doing this?
Thanks a lot
zachso
The content of this topic has been archived on 20 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.
Hi!
I want my OpenWRT devices to set a static IP if no DHCP is available in the network, or if DHCP fails for whatever reason. Is there an OpenWRT-Way of doing this?
Thanks a lot
zachso
here we go.. ( used in trunk )
config interface 'lan'
option type 'bridge'
option proto 'dhcp'
option ifname 'eth0.1'
config interface 'lans' #lan static IP
option 'ifname' 'br-lan'
option 'proto' 'static'
option 'ipaddr' '172.16.211.18'
option 'netmask' '255.255.0.0'
you may do so with wan
other way aroud i.e. 'lan' as static and alias as dhcp did NOT work for me
CAVE! ifstatus lan will show the static address of 'lans' until given IP form dhcp-server
(Last edited by 3zl on 16 Apr 2014, 07:55)
To make everything working, you should specify dns and gateway too. This is config from my wr1043nd v2, ifnames are different on different devices.
vi /etc/config/network
config interface 'lan'
option ifname 'eth1'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
config interface 'wan'
option ifname 'eth0'
option proto 'static'
option ipaddr '172.16.1.21'
option netmask '255.255.255.0'
option gateway '172.16.1.1'
option dns '78.138.98.82 192.121.121.14'
(Last edited by nozombian on 16 Apr 2014, 09:09)
The discussion might have continued from here.