[SOLVED] How to change router IP

Hi,

I'm trying to change router IP. Instead of 192.168.1.1 I'd like to set something else (usually 192.168.1.0)

I tried to change it in the network file:

config interface 'lan'
	option force_link '1'
	option type 'bridge'
	option proto 'static'
	option ipaddr '192.168.1.0'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option macaddr '76:a0:51:44:bb:aa'
	option ifname 'eth0.1'

but it does not work. After the reboot I can't anymore access by the lan to the router. Do you know what I forget ?
Thank you
BR

The first and the last IP address in a subnet are reserved.
For your configuration

option ipaddr '192.168.1.0'
option netmask '255.255.255.0'

the reserved IP addresses are 192.168.1.0 and 192.168.1.255.
You cannot assign them to hosts or to the router. The allowed range of IP addresses for your configuration is from 192.168.1.1 to 192.168.1.254.
Also keep in mind the DHCP range, which must not overlap with statically assigned addresses.

1 Like

You can't have a IP address that ends with .0 or .255, that's not a limitation of OpenWrt/Linux.
http://www.ipbalance.com/tcpip/tcpip-general/100-ip-addressing-ending-0-or-255.html

1 Like

If you really want to you can but first you must change the netmask. ( notice the 254 )

option ipaddr '192.168.1.0'
option netmask '255.255.254.0'

http://jodies.de/ipcalc?host=192.168.1.0&mask1=23&mask2=

Address:   192.168.1.0           11000000.10101000.0000000 1.00000000
Netmask:   255.255.254.0 = 23    11111111.11111111.1111111 0.00000000
Wildcard:  0.0.1.255             00000000.00000000.0000000 1.11111111
=>
Network:   192.168.0.0/23        11000000.10101000.0000000 0.00000000 (Class C)
Broadcast: 192.168.1.255         11000000.10101000.0000000 1.11111111
HostMin:   192.168.0.1           11000000.10101000.0000000 0.00000001
HostMax:   192.168.1.254         11000000.10101000.0000000 1.11111110
Hosts/Net: 510                   (Private Internet)

Might help to read up read up on subnetting

2 Likes

(I drafted this and never hit post, but @mbo2o covered most of it:)

Not entirely accurate...I've assigned...it does behave differently, though. Likely because of routers along the path needing upgrade...or the subnet divided in some router along the way (making the 0 or 255 invalid). Why do I say this?

Because I've passed traffic.

Of course, when you assign .0 or .255, the subnet used isn't a /24, and the IP's used still cannot be on a bit boundary of the subnet used (wish is the actual issue).

.0 is not a reserved address in IPv4. It may be that OpenWRT won't accept it, but it is a perfectly valid IPv4 address. If it is a "good choice" for an address is a different question, but it certainly is a valid IPv4 address (as is .255 that is not at the "end" of the net block).

See, for example

I did provide a link to be fair (which people seems to have overlooked) and I did assume that his intention wasn't to also change netmask.

Make sure all your routers and statically assigned devices are on the same subnet also if that is your intention

Hello,
thank you for explanation.
Case solved for me
BR
Sebastien

1 Like

Glad you found a solution. Please consider consider:

Editing the title - by using the pencil icon, and appending "[SOLVED]"

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