Node A Public IP: 198.244.xxx.151
Node B Public IP: 37.59.xxx.234
Node A:
sudo ip tunnel add gre1 mode gre local 198.244.xxx.151 remote 37.59.xxx.234 ttl 255
sudo ip addr add 10.0.0.1/30 dev gre1
sudo ip link set gre1 up
iptables -t nat -A POSTROUTING -s 10.0.0.0/30 ! -o gre+ -j SNAT --to-source 198.244.xxx.151
sudo iptables -D FORWARD -d 10.0.0.2 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
sudo iptables -D FORWARD -s 10.0.0.2 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -A PREROUTING -d 198.244.xxx.151 -j DNAT --to-destination 10.0.0.2
Node B:
sudo ip tunnel add gre1 mode gre local 37.59.xxx.234 remote 198.244.xxx.151 ttl 255
sudo ip addr add 10.0.0.2/30 dev gre1
sudo ip link set gre1 up
sudo echo '100 GRE' >> /etc/iproute2/rt_tables
sudo ip rule add from 10.0.0.0/30 table GRE
sudo ip route add default via 10.0.0.1 table GRE
I would like to make it so all outbound traffic on Node B uses the IP of Node A. Running curl ifconfig.me
should return 198.244.xxx.151 from Node B where as right now it only works if I specify the IP curl http://www.cpanel.net/showip.cgi --interface 10.0.0.2