OpenWrt Forum Archive

Topic: Dir-601 configure lan port as wan (dead wan)

The content of this topic has been archived on 18 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

<bg info, skip to problem, if desired>
Newb here. First of all I would like to thank everyone for all their contributions to this awesome project. I am learning a ton and love playing around with hardware and command prompts. Soon I am going to start going to school for computer engineering so I hope to contribute more to these projects instead of only taking. I have a D-link dir 601 and a bad wan port. I used to have dsl internet and my dsl modem had the option for me to allow it to issue ip's and I had my router just putting out the wireless signal. Well, when I switched to cable, the stupid motorola has no options for configuration and I'm having all sorts of issues. I can't get my network printers to respond and I can only connect one device to internet at a time. (I previously had modem going into lan port)
<sorry if tmi>

So I would like to reconfigure an unused lan port as WAN. Is this possible? according to this thread it's possible in openwrt, but my config doesn't appear the same.

mine is as follows:

config 'interface' 'lan'           
        option 'ifname' 'eth0'     
        option 'type' 'bridge'     
        option 'proto' 'static'     
        option 'ipaddr' '192.168.1.1'
        option 'netmask' '255.255.255.0'
                                       
config 'interface' 'wan'               
        option 'ifname' 'eth1'         
        option 'proto' 'dhcp'           
                                       
config 'switch'                         
        option 'name' 'eth0' 
        option 'reset' '1'   
        option 'enable_vlan' '1'
                               
config 'switch_vlan'           
        option 'device' 'eth0' 
        option 'vlan' '1'       
        option 'ports' '0 1 2 3 4'

Thanks in advance for any and all replies. You have no reason to help me other than wanting to, and I appreciate that.

config interface loopback
        option ifname   "lo"
        option proto    static
        option ipaddr   127.0.0.1
        option netmask  255.0.0.0

config 'interface' 'lan'
        option 'ifname' 'eth0.1'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '192.168.1.1'
        option 'netmask' '255.255.255.0'

config 'interface' 'wan'
        option 'ifname' 'eth0.2'
        option 'proto' 'dhcp'

config 'switch'
        option 'name' 'eth0'
        option 'reset' '1'
        option 'enable_vlan' '1'

config 'switch_vlan'
        option 'device' 'eth0'
        option 'vlan' '1'
        option 'ports' '0t 2 3 4'

config 'switch_vlan'
        option 'device' 'eth0'
        option 'vlan' '2'
        option 'ports' '0t 1'

Don't know which internal port maps to external LAN port 1.  You can also try,

config 'switch_vlan'
        option 'device' 'eth0'
        option 'vlan' '1'
        option 'ports' '0t 1 2 3'

config 'switch_vlan'
        option 'device' 'eth0'
        option 'vlan' '2'
        option 'ports' '0t 4'

Thanks for the reply. Is this change necessary? I have no idea, but could you explain what it does?

fyi wrote:
config 'interface' 'lan'
        option 'ifname' 'eth0.1'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '192.168.1.1'
        option 'netmask' '255.255.255.0'

config 'interface' 'wan'
        option 'ifname' 'eth0.2'
        option 'proto' 'dhcp'

I had option 'ifname' 'eth0'
and
option 'ifname' 'eth1'

Like I said: no clue what that changes, but does it need to be or was it a typo?
Also, does a reboot alone make the changes active?

(Last edited by jjtjp on 9 Feb 2012, 20:20)

UPDATE:
After making the changes recommended and rebooting, I cannot get back into the modem through ssh and I'm not getting an IP address to log back on, so I'm guessing some change I made was bad. I also learned that changing the config file and rebooting apparently solidifies the changes wink

I'm learning, but if I don't find a little success with this, I might just break down and buy a new router sad

FINAL UPDATE:
Okay, Not sure why it didn't work the first time, but what you said in your first code was exactly what did the trick. Thanks so much! I learned that I did need the 0.1, 0.2 as this specifies vlan (new info for me, not anyone who knows what they're doing) and port 4 is indeed lan port 1. I had fun learning. Now I have a functioning router smile

The discussion might have continued from here.