OpenWrt Forum Archive

Topic: 2 MAC addresses for the WAN interface.

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

My router, a Draytek Vigor 2130, is based on OpenWrt (good news!). So I'm hoping someone can help me with this one.

My cable ISP assings (by means of DHCP) a different subnet, gateway, DNS if it detects that the requesting device is a digital TV setup box.

So while my regular computers can access the internet just fine, the setup box would require me to place a switch in front of the router and running a cable from that switch to the cable box.

So what did I try to avoid this:

I cloned the setup box' MAC-address to the WAN interface. And behold! It works like a charm. Too bad the regular computers don't work but that was to be expected.

So my question is: can I assign a 2nd MAC-address to the WAN interface so that it can hold 2 IP's? One for the regular computers and one for the tv setup box.

Many thanks for your thoughts,
Jeroen

What you need is to bridge the WAN interface to a switch port. That will make your set top box receive an address from your ISP instead of your router.

Don't bridge, this would make the CPU do more work. Instead use the switch functionality and separate two ports from the other two ports. In some cases this could be described as port 1 and 2 and CPU (WAN side?) would be in one VLAN group and port 2 and 3 and CPU LAN side would be in another group. No tagging. Just separation.

I had thought about that somewhat. However, the setup box is connected to a switch and that switch in turn is connected to the router. So, apart from the setup box, there are several other devices connected to the switch. And all of them need to acquire DHCP from the router instead of the ISP.

I believe the bridging the WAN interface with a switch port would only work if the setup box were connected directly to a switch port on the router.

I have also thought about tagged VLAN's. Again, unfortunately, no dice. The Draytek engineers have only implemented port based VLAN's. My forementioned switch however is fully managed and supports tagged VLAN's.

I'm at my wits end with the dual MAC/IP idea:)

(Last edited by Jeroen1000 on 13 Feb 2011, 23:12)

So put the switch in a port that's not bridged, and the set top box directly in a bridged port?

That would mean I still have to pull an (additional) cable from the cable box to the router.

                                                  (3 metres of cable)                                 (30 metres of CAT5E cable)         
Currently, It's like this:   setup box -----------------------> Cisco smart switch ------------------------------> Draytek router.

If I'm correct, you're proposing:

                                                  (33 metres of CATE5E cable)
set up box ----------------------------------------------------------------------------------------------------------->Draytek router lan port brigdged to WAN.

I'm trying to avoid any scenario involving a new cable run.

(Last edited by Jeroen1000 on 13 Feb 2011, 23:59)

If I understand correctly,

- You need to get the TV on the ISP network
- You need to get the OpenWRT router on the ISP network
- You need to get the PCs connected to the OpenWRT router and behind a NAT
- Your cabling is 30 meters to the OpenWRT router and there is no problem of running a short cable from the router to the TV and the PCs
- You don't want to change anything about the full-managed switch in the/near the "setup box"

This is what I would do in this situation:

- I would check what my Switch chip in my router is and I would check if it can be controlled by an OpenWRT app (dmesg, opkg update, opkg list etc.)
- I would try to use the utility to set up the switch chip like this:
--- port 1 and port 2 are in group A and port 3,4 are in group B. No traffic can pass from A to B
--- OpenWRT can pass traffic to group A so port 1 would work as WAN, port 2 would be for the TV so the TV would get on the ISP network without the traffic passing through the router CPU !!!
--- OpenWRT can pass traffic to group B so ports 3,4 are LAN (connect two PCs)
- If I need more PCs after the router, I would use the cheapest switch connected to port 4.

Do it like this. Or run a new cable to the TV.

smile

NetworkPro wrote:

- You need to get the TV on the ISP network

correct. The ISP will recognize the MAC of the setup box and will hand out an IP in a special subnet.

NetworkPro wrote:

- You need to get the OpenWRT router on the ISP network
- You need to get the PCs connected to the OpenWRT router and behind a NAT

Bingo, the PCs will be in a 192.168.10.x/24 subnet. Unlike the setup box they'll reside behind the Openwrt NAT. 

NetworkPro wrote:

- Your cabling is 30 meters to the OpenWRT router and there is no problem of running a short cable from the router to the TV and the PCs

No quite. I didn't know all the details mattered. So the Cisco switch is in the room where I watch TV. The setup box and stuff like an XBOX and WD-LIVE are connected to it. From there it is 30M to Draytek router. From the Draytek there is another cable run to a switch in my study room. This switch has 2 PC's connected to it and a wireless AP
                                                         3M                          30M
So it's setup box + a few other devices ----->  Cisco switch ---------> Draytek router
                                                                                                      |
                                                                                                      | +- 15 M
                                                                                                      |
                                                                                           Dumb netgear switch
                                                                                            |        |          |
                                                                                           PC    PC    Wireless AP

NetworkPro wrote:

- You don't want to change anything about the full-managed switch in the/near the "setup box"

The full managed switch can be used as you see fit. It's tagged VLAN capable and I'm prepared to ditch the Draytek if I needed a router that is tagged VLAN capable in order to solve this issue.
In truth, I thought it was  802.1Q capable when I bought it. It's afterwards I found out it can only do port based VLANs.

NetworkPro wrote:

This is what I would do in this situation:

I would check what my Switch chip in my router is and I would check if it can be controlled by an OpenWRT app (dmesg, opkg update, opkg list etc.)
- I would try to use the utility to set up the switch chip like this:
--- port 1 and port 2 are in group A and port 3,4 are in group B. No traffic can pass from A to B
--- OpenWRT can pass traffic to group A so port 1 would work as WAN, port 2 would be for the TV so the TV would get on the ISP network without the traffic passing through the router CPU !!!
--- OpenWRT can pass traffic to group B so ports 3,4 are LAN (connect two PCs)
- If I need more PCs after the router, I would use the cheapest switch connected to port 4.

Do it like this. Or run a new cable to the TV.

smile

You're a lot smarter than me in this department so I really had to think this through:). You're using port 2 on the Draytek router for the TV (I'm assuming TV = setup box here) but in fact the Cisco switch is to be connected to port 2. And of all devices connected to the Cisco switch, only the TV/setup box should get an IP from my ISP.

Thanks for trying to figure this on out with me so far.

(Last edited by Jeroen1000 on 14 Feb 2011, 13:37)

Jeroen1000 wrote:

My router, a Draytek Vigor 2130, is based on OpenWrt (good news!). So I'm hoping someone can help me with this one.

My cable ISP assings (by means of DHCP) a different subnet, gateway, DNS if it detects that the requesting device is a digital TV setup box.

So while my regular computers can access the internet just fine, the setup box would require me to place a switch in front of the router and running a cable from that switch to the cable box.

So what did I try to avoid this:

I cloned the setup box' MAC-address to the WAN interface. And behold! It works like a charm. Too bad the regular computers don't work but that was to be expected.

So my question is: can I assign a 2nd MAC-address to the WAN interface so that it can hold 2 IP's? One for the regular computers and one for the tv setup box.

Many thanks for your thoughts,
Jeroen

opkg update
opkg install ip
opkg install kmod-macvlan

edit /etc/rc.local  and add:

ip link add link eth1 eth2 type macvlan
ifconfig eth2 hw ether xx:xx:xx:xx:xx:xx #you second mac
ifup -a

edit /etc/config/network and add:

#second IP
config 'interface' 'wan1'
        option 'ifname' 'eth2'
        option 'proto' 'dhcp'
        option 'defaultroute' '0'
        option 'peerdns' '0'
        option 'gateway' '0.0.0.0'

The discussion might have continued from here.