OpenWrt Forum Archive

Topic: Emulate a Cisco Router

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

I have a WRT54GS version 4.0 unit that I've successfully flashed to OpenWRT. I'm looking to turn this device into the equivalent of a low end Cisco router by running the Quagga (Zebra, RIPd, OSPFd, etc. daemons). But before I head down the road if installing/configuring quagga, I need to straignten out the Interfaces . I'm not really understanding the whole concept of the four port switch all being et0 and separating them using VLAN ID's. In a traditional switch, each interface is physical hardware with it's own identifier (eth0, eth1, etc.). Yet that doesn't seem to be the case with the WRT54GS and OpenWRT. Perhaps someone could help me out here with a better understanding.

If anyone could point me in the right direction for accomplishing what I am attempting to do, I'd sure appreciate it. I'm a bit of a noob to Linux...although I do have a Linksys NSLU2 running OpenSlug, and a couple of PC's running Centos and Fedora Core 3. So I have some basic understanding of all things Linux, but not an expert by any means.

I need to know how to disable the wireless and WAN interfaces, and setup each LAN interface (1-4 of the four port switch) as a separate ethernet interface with it's own IP address and Subnet mask (would like to do this in NVRAM to make it permanent). Ultimate goal is to be able to route between these interfaces.

Thanks in advance!!!

Best Regards,
              Chris

Splitting each port up onto their own VLAN is pretty easy to do by just changing/adding nvram variables. Once you get them on their own VLAN you treat their VLAN names just like an interface. Here's a thread where we separated them:

http://forum.openwrt.org/viewtopic.php?id=2656&p=2

The person in that thread had some additional requirements but you should be able to see what's going on.

Thanks for the response. Still not very clear to me. Guess I'm still too new to this. I guess I'll just have to try the trial and error method (although from what I read this could have negative consequences). I'm looking to have the Linksys behave as essentially a L3 router with up to 5 separate interfaces (if the WAN interface could be used as well) and I want to completely disable the wireless. I have the Quagga suite running on a CentOS host right now, so I'm familiar with Quagga. But I'm falling down on how to set up the hardware configuration on the WRTGS so each interface is a separate segment. I'm assuming I'd disable the firewall (no need for it in my scenario). And once I was able to isolate each interface into it's own segment and assign an IP address, I'd load and configure quagga. I'm interested in finding out how the interfaces show up in Zebra. I assume they'll still be Ethernet0, Ethernet1...
And the Zebra interfaces will correlate to a VLAN

Still looking for some thoughts here. Thanks in advance.

IMHO, if you use the vlan0ports to vlan4ports variables to assign a seperate vlan to each physical port, you should get interfaces named from vlan0 to vlan4.

I used ROBOCFG and actually do have what appears to be separate VLAN's for each interface. In fact, here is what I have:
root@OpenWrt:~# ifconfig -a
br0       Link encap:Ethernet  HWaddr 00:14:BF:82:B7:43
          inet addr:192.168.3.103  Bcast:192.168.3.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:49980 errors:0 dropped:0 overruns:0 frame:0
          TX packets:34121 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:5573101 (5.3 MiB)  TX bytes:2772106 (2.6 MiB)

eth0      Link encap:Ethernet  HWaddr 00:14:BF:82:B7:43
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:50085 errors:0 dropped:0 overruns:0 frame:0
          TX packets:34121 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6682129 (6.3 MiB)  TX bytes:2908590 (2.7 MiB)
          Interrupt:4 Base address:0x1000

eth1      Link encap:Ethernet  HWaddr 00:14:BF:82:B7:43
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:1536334
          TX packets:15499 errors:37 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:3724512 (3.5 MiB)
          Interrupt:2 Base address:0x5000

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:14:BF:82:B7:43
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:50010 errors:0 dropped:0 overruns:0 frame:0
          TX packets:34121 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:5774749 (5.5 MiB)  TX bytes:2908590 (2.7 MiB)

vlan1     Link encap:Ethernet  HWaddr 00:14:BF:82:B7:44
          inet addr:192.168.3.103  Bcast:192.168.3.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2 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:166 (166.0 B)  TX bytes:0 (0.0 B)

vlan2     Link encap:Ethernet  HWaddr 0C:0C:0C:0C:0C:02
          BROADCAST MULTICAST  MTU:1500  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)

vlan3     Link encap:Ethernet  HWaddr 0C:0C:0C:0C:0C:03
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:73 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:5684 (5.5 KiB)  TX bytes:0 (0.0 B)

vlan4     Link encap:Ethernet  HWaddr 0C:0C:0C:0C:0C:04
          BROADCAST MULTICAST  MTU:1500  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)

So I am assuming I have one VLAN for each of the Switch Ports (1-4) as well as one VLAN for the WAN interface?

I now need to figure out where to go from here. I take it any changes made my ROBOCFG aren't permanent and I'd need to somehow script them at boot? And I'm not understanding how each of the two physical interfaces (eth0 and eth1) are associated with the VLAN's. Then there is the Br0 (bridge) which I'm thinking I still need since a router is really also a multiport bridge that makes decisions based on L3 addresses. But I'm not sure what relationship BR0 has to the physical interfaces and the VLAN's.

Thanks in advance. All comments and suggestions are welcome to this newbie.

Regards,
        Chris

You don't need robocfg. Everything you need to do is done via nvram variables. You have already created the VLANs, just need to set the associated variables for the ip addresses, gateways, netmasks, etc. Those variables are all listed in that topic I linked to. Treat each VLAN as you would an interface. In fact your WAN interface is nothing more than one of the ports on the switch separated into it's own VLAN. There is nothing special about it, it's identical to the LAN ports. It's just by default 4 of the ports are put into one VLAN for LAN. Just be advised that depending on your WRT version as to the order of the ports:

http://voidmain.is-a-geek.net/i/WRT54_sw1_internal_architecture.png
http://voidmain.is-a-geek.net/i/WRT54_sw2_internal_architecture.png

Read this page for the variable definitions:
http://wiki.openwrt.org/OpenWrtDocs/Configuration#head-b62c144b9886b221e0c4b870edb0dd23a7b6acab

The discussion might have continued from here.