convert WAN to LAN port

Discussion in 'Tomato Firmware' started by SirDracula, Oct 18, 2006.

  1. SirDracula

    SirDracula Network Guru Member

    Can the WAN port be converted into a LAN port? If I don't use the WRT54G as a NAT/firewall device but rather want to use it as a switch & AP it would be very nice to get 5 LAN ports.

    Is this something that's possible to reprogram in the firmware or is it hard-wired?

    thank you
  2. tievolu

    tievolu Network Guru Member

    It's definitely possible to configure this in firmware - you can do it in DD-WRT:

    Vlan configuration is not in the Tomato gui at the moment.

    In the interests of science I just tried running the following command, as mentioned in the link above:

    brctl addif br0 vlan1
    It doesn't seem to do any harm, but it doesn't seem to work either.

    Anyone else got any ideas?
  3. SirDracula

    SirDracula Network Guru Member

    thank you very much for the DD-WRT link. i should pay more attention to that firmware, at least for its educational value.
  4. tievolu

    tievolu Network Guru Member

    I was using DD-WRT for ages before I recently switched to Tomato - DD-WRT has a huge number of features, but I never needed most of them.
  5. myersw

    myersw Network Guru Member

    I to have used DD-WRT on my wrt54gs v4 in the past. Way more features then I needed BUT the biggest reason for me to go else where was stability, including v23sp1. With Thibor 13, 14, 15c things were rock solid. Never had to cycle router or have it crash. Tomato seems to be the same and I like the graphics for bandwidth and QOS. Also like the menu system jon has developed. Currently Tomato provides everything I need and am looking forward to what he does next to make it even better.
  6. fastpakr

    fastpakr Network Guru Member

    Bump... Has anybody figured out how to reassign the WAN port yet?
  7. HennieM

    HennieM Network Guru Member

    On Thibor15c:

    Disabled WAN port in html interface, then
    ifconfig vlan1 up
    brctl addif br0 vlan1

    then it works (and you should have 5 LAN ports).

    I think that, if you don't disable the WAN port first, the firmware will try to configure the WAN port, which screws things up.
  8. fastpakr

    fastpakr Network Guru Member

    Tested, and it works like a charm! Perhaps this can be added to the next version's GUI.
  9. soganta

    soganta Network Guru Member

    I tried this and it seemed to work but for some weird reason wireless clients cant connect to wired clients,nor the webinterface of the router?
  10. fastpakr

    fastpakr Network Guru Member

    I'm seeing some weird issues suddenly as well... still trying to verify if this is the source.
  11. HennieM

    HennieM Network Guru Member

    Maybe restart the router and then do it, but the other way round. I think that's how I got it to work for more than an hour, wireless talking to wired etc., just like a normal LAN port:

    brctl addif br0 vlan1
    ifconfig vlan1 up

    I have not tried this, but you might also add the ethernet interface directly, instead of vlan1; assuming that the WAN is eth0, something like this:

    brctl addif br0 eth0
    ifconfig eth0 up
  12. tunasashimi

    tunasashimi LI Guru Member

    To see the vlan setups, run this:

    nvram show | grep vlan

    You can use the bridging method above, or simply assign all the ports to vlan0:

    nvram set vlan0ports="0 1 2 3 4 5"
    nvram set vlan1ports="5"
    nvram commit

    Should serve the same purpose as bridging, but without the overhead.

    (5 always needs to be present for some reason; 0-3 are the regular switch ports and 4 is the wan port.

    Not sure if you need in the startup script and/or if tomato is going to overwrite it... On the versions of Tomato I've used, it remembers the settings between boots and upgrades... (so far)

    WISHLIST: Would be cool if tomato did this automatically on disabling the WAN config...
  13. ny-hardcore

    ny-hardcore Network Guru Member

    Do i understand correctly that with the information in this thread i can do to following:

    1. Set Wan port to Lan
    2. Connect ethernet cable from my adsl modem to wan
    3. let adsl modem assign dhcp & port forwarding
    4. Let the wrt54 do qos and bandwith graphing etc?

    I have a adslmodem/router but want to use my wrt54 running tomato to do qos (modem doesn't) and bandwith monitoring.
    So in essence i want to use the wrt54 as a bridge to shape and monitor traffic.
    The dhcp etc. is not needed.
    And i want to avoid a router --> router --> lan setup
    Because of portforwarding , SIP etc. etc.
  14. jsmiddleton4

    jsmiddleton4 Network Guru Member

    nvram set vlan0ports="0 1 2 3 4 5"
    nvram set vlan1ports="5"

    Can this just go in the script section under admin so it runs when ever the router boots? Or do you need to telnet into the router and run all three lines?
  15. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Well it didn't seem to work in the script section. Did in the telnet access/commit. At least seems to. Still playing with a NAS device connected to the now LAN port.

    Also was wondering how you clear these commands once you do a commit?
  16. Kiwi8

    Kiwi8 LI Guru Member

    U need to telnet into the router and run the commands once, together with an "NVRAM COMMIT" afterwards. Then u dun need to run them whenever the router boots.

    Clear the commands? Just set the variables back to what they were before and do the same "NVRAM COMMIT".
  17. jsmiddleton4

    jsmiddleton4 Network Guru Member

    set the variables back to what they were before...

    Ok, and they were?

    I also agree with the suggestion to have this as an option when we turn WAN port off/disable. Seems like it could be automatic. The one I did is now a 5 port wireless AP. So far no problems.
  18. Kiwi8

    Kiwi8 LI Guru Member

    U mean u did not check what were the original values before u made the variable changes? Not good, bro. :redface:

    Anyway, depending on your hardware model and whether the port numberings are reversed:

    Original settings:

    # nvram get vlan0ports
    1 2 3 4 5*
    # nvram get vlan1ports
    0 5


    # nvram get vlan0ports
    3 2 1 0 5*
    # nvram get vlan1ports
    4 5
  19. jsmiddleton4

    jsmiddleton4 Network Guru Member

    U mean u did not check what were the original values before u made the variable changes?

    Not so Obi Wan. Not sure how to or what to send for a command to get the originals. I have two Buffalo routers and can do the command on one to see what default is.

    Thanks for providing the defaults but are those Linksys? I need the command to run on my default Buffalo to see what the defaults are.

    I'll copy them to a text file.

    Seems to be ok so far. Streaming some audio off the NAS to my Denon as I type and the NAS is plugged into the WAN now a LAN port.

    I hope Tomato can work this WAN to LAN into the firmware for when we turn off the WAN. Although I haven't had the time to read through what the Buffalo's do with the Bridge switch. Could be if you set the Buffalo's to bridge a script may mess something up. Could be nothing. Will try to find out later today.
  20. Kiwi8

    Kiwi8 LI Guru Member

    After Tomato is installed, just telnet into the router and run the following command to retrieve any default values, and note them down before u make changes to them:

  21. LLigetfa

    LLigetfa LI Guru Member

    or to see all values do:
    nvram show

    The NV in NVRAM stands for Non-Volatile which means it won't disappear when you turn off the router. There is no reason to put NVRAM SET commands in a script and in fact constantly rewriting NVRAM will wear it out.
  22. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Wear out ram? I don't quite follow you there. Its not like there are moving parts?

    You'll have keep it real simple for me. So how would you do the scripts then?
  23. Kiwi8

    Kiwi8 LI Guru Member

    Ermmm I beg to differ. NVRAM SET will only update the temporary variable in the normal RAM. Setting the temporary variable many times is ok. Only after a NVRAM COMMIT will the changes be written to NVRAM, which indeed uses a write cycle, which we want to avoid as often as possible.
  24. LLigetfa

    LLigetfa LI Guru Member

    My bad... I assumed th OP did commit.
  25. LLigetfa

    LLigetfa LI Guru Member

    Cripes, you had me doubting myself...

    So, my assumption was based in fact.
  26. jsmiddleton4

    jsmiddleton4 Network Guru Member

    I'm not exactly sure what we are talking about. you don't wear out ram. It works or doesn't. I tried to do some of these scripts via the script init field in the gui and in that script section you don't use nvram commit as the script runs when you boot the router. With telnet I did commit to write the variables to the router. What I need to still do is pull the defaults off one of the buffalo routers for the vlan defaults.
  27. Kiwi8

    Kiwi8 LI Guru Member

    Ok, I will just explain the general operations of the router.

    When it boots up, the router will grab the values from NVRAM (the actual non-volatile RAM) and creates the necessary variables in normal RAM.

    When u do a NVRAM get or set, it is not modifying anything in the NVRAM, but the variables in normal RAM, and thus the changes will not persist if u reboot your router.

    NVRAM COMMIT is to update all those variables in the normal RAM to the NVRAM in order for them to persist after a router reboot.

    Thus if u use commands such as NVRAM SET in your init script, it's ok. I am also using one command "nvram set t_features=0x0" in my init script, as I am using WRT54G_V2.2 and I need to use that command to disable the SES button page and make it display "This feature is not supported on this router."
  28. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Thanks but I understand that.

    Here is my default for vlan for the Buffalo. It looks just a little different, as one would expect, than the Linksys.

    vlan0ports=1 2 3 4 5*
    vlan1ports=0 5

    Wondering if something about those defaults would impact the script for the wan to lan. Although the one I used posted here worked fine. There is an asterik after the 5. I just double checked.
  29. Kiwi8

    Kiwi8 LI Guru Member


    In that case, the following commands will do (just run them line by line in a telnet session to the router), and u do not need to keep them in the script to run all the time:
    nvram set vlan0ports="0 1 2 3 4 5*"
    nvram set vlan1ports="5"
    nvram set manual_boot_nv=1
    nvram commit
  30. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Thanks kiwi but what will it "do"? Set it back to normal or make sure the WAN is a LAN?

    Here's what the one buffalo router has in which i already did the wan to lan:

    vlan0ports=0 1 2 3 4 5

    Also I thought the nv boot thing was for a particular group of linksys routers? I'd have to go back and look at that one to be sure....
  31. Kiwi8

    Kiwi8 LI Guru Member

    It will make the WAN to LAN.

    Yeah, the manual_boot_nv variable is checked for some group of Linksys routers who will reset the port allocation if manual_boot_nv is not equal to 1. So if your router does not reset the port allocation, then u need not set this variable to 1.
  32. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Thanks again kiwi. I did your commands including the nv boot thing and its fine. It was working before as well. I have my NAS connected to the WAN port that is now a LAN port and its working great. Its nice to have a 5 port AP. Xbox, NAS connected wired, a Wii connected wirelessly as well as an AP for people in the back of house laptops. I'll be looking at being able to expand it now.

    Edit: "if your router does not reset the port allocation" How would I know if it did or didn't? I try not to assume but if its working, my guess is its all good?
  33. Kiwi8

    Kiwi8 LI Guru Member

    Yeah, if u need the extra LAN port then feel free to convert that WAN port to LAN port. Just be sure to avoid using this port to log on to the router if u intend to reset the router settings. :)

    For your second paragraph, yep, as long as the WAN port functions as a LAN port even after reboot, the setting of the manual_boot_nv variable is not needed.
  34. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Just be sure to avoid using this port to log on to the router

    Well that's good to know. I don't think I've seen that anywhere yet. Maybe I missed it. Just by coincidence I have not but not by intent. Will make sure only devices get connected to the WAN port and the network cable to the main router will always go to a "real" LAN port.
  35. bhlonewolf

    bhlonewolf LI Guru Member

    Not quite. Typical RAM (SDRAM, DRAM, etc.) that require constant power typically don't "wear out" based on usage, though can obviously fail. NVRAM (EEPROM or flash memory the most common) is different, its main advantage is that it doesn't require power to retain data. But it does have finite erase/rewrite cycles, typically about 100,000 +/-.

    Practically speaking this is more of an issue with flash drives that you may be writing to frequently, but never thought this was a serious issue with routers. Even if you did a fresh rewrite every day, in theory it could last nearly 300 years.
  36. jsmiddleton4

    jsmiddleton4 Network Guru Member

    "...though can obviously fail."

    That's not it works or it doesn't?
  37. bhlonewolf

    bhlonewolf LI Guru Member

    OK, splitting hairs.

    My point is that "regular" RAM will will work fine and has, for all intents and purposes, unlimited writes/erases. RAM can fail for a variety of reasons, but writing/erasing isn't one of them. NVRAM is different, so I was addressing your point "you don't wear out ram" -- with NVRAM you can do exactly that. Make sense? Plenty of articles on the net regarding the structure of EEPROM for more info ... check 'em out.
  38. Des101

    Des101 Addicted to LI Member

    I know this is an old post, but did you (or anyone else) have any luck doing this?
  39. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Yes, it works.
  40. unix_guy

    unix_guy LI Guru Member

    Sorry to reply nearly 7 years later, but just stumbled across this and wanted to correct some misinformation.

    On May 29, 2009 jsmiddleton4 said "Yes, it works."
    In fact, items 1-3 in the list in Post 38 work but I don't think item 4 works.
    In other words, yes it works to convert the WAN port to a 5th LAN port, but in this mode the WRT54 will not "do qos and bandwidth graphing etc."

    This great article:

    contains the following info that explains why item 4 will no longer work:
    • vlan1 - This is the single WAN Ethernet port, to be plugged into your DSL or Cable modem. The great divide between "inside" the network and "outside" the network happens between vlan1 and br0, and this is where all of the QoS rules are applied as packets leave the network.
    In other words, this procedure converts the WRT54 from a router (LAN and WAN) into a switch (LAN only). Since there is no routing between LAN and WAN (no great divide) there is no QoS.

    Edit 1:

    Just got done doing this on my Buffalo WHR-HP-G54 w/ Tomato 1.07. It worked.

    Some notes:

    1. The vlan changes didn't take effect until I rebooted the router.

    2. I didn't need "nvram set manual_boot_nv=1" with this router.

    3. When used as a switch rather than as a router the device can't get the network time (ntp). It gets this from the WAN side, but there is no longer a WAN side.
    Last edited: Mar 22, 2015
    cloneman and dc361 like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice