While your description does not provide enough information (such IPs, etc) for us to provide a full/complete answer, the basic idea is that you create a static route so that any traffic for that specific IP you want goes through the GRE tunnel.
So if for example you want to route 190.93.247.183
via the GRE tunnel you add a static route with the following command.
ip route add 190.93.247.183 via 10.0.0.1 dev tun0
The 10.0.0.1
address is the remote address of the GRE tunnel (not the public address) that will be used as a gateway.
So you replace it with whatever you have configured on your tunnel. In your diagram you mention this address as gre addr
.
Also you need to replace tun0
with whatever name your GRE Tunnel interface has.
This route should be added on the client
side (I am not sure which side is that on your diagram, you mention alpha and beta there but not on your description)
This will route everything (UDP,TCP,ICMP...) for that IP through the tunnel.
Also keep in mind that this works only for IPs. So if you want to route www.serverfault.com (which resolves to multiple IPs - and may change from time to time) you cannot do it via DNS. You need to add static routes for all related IPs you want to route through the tunnel.
Finally keep in mind that the static route will be lost after a reboot.
You will need to add it on some configuration file to persist after a reboot. Depending on your distro this is different.
Here's an example for a Debian (or debian based) disto:
On file /etc/network/interfaces
auto tun1
iface tun1 inet static
address <tunnel IP>
netmask <tunnel subnet mask>
pre-up iptunnel add tun1 mode gre local <local IP> remote <remote IP> ttl 255
up ifconfig tun1 multicast
pointopoint <remote tunnel IP>
post-up ip route add <IP to route via tunnel> via <remote tunnel IP> dev tun0
post-down iptunnel del tun1
Edit:
My apologies, I didn't see that you have mentioned that you use CentOS.
Here's how to add permanent static routes on a CentOS (or any RHEL based) box.
You need to create a route file based on your interface name.
So for example if your interface name (tunnel in your case) is tun0
then you need to create the following file:
/etc/sysconfig/network-interfaces/route-tun0
In it you simply add the following:
<IP to route via tunnel> via <remote tunnel IP>
For any extra IPs or subnets you want to route via the tunnel, you simply add more lines like the one abone, on the same file.
For subnets you can add them in the following format: 10.0.0.0/8
Finally to apply the above configuration you can either bring down and then up he tun0 interface
ifdown tun0 ; ifup tun0
or completely restart the network
service network restart