I've been having some trouble wrapping my head around how static routes work.
Long story short I have the following:
- Fedora26 server with CentOS7 VM.
- Host IP:
192.168.0.6
assigned to eth0 - VM IP:
192.168.122.205
- Host is also the gateway IP of 192.168.122.1 on vibr0
If I do ip route add 192.168.122.0/24 via 192.168.0.6 dev wlp3s0
then i will get:
PING 192.168.122.205 (192.168.122.205) 56(84) bytes of data.
From 192.168.122.1 icmp_seq=1 Destination Host Unreachable
From 192.168.122.1 icmp_seq=2 Destination Host Unreachable
Here is my route script from /etc/sysconfig/network-scripts:
default 192.168.0.1 dev wlp3s0
192.168.122.1 via 192.168.0.15 dev wlp3s0
192.168.122.0/24 via 192.168.122.1 dev wlp3s0
192.168.100.0/24 via 192.168.0.20 dev wlp3s0
Please note that I've tried this with and without that first hop, and just had the third line say: 192.168.122.0/24 via 192.168.0.6 dev wlp3s0
The routing between the two works fine, as the vibr0 is configured as the gateway for the 192.168.122.0/24
subnet. However, I cannot figure out how to get any other machines in the 192.168.0.0/24
subnet to connect to the VMs in the 192.168.122.0/24
subnet on that host.
I have a laptop running Fedora with an IP of 192.168.0.16
that i want to connect to the 192.168.122.205
VM in the other host.
I assume I need to do a default route addition, using the 192.168.0.6
as the gateway to 192.168.122.0/24
, but i've not had any success doing that.
So I guess my questions are: What would I need to do to make a connection from 192.168.0.16 → 192.168.0.6 (192.168.122.1) → 192.168.122.205?
Can a single interface be in two subnets? So can my wlp3s0 wifi card with the 192.168.0.16 also be assigned an IP in the 122 subnet, or is this even necessary?
Thank you for any help.