I wanted to convert the 4 port switch in my wrt54g v2 in to 2 separate vlans, port 1 to connect to my private lan and will have address 192.168.1.1, port 2 3 and 4, as my dmz network which will have servers in public ip addresses assigned from my ISP and wan interface the internet connection. I was following the discussion in http://openwrt.org/forum/viewtopic.php?t=6 and another url to sveasoft forums posted in that discussion at http://www.sveasoft.com/modules/phpBB2/ … .php?t=191.
The sveasoft forum has a nifty instruction to get multiple vlans working, by using vlan*ports and vlan*hwname in nvram. So I checked it out and now mine is working perfectly.
My nvram settigns are:
root@wrt:/# nvram show | grep vlan
size: 1666 bytes (31102 left)
vlan0hwname=et0
vlan0ports=1 5*
vlan1hwname=et0
vlan1ports=0 5
vlan2hwname=et0
vlan2ports=2 3 4 5
wan_ifname=vlan1
and ifconfig output:
br0 Link encap:Ethernet HWaddr 00:0F:66:BF:CD:EE
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:971 errors:0 dropped:0 overruns:0 frame:0
TX packets:876 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:74434 (72.6 KiB) TX bytes:448360 (437.8 KiB)
eth0 Link encap:Ethernet HWaddr 00:0F:66:BF:CD:EE
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:15862 errors:0 dropped:0 overruns:0 frame:0
TX packets:1704 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:1534237 (1.4 MiB) TX bytes:536173 (523.6 KiB)
Interrupt:5 Base address:0x2000
eth1 Link encap:Ethernet HWaddr 00:0F:66:BF:CD:F0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:12 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:4 Base address:0x1000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
vlan0 Link encap:Ethernet HWaddr 00:0F:66:BF:CD:EE
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:972 errors:0 dropped:0 overruns:0 frame:0
TX packets:876 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:80454 (78.5 KiB) TX bytes:451864 (441.2 KiB)
vlan1 Link encap:Ethernet HWaddr 00:0F:66:BF:CD:EE
inet addr:111.111.11.232 Bcast:255.255.255.255 Mask:255.255.248.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14854 errors:0 dropped:0 overruns:0 frame:0
TX packets:816 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1166467 (1.1 MiB) TX bytes:83141 (81.1 KiB)
vlan2 Link encap:Ethernet HWaddr 00:0F:66:BF:CD:EE
inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:45 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:6168 (6.0 KiB)
One important precaution is that you need to take is to always enclose multiple numbers in double quotes, while setting the values. for example:
nvram set vlan2ports="2 3 4 5"
If you did not do this, you may have to reset the wrt (by pressing reset button for 5 seconds while poweron) and connect it from 192.168.1.x network to bring it back again.
Now I am looking for a way to set the vlan2 interface address permanently.
raj