Community discussions

MikroTik App
880frank
刚刚加入了
Topic Author
Posts: 1
加入: Thu Jan 29, 2015 4:52 pm

Virtual or pseudo ethernet interfaces possible?

Thu Jan 29, 2015 5:15 pm

Hello,

from my cable provider i could get 5 fixed ip addresses via DHCP - but i have to gave them the interface mac address upfront. The cisco cable modem is connected to ethernet port 1.
有办法吗create additonal Interfaces including DHCP clients with independent mac addresses but linked to the same physical Interface?

If there is a trick - please advidse

thank you,

frank
Top
用户头像
NathanA
Forum Veteran
Forum Veteran
Posts: 829
加入: Tue Aug 03, 2004 9:01 am

Re: Virtual or pseudo ethernet interfaces possible?

Fri Jan 30, 2015 2:58 pm

No good way to do this that I know.

There is a virtual-ethernet interface (vif), but its purpose is to allow communication between host router and virtualized router (either KVM on x86, or MetaROUTER on MIPSBE and single-core Freescale PowerPC), so not all boxes that run RouterOS will show you the option.

理论上,RouterOS设备上,l雷竞技有一口port for '/interface virtual-ethernet', you could create a bunch, just not use them with a virtual router, and bridge all of them together, or for router models that don't support this interface type, you could create a bunch of some other ethernet-like interface that is essentially virtual (e.g., EoIP) and bridge THOSE together. But all direct member interfaces of a bridge will assume the bridge's MAC address and not their own when transmitting frames, so you would still be stuck with a single MAC address. To transmit individual, unique MAC addresses, the bridge has to be forwarding frames, not originating/outputting frames, which still means multiple devices.

If you *are* using a router that has support for virtualization (KVM or MetaROUTER), the easiest way is to fire up one virtual router per IP address and dump them all in a bridge with your WAN port on the host. But that does seem a bit excessive to be running 4 or 5 virtual routers just to do this.

One final possibility that you might investigate is to do as suggested earlier and create a bunch of virtual ethernet-like interfaces and bridge them with the WAN port, and then use '/interface bridge nat' to construct L2 NAT rules to change the MAC address used on frame transmission. This might get complex rather quickly, though, and may even be impossible, since bridge NAT is basically stateless (no tracking of any kind) and the specific matchers that you might need to translate the MAC address on egress and ingress may not even exist.

-- Nathan
Top
Sob
Forum Guru
Forum Guru
Posts: 9185
加入: Mon Apr 20, 2009 9:11 pm

Re: Virtual or pseudo ethernet interfaces possible?

Sat Jan 31, 2015 4:55 pm

It seems that it's possible to misuse VRRP for that:

ros code

/interface vrrp add interface=ether1 name=vrrp1 vrid=1 add interface=ether1 name=vrrp2 vrid=2 add interface=ether1 name=vrrp3 vrid=3 # VRRP interface needs some static address to come up: /ip address add address=127.0.0.2/32 interface=vrrp1 network=127.0.0.2 add address=127.0.0.3/32 interface=vrrp2 network=127.0.0.3 add address=127.0.0.4/32 interface=vrrp3 network=127.0.0.4 /ip dhcp-client add default-route-distance=0 dhcp-options=hostname,clientid disabled=no \ interface=ether1 add add-default-route=no dhcp-options=hostname,clientid disabled=no interface=\ vrrp1 use-peer-dns=no use-peer-ntp=no add add-default-route=no dhcp-options=hostname,clientid disabled=no interface=\ vrrp2 use-peer-dns=no use-peer-ntp=no add add-default-route=no dhcp-options=hostname,clientid disabled=no interface=\ vrrp3 use-peer-dns=no use-peer-ntp=no
It's definitely not a proper solution and I'm not sure about all possible side effects. But at the first sight, it works:

ros code

Flags: X - disabled, I - invalid, D - dynamic # ADDRESS NETWORK INTERFACE 0 127.0.0.2/32 127.0.0.2 vrrp1 1 127.0.0.3/32 127.0.0.3 vrrp2 2 127.0.0.4/32 127.0.0.4 vrrp3 3 D 192.168.80.50/24 192.168.80.0 ether1 4 D 192.168.80.48/24 192.168.80.0 vrrp2 5 D 192.168.80.47/24 192.168.80.0 vrrp3 6 D 192.168.80.49/24 192.168.80.0 vrrp1
Top
用户头像
NathanA
Forum Veteran
Forum Veteran
Posts: 829
加入: Tue Aug 03, 2004 9:01 am

Re: Virtual or pseudo ethernet interfaces possible?

Sun Feb 01, 2015 2:06 am

It seems that it's possible to misuse VRRP for that: [snip]
Clever!!!

-- Nathan
Top
FunctionalIT
刚刚加入了
Posts: 6
加入: Fri Oct 21, 2016 10:45 am

Re: Virtual or pseudo ethernet interfaces possible?

Fri Oct 21, 2016 10:56 am

For all whom want to create a similar infrastructure. I have done this succesfully with VRRP, but this is kind of an abuse and has some flaws. You can do it with MetaRouter (if available), but that is a bit heavy for the system and the IP's will virtually be on different routers.
The easiest (and best) way to do this is to put a switch in front (between modem and router) and offer a physical interface to every IP...
Top
jarda
Forum Guru
Forum Guru
Posts: 7752
加入: Mon Oct 22, 2012 4:46 pm

Re: Virtual or pseudo ethernet interfaces possible?

Fri Oct 21, 2016 12:11 pm

是的。的路由器,将开关在前面bingo! At least meanwhile until mikrotik come with some real and usable solution. Maybe abusing eoip tunnels to some other device and back could do the job also.
Top
用户头像
Jotne
Forum Guru
Forum Guru
Posts: 3221
加入: Sat Dec 24, 2016 11:17 am
Location:Magrathean

Re: Virtual or pseudo ethernet interfaces possible?

Sat Sep 01, 2018 7:07 pm

I did try vrrp config on an hAP lite.
Vrrp interface are all red (all config added)
Did try the same on hEX 750Gr3 interface did came up.
But all did get the same IP from my ISP.
Top
Sob
Forum Guru
Forum Guru
Posts: 9185
加入: Mon Apr 20, 2009 9:11 pm

Re: Virtual or pseudo ethernet interfaces possible?

Sun Sep 02, 2018 2:59 pm

It depends on what ISP does. The idea here was that ISP is willing to provide multiple addresses to devices directly connected to WAN. Is it your case? Multiple devices = multiple MAC addresses, VRRP can provide those. But it won't just work everywhere, when you're not supposed to get more than one address.
Top
用户头像
Jotne
Forum Guru
Forum Guru
Posts: 3221
加入: Sat Dec 24, 2016 11:17 am
Location:Magrathean

Re: Virtual or pseudo ethernet interfaces possible?

Thu Sep 20, 2018 7:54 am

I did just try to connect ether1 to an Router with DHCP. So this router should give away IP to any who ask.
Stil red DHCP interfaces.
Tested on rb951g-2hnd and CRS-125-24G
Top
用户头像
JohnTRIVOLTA
Member
Member
Posts: 304
加入: Sun Dec 25, 2016 2:05 pm
Location:BG/Sofia

Re: Virtual or pseudo ethernet interfaces possible?

Mon Oct 21, 2019 8:56 am

It seems that it's possible to misuse VRRP for that:

ros code

/interface vrrp add interface=ether1 name=vrrp1 vrid=1 add interface=ether1 name=vrrp2 vrid=2 add interface=ether1 name=vrrp3 vrid=3 # VRRP interface needs some static address to come up: /ip address add address=127.0.0.2/32 interface=vrrp1 network=127.0.0.2 add address=127.0.0.3/32 interface=vrrp2 network=127.0.0.3 add address=127.0.0.4/32 interface=vrrp3 network=127.0.0.4 /ip dhcp-client add default-route-distance=0 dhcp-options=hostname,clientid disabled=no \ interface=ether1 add add-default-route=no dhcp-options=hostname,clientid disabled=no interface=\ vrrp1 use-peer-dns=no use-peer-ntp=no add add-default-route=no dhcp-options=hostname,clientid disabled=no interface=\ vrrp2 use-peer-dns=no use-peer-ntp=no add add-default-route=no dhcp-options=hostname,clientid disabled=no interface=\ vrrp3 use-peer-dns=no use-peer-ntp=no
It's definitely not a proper solution and I'm not sure about all possible side effects. But at the first sight, it works:

ros code

Flags: X - disabled, I - invalid, D - dynamic # ADDRESS NETWORK INTERFACE 0 127.0.0.2/32 127.0.0.2 vrrp1 1 127.0.0.3/32 127.0.0.3 vrrp2 2 127.0.0.4/32 127.0.0.4 vrrp3 3 D 192.168.80.50/24 192.168.80.0 ether1 4 D 192.168.80.48/24 192.168.80.0 vrrp2 5 D 192.168.80.47/24 192.168.80.0 vrrp3 6 D 192.168.80.49/24 192.168.80.0 vrrp1
Hi SOB, i tried this configuration, but the traffic not passing from LANs . I tried mark the connections and used VRF too, but without succes!
Is there any other way similar to pseudo ethernet to use in this case? Do you know if Mikrotik staff plan to support it in ROS v7?
Top
Sob
Forum Guru
Forum Guru
Posts: 9185
加入: Mon Apr 20, 2009 9:11 pm

Re: Virtual or pseudo ethernet interfaces possible?

Mon Oct 21, 2019 5:12 pm

I think it still works, at least my very quick test suggests so. But it's just the basic part, to get more MAC addresses and then more IP adddresses from them. The rest depends on what else you do with it, and there are many way in RouterOS how to create configs that don't work.

And since you brought it up, one small update for the original idea. I'd rather use IPv6 mode for VRRP interface. One advantage is that it doesn't need any extra addresses, because there are always link-local ones. And VRRP doesn't mix IPv4 and IPv6 on protocol level, so if you add the other protocol address on VRRP interface, it's strictly local-to-router thing and can't mess something up.

About proper way, I'm just regular user with no special relation with MikroTik, so I don't know any more than you do. I know I was looking it up and Linux definitely has some kind of virtual ethernet interfaces. I think even the kernel used in RouterOS v6 has some basic support. But I guess that demand for this feature is probably not very high, so who knows when or if we'll see it in RouterOS.
Top
用户头像
JohnTRIVOLTA
Member
Member
Posts: 304
加入: Sun Dec 25, 2016 2:05 pm
Location:BG/Sofia

Re: Virtual or pseudo ethernet interfaces possible?

Mon Oct 21, 2019 8:01 pm

Thank you SOB for your comprehensive answer!
Top
diniboy
刚刚加入了
Posts: 15
加入: Wed Jul 21, 2021 2:10 am

Re: Virtual or pseudo ethernet interfaces possible?

Mon Feb 28, 2022 1:01 pm

Hi,

Great hint. I could also go as far as to obtain a secondary IP address. However I am getting timeouts if I try to ping for instance:
Code:Select all
[admin@redacted] > /ping src-address=xx.xx.xx.xx interface=vrrp1 1.1 SEQ HOST SIZE TTL TIME STATUS 0 1.0.0.1 timeout sent=1 received=0 packet-loss=100%
I don't want to add a default route, but I would like to route certain IPs over this secondary xx.xx.xx.xx IP. However as of now it seemingly times out in all cases. What else is needed to bring this up properly?
Top
用户头像
archerious
Member Candidate
Member Candidate
Posts: 155
加入: Sun Aug 26, 2018 7:50 am
Location:USA
Contact:

Re: Virtual or pseudo ethernet interfaces possible?

Sun Mar 13, 2022 8:15 pm

It seems that it's possible to misuse VRRP for that:

ros code

/interface vrrp add interface=ether1 name=vrrp1 vrid=1 add interface=ether1 name=vrrp2 vrid=2 add interface=ether1 name=vrrp3 vrid=3 # VRRP interface needs some static address to come up: /ip address add address=127.0.0.2/32 interface=vrrp1 network=127.0.0.2 add address=127.0.0.3/32 interface=vrrp2 network=127.0.0.3 add address=127.0.0.4/32 interface=vrrp3 network=127.0.0.4 /ip dhcp-client add default-route-distance=0 dhcp-options=hostname,clientid disabled=no \ interface=ether1 add add-default-route=no dhcp-options=hostname,clientid disabled=no interface=\ vrrp1 use-peer-dns=no use-peer-ntp=no add add-default-route=no dhcp-options=hostname,clientid disabled=no interface=\ vrrp2 use-peer-dns=no use-peer-ntp=no add add-default-route=no dhcp-options=hostname,clientid disabled=no interface=\ vrrp3 use-peer-dns=no use-peer-ntp=no
It's definitely not a proper solution and I'm not sure about all possible side effects. But at the first sight, it works:

ros code

Flags: X - disabled, I - invalid, D - dynamic # ADDRESS NETWORK INTERFACE 0 127.0.0.2/32 127.0.0.2 vrrp1 1 127.0.0.3/32 127.0.0.3 vrrp2 2 127.0.0.4/32 127.0.0.4 vrrp3 3 D 192.168.80.50/24 192.168.80.0 ether1 4 D 192.168.80.48/24 192.168.80.0 vrrp2 5 D 192.168.80.47/24 192.168.80.0 vrrp3 6 D 192.168.80.49/24 192.168.80.0 vrrp1
This worked flawlessly.

Had to restart my ISP gateway in order to get it to give out IPv4, but on ROS 7 this is working perfectly. Also had to add the VRRP to the WAN interface list so my firewall didn't block.

For IPv6 I added them into ND and like magic they got IPv6.

Only question I have is do I need to add default routes for the VRRP DHCPv6 clients? It seems to be working without, I assume using the default route from my Ether1's DHCPv6 client?
Top
Sob
Forum Guru
Forum Guru
Posts: 9185
加入: Mon Apr 20, 2009 9:11 pm

Re: Virtual or pseudo ethernet interfaces possible?

Sun Mar 13, 2022 9:01 pm

No, you don't need default routes for other DHCPv6 clients. In fact, no DHCPv6 client should add route, it should come from RA, but if it works, you can keep it as you have it now (plus getting gateway from RA is currently broken in v7 anyway).
Top
用户头像
archerious
Member Candidate
Member Candidate
Posts: 155
加入: Sun Aug 26, 2018 7:50 am
Location:USA
Contact:

Re: Virtual or pseudo ethernet interfaces possible?

Sun Mar 13, 2022 11:43 pm

No, you don't need default routes for other DHCPv6 clients. In fact, no DHCPv6 client should add route, it should come from RA, but if it works, you can keep it as you have it now (plus getting gateway from RA is currently broken in v7 anyway).
Awesome, thank you again. Seriously you were the only person that had a solution on MikroTik.

Really appreciate your time, if you have a crypto wallet I'd happily donate to you a cup of coffee.
Top
Sob
Forum Guru
Forum Guru
Posts: 9185
加入: Mon Apr 20, 2009 9:11 pm

Re: Virtual or pseudo ethernet interfaces possible?

Mon Mar 14, 2022 8:43 pm

It's fine, just enjoy. And hope for some future proper support.:)
Top

Who is online

Users browsing this forum:Ahrefs [Bot],Bing [Bot],jmszuch1,onnyloh,Semrush [Bot]and 21 guests