How to change LAN addr with command line?

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
smegma
DD-WRT Novice


Joined: 17 Apr 2021
Posts: 1

PostPosted: Sat Apr 17, 2021 18:23    Post subject: How to change LAN addr with command line? Reply with quote
How to change LAN addr with command line?
Hi there. I known we can change LAN address in Setup -> Basic Setup. After applying settings, the change takes effect immediately without reboot.
I want to know the command line equivalent of this.
What I tried is
1. ifconfig br0 <new Lan IP addr of the router>
2. change /tmp/dnsmasq.conf, /tmp/dnsmasp.lease, /tmp/resolv.conf accordingly
3. killall dnsmasq && dnsmasq --conf-file=/tmp/dnsmasq.conf
3. iptables -F to flush all the rules so that firewall won't filter out any thing.

My computer was able to switch to new ip addr via DHCP. Thus changes to dnsmasq are working. Also "ping <new Lan ip addr of the router>" works. But "ping <the WAN ip addr of the router>" doesn't return anything. So, it seems the two vLans(vlan1 and vlan2) on my ddwrt are not forwarding packets to each other?

How should I config my ddwrt to make my computer able to access WAN? Anyone could help?
Sponsor
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14125
Location: Texas, USA

PostPosted: Sat Apr 17, 2021 19:21    Post subject: Reply with quote
We have zero clue what router and build of DD-WRT you are running. That will determine a few things, like where to move this post to as it clearly states at the top of this forum section that this is not for router help.
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
u2n
DD-WRT Novice


Joined: 19 May 2017
Posts: 20
Location: TN<>MI, US

PostPosted: Mon May 10, 2021 14:04    Post subject: Reply with quote
kernel-panic69 wrote:
We have zero clue what router and build of DD-WRT you are running. That will determine a few things, like where to move this post to as it clearly states at the top of this forum section that this is not for router help.

Should there be a designated subforum for questions like this? Among other things, that would make the mod job easier; Answer: 'Moved to Router Help subforum'.

The rationale is proper organization of data; keep hardware-specific answers in their place, and generic in theirs. If not, search indexing will bring users to threads like this, only to find no answer, and the OP has fled!

An example answer that would apply to all hardware platforms in this specific case might be:

Quote:
First understand that:
    * Router configs are stored in nvram and the variables may differ by hardware.
    * On boot, environment variables and config files are generated dynamically - and placed in RAM (/tmp) - using the flashable nvram variable values.
    * When the config is changed in the GUI, scripts are run to update other variables and /tmp files to make everything work.
    * After modifying values directly at the CLI, the same scripts may be run upon executing 'nvram commit' (a reboot is safest).
So at the CLI, a general approach would be to collect nvram for each configuration desired (nvram show > configX.txt), then diff the files.

Then change just the LAN address (or whatever is desired, Ex. lan_ipaddr=w.x.y.z), commit, reboot, generate a new nvram output file and verify it's the same as the one made from GUI changes. If not, evaluate changing any differing values directly.

This has been an awkward arrangement here for many years, with generic info peppered throughout the subforums. Maybe it's time to take a less hardware-centric view and add the Router Help subforum?

_________________
My old self (phonetics-R-fun)
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum