I need to route my PC network traffic through a VMWare machine. What setup I thought about that is using a vm with two interfaces and forcing the PC to send the traffic to VMNet1
instead of Ethernet
(using interface metric or routing). The setup is look like the following picture:
I have enabled ip_forward
in /proc/sys/net/ipv4/
, but seems isn't enough.
In the PC I can access to ens33
and ens37
:
- Pinging 192.168.1.3 from PC is OK
- Pinging 192.168.1.4 from PC is OK
- ARP table (arp -a) shows 192.168.1.3-4 in 192.168.1.5's entry
- I can't ping 192.168.1.1 through VMNet1 (ping -S 192.168.1.5 192.168.1.1)
In the vm:
- Pinging 192.168.1.1 only through ens37 is OK (ping -I ens37 192.168.1.1)
Question
With the above details, I think my problem is routing/forwarding incoming packet from ens33
to ens37
in the vm, so how to do this?
Further information:
~$ ip route
default via 192.168.1.1 dev ens37 proto static metric 101
192.168.1.0/24 dev ens33 proto kernel scope link src 192.168.1.3 metric 100
192.168.1.0/24 dev ens37 proto kernel scope link src 192.168.1.4 metric 101
~$ networkctl status -a
● 1: lo
Link File: /usr/lib/systemd/network/99-default.link
Network File: n/a
Type: loopback
State: carrier (unmanaged)
Address: 127.0.0.1
::1
● 2: ens33
Link File: /usr/lib/systemd/network/99-default.link
Network File: n/a
Type: ether
State: routable (unmanaged)
Path: pci-0000:02:01.0
Driver: e1000
Vendor: Intel Corporation
Model: 82545EM Gigabit Ethernet Controller (Copper) (PRO/1000 MT Single Port Adapter)
HW Address: 00:0c:29:2e:5e:a0 (VMware, Inc.)
Address: 192.168.1.3
fe80::a71c:e329:2378:4972
● 3: ens37
Link File: /usr/lib/systemd/network/99-default.link
Network File: n/a
Type: ether
State: routable (unmanaged)
Path: pci-0000:02:05.0
Driver: e1000
Vendor: Intel Corporation
Model: 82545EM Gigabit Ethernet Controller (Copper) (PRO/1000 MT Single Port Adapter)
HW Address: 00:0c:29:2e:5e:aa (VMware, Inc.)
Address: 192.168.1.4
fe80::20c:29ff:fe2e:5eaa
Gateway: 192.168.1.1 (TP-LINK TECHNOLOGIES CO.,LTD.)
fe80::1 (TP-LINK TECHNOLOGIES CO.,LTD.)
~$ ip neigh
192.168.1.103 dev ens37 lladdr 3c:bb:fd:3d:25:00 REACHABLE
192.168.1.103 dev ens33 FAILED
192.168.1.1 dev ens37 lladdr 90:f6:52:03:3b:00 STALE
192.168.1.100 dev ens37 lladdr 40:61:86:e2:dd:00 STALE
192.168.1.1 dev ens33 FAILED
192.168.1.5 dev ens33 lladdr 00:50:56:c0:00:00 STALE
C:\WINDOWS\system32>arp -a
Interface: 192.168.1.100 --- 0x10
Internet Address Physical Address Type
192.168.1.1 90-f6-52-03-3b-00 dynamic
...
Interface: 192.168.1.5 --- 0x1e
Internet Address Physical Address Type
192.168.1.3 00-0c-29-2e-5e-a0 dynamic
192.168.1.4 00-0c-29-2e-5e-a0 dynamic
...
Edit:
I've realized my setup is not very correct despite networking, I mean it's wrong to use multiple interface with same subnet in one system, so I've changed the setup: