[Help] NVRAM vaules for Static IP on WAN

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


Joined: 25 Jun 2020
Posts: 3

PostPosted: Mon Nov 14, 2022 9:37    Post subject: [Help] NVRAM vaules for Static IP on WAN Reply with quote
Hi, I have default settings for DHCP and want to change ‘programmatically’ by setting NVRAM values to a STATIC WAN IP setup, which values do I need to change?
Sponsor
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1857
Location: Hung Hom, Hong Kong

PostPosted: Mon Nov 14, 2022 9:59    Post subject: Re: [Help] NVRAM vaules for Static IP on WAN Reply with quote
solidus1983 wrote:
Hi, I have default settings for DHCP and want to change ‘programmatically’ by setting NVRAM values to a STATIC WAN IP setup, which values do I need to change?

The following threads looks interesting and related. The focus should be "wan_ipaddr".

DD-WRT :: View topic - Changing client mode network from script - WZR-HP-G300NH2
https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=696688

DD-WRT :: View topic - Track WAN IP changes using a server's log
https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=679958

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
solidus1983
DD-WRT Novice


Joined: 25 Jun 2020
Posts: 3

PostPosted: Mon Nov 14, 2022 10:01    Post subject: Reply with quote
thank you for your reply, will read up on this now. If i get stuck i will post on here again.
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1857
Location: Hung Hom, Hong Kong

PostPosted: Mon Nov 14, 2022 12:15    Post subject: Reply with quote
solidus1983 wrote:
thank you for your reply, will read up on this now. If i get stuck i will post on here again.

I think you need to choose "Static IP" in Setup->Basic Setup-> WAN Connection Type. Have fun with scripting.

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
solidus1983
DD-WRT Novice


Joined: 25 Jun 2020
Posts: 3

PostPosted: Mon Nov 14, 2022 12:17    Post subject: Reply with quote
Yeah i know it works in GUI, however i perfer CLI so trying to do it in cli.
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1857
Location: Hung Hom, Hong Kong

PostPosted: Tue Nov 15, 2022 3:39    Post subject: Reply with quote
solidus1983 wrote:
Yeah i know it works in GUI, however i perfer CLI so trying to do it in cli.
Other useful values and commands:
Code:
~# nvram show | grep -i -E 'wan_i[fp]'
size: 35013 bytes (30523 left)
wan_ifname2=vlan2
wan_ifnames=vlan2
wan_iface=vlan2
wan_ipaddr=111.222.33.44
wan_ifname=vlan2
ddns_wan_ip=1

~# ifconfig $(nvram get wan_iface)
vlan2     Link encap:Ethernet  HWaddr 2E:x4:xx:xx:xx:A4
          inet addr:111.222.33.44  Bcast:110.235.7.255  Mask:255.255.254.0
          ....

~# ifconfig eth1 down
~# ifconfig eth1 new_ip_addr netmask 255.255.255.0
~# ifconfig eth1 up

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1857
Location: Hung Hom, Hong Kong

PostPosted: Tue Nov 15, 2022 3:45    Post subject: Reply with quote
mwchang wrote:
solidus1983 wrote:
Yeah i know it works in GUI, however i perfer CLI so trying to do it in cli.
Other useful values and commands:
Code:
~# nvram show | grep -i -E 'wan_i[fp]'
size: 35013 bytes (30523 left)
wan_ifname2=vlan2
wan_ifnames=vlan2
wan_iface=vlan2
wan_ipaddr=111.222.33.44
wan_ifname=vlan2
ddns_wan_ip=1

~# ifconfig $(nvram get wan_iface)
vlan2     Link encap:Ethernet  HWaddr 2E:x4:xx:xx:xx:A4
          inet addr:111.222.33.44  Bcast:110.235.7.255  Mask:255.255.254.0
          ....

~# ifconfig eth1 down
~# ifconfig eth1 new_ip_addr netmask 255.255.255.0
~# ifconfig eth1 up


Another thread that might interest you:

DD-WRT :: View topic - Script to set a random MAC address for WAN when booting?
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=268272&start=15

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
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