1

I have three IPs assigned to a single interface (modified results of netstat /rn):

2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether aa:aa:aa:aa:aa:aa brd ff:ff:ff:ff:ff:ff
    altname enp181s0f0
    inet 1.1.1.1/32 scope global eno1
       valid_lft forever preferred_lft forever
    inet 1.1.2.2/32 scope global eno1
       valid_lft forever preferred_lft forever
    inet 1.1.3.3/24 metric 100 brd 1.1.3.255 scope global dynamic eno1
       valid_lft 46655sec preferred_lft 46655sec

Is it possible to create a virtual network interface and route traffic to this virtual network interface from connections originating from IP addresses 1.1.1.1 and 1.1.2.2, leaving connections originating from 1.1.3.3 as is?

Edit: the "other end" of the virtual network will be for a VM (hosted in KVM)

Thank you.

Ali Khakbaz
  • 1,057

1 Answers1

0

This is the cobbled together solution.

-=-=-=-

ip link add veth0 type veth peer name veth1

ip link set veth0 up

ip link set veth1 up

ip link add br0 type bridge # bridge for VM

ip link set br0 up

ip link set veth1 master br0 # link veth1 to the bridge

ip rule add from 1.1.1.1 lookup vmroute

ip rule add from 1.1.2.2 lookup vmroute

ip route add default dev veth0 table vmroute

-=-=-=-=-=-=

Then add the VM's virtual interface to the bridge.

Hope this helps someone.