I take issue with the people claiming this is not possible, i don't know if it is possible on cisco gear but it is certainly possible in general.
There are a few problems we need to deal with.
- The router needs to know which interface each destination is on. When you assign an IP and subnet to each interface it implicitly creates a route but you now have two routes for the same destination, only one of them will end up actually getting used.
- The clients need to send the traffic to the router. Normally clients choose to send traffic to a router based on the subnet mask but that isn't going to work here.
- Apparently some routing platforms forbid such configurations.
Point 1 can be solved by adding explicit routes to tell the router which interface each end system is on.
Point 2 can be solved by using proxy arp.
Point 3 is simply a matter of choosing a routing platform that doesn't have such artificial restrictions. For example Linux.
Here is a worked example of such a setup on Linux, I will use three network namespaces to represent the router and the two clients.
#create virtual Ethernet interfaces
ip link add veth0 type veth peer name veth1
ip link add veth2 type veth peer name veth3
#create network namespaces
ip netns add clienta
ip netns add clientb
ip netns add router
#put interfaces into network namespaces
ip link set veth0 netns clienta
ip link set veth1 netns router
ip link set veth2 netns router
ip link set veth3 netns clientb
ip netns exec clienta ifconfig lo up
ip netns exec clienta ifconfig veth0 192.168.0.2/24 up
ip netns exec clienta ip route add default via 192.168.0.1
ip netns exec clientb ifconfig lo up
ip netns exec clientb ifconfig veth3 192.168.0.3/24 up
ip netns exec clientb ip route add default via 192.168.0.1
ip netns exec router ifconfig lo up
ip netns exec router ifconfig veth1 192.168.0.1/24 up
ip netns exec router ifconfig veth2 192.168.0.1/24 up
#tell the router where each client is
ip netns exec router ip route add 192.168.0.2 dev veth1
ip netns exec router ip route add 192.168.0.3 dev veth2
#now the router can ping the clients (but they can't ping each other yet)
ip netns exec router ping 192.168.0.2
ip netns exec router ping 192.168.0.3
#enable routing on the router
echo 1 | ip netns exec router sponge /proc/sys/net/ipv4/conf/all/forwarding
#for the clients to ping each other we also need the proxy arp
#we could enable generic proxy arp but that is a very dangerous option, better to
#only proxy the things we actually need to proxy
ip netns exec router ip neigh add proxy 192.168.0.3 dev veth1
ip netns exec router ip neigh add proxy 192.168.0.2 dev veth2
#now the clients can ping each other
ip netns exec clienta ping 192.168.0.3
ip netns exec clientb ping 192.168.0.2
#traceroute shows we are actually routing
ip netns exec clienta traceroute -n 192.168.0.3
ip netns exec clientb traceroute -n 192.168.0.2