Help adding ip address from another machine using a gre tunnel in linux.

equinox654

Gawd
Joined
Apr 7, 2005
Messages
890
Its a long shot but I was hoping someone would know how to do this.


I have a machine hosting a server. Lets call it <server>.
I have another machine <ip host> with an ip that I want to put on on <server>
Both are on centos

I used to do this 9 years ago and can't find my notes and my memory is foggy. I found a guide and went about it like this:

--------------------------------------------------------------------------
# adding the interface for the tunnel
ip tunnel add tun2 mode gre remote <server ip> local <ip host> ttl 64

# setting the private ip address
ifconfig tun1 10.0.201.1/24
ifconfig tun2 up

# A point to point
ifconfig tun2 pointopoint 10.0.201.2

# enabling multicast (it's not necessary for this)
ifconfig tun2 multicast

ifconfig tun2 arp
ifconfig tun2 broadcast

# default route for the tunnel
ip route add 10.0.201.2 dev tun2

# enable ip forward
echo 1 > /proc/sys/net/ipv4/ip_forward

arp -s <desired from host> <ip host mac addr> -i eth0 pub
-------------------------------------------------------------------------------

# adding the interface for the tunnel
ip tunnel add tun2 mode gre remote <ip host> local <server ip> ttl 64

# setting the private ip address
ifconfig tun2 10.0.201.2/24
ifconfig tun2 up

# point to point B
$ ifconfig tun2 pointopoint 10.0.201.1

# enabling multicast (it's not necessary for this)
$ ifconfig tun2 multicast

$ ifconfig tun2 arp
$ ifconfig tun2 broadcast

# default route for the tunnel
$ ip route add 10.0.201.1 dev tun2

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

# putting the ips to listen in the eth0 as secondary ips
$ ip ad add <desired ip from source> /32 dev eth0
--------------------------------------------------------------------------------

I can ping between the two computers using the tunnel interface, but I cant ping out from the ip address that I assigned.

I feel like I am missing something. I remember back in the day I did it slightly differently. Possibly something to do with the loopback device.

I would appreciate any help.
 
Check the upstream router. I think you'll find it doesn't know about your assigned IP address.
 
Back
Top