I want to use a Linux VM as a default gateway, so that two virtual machines communicate with each other through Linux VM:
Code: Select all
Windows VM-1 ---> Linux Box ---> Windows VM-2
Thank you.
Code: Select all
Windows VM-1 ---> Linux Box ---> Windows VM-2
Hello,scottgus1 wrote: ↑18. Sep 2023, 15:06 Please see Virtualbox Networks: In Pictures: "Sandbox". Use Linux as the middle routing OS instead of pfSense.
Hello,scottgus1 wrote: ↑19. Sep 2023, 17:40 1. In your case, between Windows VM-1 and Linux Box would be one Internal network, and between Linux Box and Windows VM-2 there would be a different Internal network. Each Internal network needs a different name.
VM1 - InternalA - Linux Box - InternalB - VM2
Each uniquely-named Internal network is a separate network.
2. You could have each Windows VM with a static IP address if you wish. The Linux VM need a router service running, and each side of the router needs to be compatible with the IP address settings you choose for each VM. You could also have the Linux VM provide DHCP for either or both sides of the router, or have each or both Internal networks provide DHCP.
Code: Select all
# ifconfig
CLIENT: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::a00:27ff:fee5:267c prefixlen 64 scopeid 0x20<link>
ether 08:00:27:e5:26:7c txqueuelen 1000 (Ethernet)
RX packets 116 bytes 16859 (16.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 24 bytes 4768 (4.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
NAT: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::a00:27ff:fe7b:8f51 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:7b:8f:51 txqueuelen 1000 (Ethernet)
RX packets 531 bytes 114732 (112.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 481 bytes 120876 (118.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
SERVER: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::a00:27ff:febc:c5a7 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:bc:c5:a7 txqueuelen 1000 (Ethernet)
RX packets 114 bytes 16175 (15.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 26 bytes 5452 (5.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Each side of the Linux router VM needs a different IP range. So 192.168.1.#/24 for VM-1, and perhaps 172.16.1.#/24 for VM-2. Linux Router VM will route between 192.168.1.# and 172.16.1.#
Hello,scottgus1 wrote: ↑20. Sep 2023, 12:51Each side of the Linux router VM needs a different IP range. So 192.168.1.#/24 for VM-1, and perhaps 172.16.1.#/24 for VM-2. Linux Router VM will route between 192.168.1.# and 172.16.1.#
Alsp, Please zip and post the .vbox files for all three VMs, so we can check the Internal networks' settings.
Server wrote:<InternalNetwork name="intnet"/>
Client wrote:<InternalNetwork name="intnet"/>
Linux Box wrote: <Adapter slot="1" enabled="true" MACAddress="080027BCC5A7" type="82540EM">
<InternalNetwork name="intnet"/>
<Adapter slot="2" enabled="true" MACAddress="080027E5267C" type="82540EM">
<InternalNetwork name="intnet"/>
Because you have all four Internal network cards attached to the same Internal name, they are all attached to the one Internal "switch", see Virtualbox Networks: In Pictures: Internal Network, note the different Internal names and what happens.
Hello,scottgus1 wrote: ↑20. Sep 2023, 15:51 Looks like you haven't set up the Internal networks correctly:
Server wrote:<InternalNetwork name="intnet"/>Client wrote:<InternalNetwork name="intnet"/>Linux Box wrote: <Adapter slot="1" enabled="true" MACAddress="080027BCC5A7" type="82540EM">
<InternalNetwork name="intnet"/>
<Adapter slot="2" enabled="true" MACAddress="080027E5267C" type="82540EM">
<InternalNetwork name="intnet"/>Because you have all four Internal network cards attached to the same Internal name, they are all attached to the one Internal "switch", see Virtualbox Networks: In Pictures: Internal Network, note the different Internal names and what happens.
All your VMs are peers of each other on this one "intnet" Internal "switch" and none of the VMs must go through a particular VM to reach the other VM.
See what you can make of this.
Code: Select all
NIC1: intnet-1
NIC2: intnet-2
Note that how you'd route the 192.168 side to the 172.16 side and back is a Linux question, suitable for a Linux forum or help channel.
Hello,scottgus1 wrote: ↑21. Sep 2023, 23:01 Yes, that sounds correct.
Then you have to make VM-2's side of the network a different IP range than VM-1's side:Note that how you'd route the 192.168 side to the 172.16 side and back is a Linux question, suitable for a Linux forum or help channel.
Hello,scottgus1 wrote: ↑25. Sep 2023, 13:11 I'm thinking from how house routers on the internet work. The private LAN side has private IP addresses for the LAN computers, and the internet on the public side of the router can have every other IP address except for private IP addresses. So the private side has a different IP address range than the public side, and the router passes traffic between the two.
Also, the computers on the private LAN side are not connected directly to the internet's public network connection. The private computers connect to the router with their own physical cables, and the public side connects to the router with its own separate cables. There is no connection between the private cables and the public cables except through the router.
So, to duplicate this, two separate Internal networks are needed, one to connect VM-1 to the router VM, and the other to connect VM-2 to the router VM.
It is apparently possible to have different IP ranges transceiving on the same cable, but that's beyond my knowledge to handle.
Code: Select all
# ifconfig
CLIENT: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::a00:27ff:fee5:267c prefixlen 64 scopeid 0x20<link>
ether 08:00:27:e5:26:7c txqueuelen 1000 (Ethernet)
RX packets 4549 bytes 315605 (308.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4083 bytes 275077 (268.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
NAT: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::a00:27ff:fe7b:8f51 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:7b:8f:51 txqueuelen 1000 (Ethernet)
RX packets 2309 bytes 168802 (164.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2025 bytes 1026930 (1002.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
SERVER: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.1.2 netmask 255.255.255.0 broadcast 172.16.1.255
inet6 fe80::a00:27ff:febc:c5a7 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:bc:c5:a7 txqueuelen 1000 (Ethernet)
RX packets 3092 bytes 221144 (215.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3314 bytes 220620 (215.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Code: Select all
Client (192.168.1.1):
C:\> route ADD 172.16.1.0 MASK 255.255.255.0 192.168.1.2
Server (172.16.1.1):
C:\> route ADD 192.168.1.0 MASK 255.255.255.0 172.16.1.2