Posts: 55
Joined: Fri Jul 31, 2015 9:21 am

Force eth0.0 route to eth0?

Wed Apr 05, 2017 5:37 am

Here's a simplified version of my previous post:

If I have PiA and PiB, its fairly simple to make PiA a gateway for PiB by setting the 'static routers=PiA' on PiB in /etc/dhcpcd.conf

But what if I want/need to set up two IP addresses on a Pi and route eth0.0 to eth0 ?

I've done that, but because the route table shows 2 default routes, the one with the lowest Metric is being used by both interfaces (eth0 & eth0.0)

Is there any way to force Default Route Metric 204 to be used by eth0.0 and Default Route Metric 202 to be used by eth0 ?


Code: Select all

iface eth0 inet manual

auto eth0.0
iface eth0.0 inet manual
    vlan-raw-device eth0

Code: Select all

interface eth0
  static ip_address=
  static routers=
  static domain_name_servers=

interface eth0.0
  static ip_address=
  static routers=
  static domain_name_servers=

Code: Select all

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         UG    202    0        0 eth0
default         UG    204    0        0 eth0.0

User avatar
Posts: 38844
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Force eth0.0 route to eth0?

Wed Apr 05, 2017 12:05 pm

Having default routes on more than one interface (even if it's a virtual interface) isn't going to do anything useful. Things will just get confused.

Pick an interface that has the true route to the public internet and assign just one "static routers" line in /etc/dhcpcd.conf to that interface.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Advanced users”