Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Bridging or routing IP address over a GRE tunnel? - RESOLVED

linuxthefishlinuxthefish Member
edited August 2016 in Help

I have 2 servers. Server A has 2 IP's routed to it by my provider, and server B has 1 IP routed to it by my provider.

Server A has 185.61.221.146 (main IP) and 185.238.173.172. Server B has IP address 185.32.145.253

I want to be able to access server B via server A's external IP 185.238.173.172, with traffic going over the GRE tunnel.

I've setup a GRE tunnel between the 2 servers like so:

Server A

root@A:~# echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
root@A:~# sysctl -p
root@A:~# ip tunnel add gre1 mode gre local 185.61.221.146 remote 185.32.145.253 ttl 255
root@A:~# ip addr add 192.168.1.1/24 dev gre1
root@A:~# ip link set gre1 up
root@A:~# ping 192.168.1.254
PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.
64 bytes from 192.168.1.254: icmp_req=1 ttl=64 time=8.56 ms
64 bytes from 192.168.1.254: icmp_req=2 ttl=64 time=8.64 ms
64 bytes from 192.168.1.254: icmp_req=3 ttl=64 time=8.57 ms

Server B

[root@B ~]# echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
[root@B ~]# sysctl -p
[root@B ~]# ip tunnel add gre1 mode gre local 185.32.145.253 remote 185.61.221.146 ttl 255
[root@B ~]# ip addr add 192.168.1.254/24 dev gre1
[root@B ~]# ip link set gre1 up
[root@B ~]# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_req=1 ttl=64 time=8.51 ms
64 bytes from 192.168.1.1: icmp_req=2 ttl=64 time=8.59 ms
64 bytes from 192.168.1.1: icmp_req=3 ttl=64 time=8.58 ms

I then added server A's 2nd IP to the gre1 interface on server B:

[root@B ~]# ip addr add 185.238.173.172 dev gre1

And added routes for that IP, to the other server's gre1 IP:

root@A:~# ip route add 185.238.173.172 via 192.168.1.254
[root@B ~]# ip route add 185.238.173.172 via 192.168.1.1

And confirmed I can ping 185.238.173.172 from both ends:

root@A:~# ping 185.238.173.172
PING 185.238.173.172 (185.238.173.172) 56(84) bytes of data.
64 bytes from 185.238.173.172: icmp_req=1 ttl=64 time=8.87 ms
64 bytes from 185.238.173.172: icmp_req=2 ttl=64 time=8.88 ms

[root@B ~]# ping 185.238.173.172
PING 185.238.173.172 (185.238.173.172) 56(84) bytes of data.
64 bytes from 185.238.173.172: icmp_seq=1 ttl=64 time=0.027 ms
64 bytes from 185.238.173.172: icmp_seq=2 ttl=64 time=0.022 ms

Now I wish to get external connectivity to 185.238.173.172 going to server B. How can I do this?

Running a traceroute shows traffic reaching server A, but I then need to route traffic to server B.

                                   Packets               Pings
 Host                            Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. xxx.137.xxx.x                 0.0%    11    0.1   0.1   0.1   0.1   0.0
 2. xxx.137.xxx.x                 0.0%    11    0.1   0.1   0.1   0.1   0.0
 3. 83.231.235.253                0.0%    11    1.2   2.5   1.2  12.1   3.2
 4. 5.158.213.46                  0.0%    11    1.3   1.6   1.2   2.8   0.6
 5. ???
 6. 185.61.221.146                0.0%    11    1.2   1.2   1.2   1.3   0.0
 7. ???

Is this possible?

Comments

This discussion has been closed.