0

Well, I created a gre tunnel in virtualbox connecting two linux vms, and it worked very well. But whenever I reboot the vms, the gre simply disappears. Is there any command I can use to save gre? Or, how do I write the gre tunnel to the Linux files so it stays saved?

Both vms are Debian 12

VM1 two adapters Bridged Network mode and VM2 one adapter Bridged Network mode

Commands:

VM1:

ifconfig enp0s3 down

ifconfig enp0s8 down

ifconfig enp0s3 A.B.C.Y/24 (PUBLIC IP Internet) up

ifconfig enp0s8 192.168.1.1/24 up

route add -net 192.168.1.0/24 enp0s8

route add default gw A.B.C.X (Gateway Internet)

echo 1 > /proc/sys/net/ipv4/ip_forward

iptunnel add vpn1 mode gre remote 192.168.1.2 local 192.168.1.1 key 123456

ifconfig vpn1 10.0.0.1/30 pointopoint 10.0.0.2

route add -net 192.168.2.0/24 gw 10.0.0.2

iptables -t nat -A POSTROUTING -o enp0s3 -j SNAT --to A.B.C.Y

VM2:

ifconfig enp0s3 down

ifconfig enp0s3 192.168.1.2/24 up

route add default gw 192.168.1.1

echo 1 > /proc/sys/net/ipv4/ip_forward

iptunnel add vpn1 mode gre remote 192.168.1.1 local 192.168.1.2 key 123456

ifconfig vpn1 10.0.0.2/30 pointopoint 10.0.0.1

0

You must log in to answer this question.