nvram get wan_iface returns different interfaces

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
mjurgens
DD-WRT Novice


Joined: 12 Jan 2011
Posts: 40

PostPosted: Sat Apr 14, 2012 5:45    Post subject: nvram get wan_iface returns different interfaces Reply with quote
In the startup scripts I sleep 15 then run various commands. Among them is

nvram get wan_iface

I use this like this:
WANIF=`nvram get wan_iface` # should end up being on VLAN2
ifconfig $WANIF:0 192.168.200.2 netmask 255.255.255.0

Sometimes 192.168.200.2 gets added to ppp0:0 instead.
Now ppp0 is the real WAN interface where traffic gets sent to my ISP

After sshing to the router and seeing 192.168.200.2 added to ppp0:0 then I run nvram get wan_iface and it returns VLAN2 as it should.

When 192.168.200.2 gets added properly to VLAN2 I can access my DSL Modem on 192.168.200.1 as I intend

I could just hard code VLAN2 for adding this interface but I would like to know what is going on.

Is this a timing problem and
nvram get wan_iface only gets set VLAN2 sometime during the boot

Using dd-wrt.v24-17084_NEWD-2_K2.6_big.bin on a Linksys WRT320N

Thanks
Sponsor
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Mon Apr 16, 2012 4:13    Post subject: Reply with quote
If your intent is to get the physical interface's name (whatever the "WAN Port Assignment" option is set to) then you should use:

nvram get wan_ifname


or to get the logical interface's name (ie. a tunnel if there is one, or the physical interface name if there's not):

get_wanface


The command you're using used to do exactly the same as get_wanface but BS changed something and wouldn't explain its new or intended behavior. Regardless, it's incorrect for this task.


http://www.dd-wrt.com/wiki/index.php/Access_To_Modem_Configuration

_________________
Read the forum announcements thoroughly! Be cautious if you're inexperienced.
Available for paid consulting. (Don't PM about complicated setups otherwise)
Looking for bricks and spare routers to expand my collection. (not interested in G spec models)
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking 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 cannot attach files in this forum
You cannot download files in this forum