Score:0

GRE tunnel issue

jp flag

I have 2 linux servers. I want to use server 1 ip for server 2 as a ddos protection, I have followed a tutorial online which works quite good but there is a small issue. While trying to do curl server1ip inside server 2 it gives me error connection timed out, while when doing curl server 1 ip from anywhere else apart from server 2 it works. Here is the commands i ran on server 1 :

echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
sysctl -p
iptunnel add gre1 mode gre local server1ip remote server2ip ttl 255
ip addr add 192.168.168.1/30 dev gre1
ip link set gre1 up
iptables -t nat -A POSTROUTING -s 192.168.168.0/30 ! -o gre+ -j SNAT --to-source server1ip
iptables -t nat -A PREROUTING -d server1ip -j DNAT --to-destination 192.168.168.2
iptables -A FORWARD -d 192.168.168.2 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

Here is the commands ran on server 2 :

iptunnel add gre1 mode gre local server2ip remote server1ip ttl 255
ip addr add 192.168.168.2/30 dev gre1
ip link set gre1 up
echo '100 BUYVM' >> /etc/iproute2/rt_tables
ip rule add from 192.168.168.0/30 table BUYVM
ip route add default via 192.168.168.1 table BUYVM

curl and ping doesn't work when i try to ping server1ip inside server2 it gives connection timed out. While i try to ping server1ip anywhere else it works.

I sit in a Tesla and translated this thread with Ai:

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.