Score:0

Totally isolate two interfaces -Linux

us flag

I'm a bit embarrassed but I need your help.

I have three interfaces on a virtual machines. I want to completely isolate my interfaces between them. I created one route table for each interface:

    inet 192.168.1.100/24 brd 192.168.1.255 scope global ens192
3: ens224: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    inet 192.168.10.100/24 brd 192.168.10.255 scope global ens224
4: ens256: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    inet 192.168.20.100/24 brd 192.168.20.255 scope global ens256
Network interface exemple:
        up /sbin/ip route add default via 192.168.10.1 dev ens224 table in
        up /sbin/ip rule add from 192.168.10.100/32 table  in
        post-down /sbin/ip rule del from 192.168.10.100/32 table  in
        post-down /sbin/ip route del default via 192.168.10.1 dev ens224 table  in

But when I try to telnet or ping or whatever from one interface to another one, all the traffic go through the loopback. Is there a way to correct that?

Score:0
cn flag

As per this answer, you can use the -I flag to specify an interface for ping to use.

Also, unless you enable net.ipv4.ip_forward in sysctl, the interfaces won't route between them. You can mitigate this further by dropping all FORWARD traffic with iptables.

If you wanted to further isolate the interfaces then I expect you could use iptables to drop traffic that has the inbound and outbound interfaces different, something like:

iptables -A OUTPUT -i ens192 -o ens224 -j DROP
iptables -A OUTPUT -i ens192 -o ens256 -j DROP
... etc for other permutations of the 3 interfaces ...

Without understanding the problem space more, that's the best answer I can give.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.