Can a single REAL Ethernet interface be addressed on (2) DIFFERENT subnets?

But how can this be when a Pi only has a single REAL interface- and therefore only a single MAC address to map the (2) different IPs to?!?!?

I've recently seen confusion and outright wrong info put out in this forum about multi-homing a Pi's single interface. So as I imagine this to be a common misconception and an issue of broad interest given increase in POE connectivity of Pi users, I'll give a granular example which illustrates that it both CAN be done as well as HOW to accomplish it.

2 Answers 2


Having multiple interfaces on a host addressed within the same subnet can cause a networking issue called "ARP Flux" and is to be avoided.

So not only is it POSSIBLE to join different interfaces to different subnets, it's IMPLIED when multi-homing a host not to address multiple interfaces within the same subnet. And as this example demonstrates, you do NOT require (2) nics each with a different MAC address.

And this can be accomplished WITHOUT A VLAN, only using a static route. The below example is tested and known to work correctly. If you have a couple of small switches and a Pi, you too can actually try this out quite easily.


Using (2) different /28 subnets- sensibly sized for a pair of 8 port switches- our specimen networking is organized as follows:

Switch 1:

Switch IP:
Router Interface:
Assignable IPs:

Switch 2:

Switch IP:
Router Interface:
Assignable IPs:

Raspberry Pi:

Has a physical connection to Switch 1

We'll assign last IP in each subnet to Pi: (Switch 1) (Switch 2)

There are several ways we can address our single eth0 interface, discussed after next section "ROUTING"


Only static IPs configured: DHCP disabled on router interfaces the switches are connected to

Switch 1 has a direct connection to router which routes all traffic for switch 1's subnet to it. Since is within Switch 1's routed subnet, no static route is required for this address.

HOWEVER: Since the Pi's other IP is within Switch 2's subnet, by default traffic for this IP will be routed to Switch 2 causing connections to fail. Routers route traffic from MOST specific to LEAST specific route: a static route pointing to a host will be used before one pointing to a subnet.

Add a static route on router:

Destination Address:     (Interface of Pi OUTSIDE switch's routed subnet)
Gateway Address:        (interface of Pi INSIDE switch's routed subnet)

Note we are NOT using router's interface to Switch 1, but IP of Pi within routed subnet of Switch 1. Once traffic arrives at Pi, it knows that it's the destination for

Once static route added, host can be accessed on either address: (subnet 1) and (subnet 2)


Couple of ways- maybe not the only ones- to assign addresses on the single eth0 interface:

Method 1: /etc/dhcpcd.conf & /etc/rc.local


Use the IP within switch 1's routed subnet:

interface eth0
static ip_address=
static routers=
static domain_name_servers=


Add following command to rc.local

/sbin/ip addr add dev eth0

NOTE: Interface(s) added via rc.local will survive "systemctl restart networking"

Method 2: /etc/network/interfaces.d/


Change FROM:

source-directory /etc/network/interfaces.d


source /etc/network/interfaces.d/*

Next, create (2) files with your addressing details:


auto eth0
iface eth0 inet static


auto eth0:0
iface eth0:0 inet static

Anyhoo, if you have a use-case that requires multi-homing, hope this post helped you-

  • This is known by the name "overlay network" The main difference between this and vlans is security - that hosts can still see broadcast traffic in the other network, and nothing stops a user changing their IP to fall within the other range. Perfectly acceptable, if you trust all your users and devices.
    – Criggie
    Mar 18, 2019 at 20:45
  • I limited the scope of my post to configuring host networking within Linux, with the small exception of setting a static route on the router. No dependencies on specific network hardware and its' configuration; just Linux. This ensures that a reader with a bog-standard pair of switches, a plain-vanilla router and a Pi can achieve connectivity on (2) subnets with a single interface.
    – F1Linux
    Mar 19, 2019 at 2:55
  • 1
    fair enough - so why post this in raspberrypi and not linux/unix stack? There's nothing here that is unique to a Pi.
    – Criggie
    Mar 19, 2019 at 7:26
  • As I stated in the question, the incorrect info-that an IF couldn’t be addressed on 2 subsets w/out a clan- was put out in this forum; this was best place to address it. And as Pi is a Linux system, discussing Linux config is within the scope of this forum. Finally, as a Pi has just a single real IF, seemed likely that aliasing Ethernet interfaces would be a common requirement beginners would need a hand with
    – F1Linux
    Mar 19, 2019 at 17:25
  • This setup has nothing to do with the OSI model which is used to standardize communication of computing systems. It may break or mix up well defined protocols based on the OSI model. In this case it breaks OSI layer 2 because is not part of the broadcast domain Simple question: how will find its neighbors? ARP broadcasts are not routed. I cannot recommend using this setup.
    – Ingo
    Mar 19, 2019 at 21:39

Short answer here from a networking perspective is VLANs and is not dependent on a Pi.

This will give you anything up to 4096 different logical network interfaces which function the same as physical interfaces, from the point of view of the OS/kernel and software.

The downside is that you will need a managed switch that understands VLANs, or a direct ethernet to a firewall/router device that also understands VLANs. A home-grade route will not be adequate, you'd need a firewall like pfsense or myriad of other soho devices.

The OS will see eth0 as the physical interface, and each VLAN will appear in the format of eth0.90 for VLAN ID number 90.

# ip address show
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ...
   inet brd scope global eth0
3: eth0.10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ...
    inet brd scope global eth0.10
4: eth0.20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ...
   inet brd scope global eth0.20

The above host has 3 networks on the one port. Untagged (IE normal LAN) is in the zeroconf range. There are VLAN IDs 10 and 20, coinciding with the third octet of the IPv4 address for neatness.

Note: This setup does not allow a host on one VLAN to talk through your PI to a host on another VLAN. That would be IP Routing and is a whole-separate question.

More info on VLANs: https://www.reddit.com/r/homelab/comments/a94oka/learn_with_me_ep1_introduction_vlans_pfsense/


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.