Manual:Creating IPv6 loopback address

From MikroTik Wiki
Jump to: navigation, search

In some cases it is necessary to have a kind of loopback interface. It can be used to hold addresses that belong to the "router itself" and not to any particular outgoing interface. Such addresses are useful, for example, as source addresses for TCP connections between two routers that have more that one physical interfaces between them.

In MT RouterOS the recommended way to add a loopback interface for IPv4 is to create a new empty bridge interface:

/interface bridge add name=lobridge
# loopback address
/ip address add address=10.0.0.1/24 interface=lobridge

However, for IPv6 this won't work.

Empty bridge interface has zero MAC byte default. MT RouterOS does not generate IPv6 link-local addresses on interfaces with zero MAC address (because of high address collision probability).

Since IPv6 link-local address is needed for IPv6 to function properly on an interface, this means that by default the empty bridge interface cannot be used as IPv6 loopback interface.

Recommended solution

Add an empty bridge, and specify bridge MAC address manually:

/interface bridge add name=lobridge auto-mac=no admin-mac=01:00:00:00:01:00
# loopback address
/ipv6 address add address=2003::1/64 advertise=no interface=lobridge

Alternative solution is to use a fake EoIP tunnel interface instead of bridge. A random MAC address will be generated in this case.

Results

Test that you are able to ping the loopback address:

/ping 2003::1
2003::1 64 byte ping: ttl=64 time=5 ms
2003::1 64 byte ping: ttl=64 time=5 ms