Общедоступная Маршрутизация IP по Частному туннелю GRE

rm -r /path/to/directory/*

или

rm -rv /path/to/directory/*

если Вы хотите видеть то, что происходит.

0
задан 14 December 2009 в 02:30
2 ответа

Маршруты должны существовать в обоих направлениях, полностью через путь. Я не совсем уверен из Вашего описания точно, что не работает.

1
ответ дан 4 December 2019 в 13:11

Это уже поздно, но если вы не решили это, вот как:

В вашем примере просто замените:

  • publicip: 8.8.8.8 на 50.2 .2.2
  • publicip: 7.7.7.7 с частным IP-адресом 70.2.2.3
  • , может быть любым допустимым частным адресом.
  • privateip: 10.0.201.1 и 10.0.201.2

Public IP-адрес:

  • A = 50.2.2.2-22
  • B = 70.2.2.3

туннелирование с gre:

На A:

# adding the interface for the tunnel
$ ip tunnel add tun2 mode gre remote 70.2.2.3 ttl 64

# setting the private ip address 
$ ifconfig tun2 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

# add the permanent entries to the arp table in order to get the complete loop. (without this doesn't work)
# replace the public ips for your ips, and the mac for your real mac for your interface
# the word pub it's the most important here, if it's not there the arps will never go outside
$ arp -s 50.2.2.20 00:00:00:00:00:00 -i eth0 pub
$ arp -s 50.2.2.21 00:00:00:00:00:00 -i eth0 pub
$ arp -s 50.2.2.22 00:00:00:00:00:00 -i eth0 pub

На B:

# adding the interface for the tunnel
$ ip tunnel add tun2 mode gre remote 50.2.2.2 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 50.2.2.20/32 dev eth0
$ ip ad add 50.2.2.21/32 dev eth0
$ ip ad add 50.2.2.22/32 dev eth0

И все, у вас должен быть полностью функциональный туннель и возможность IP-адреса маршрутов, которые находятся далеко от того места, где вы хотите их использовать, так что теперь вы можете начать привязку некоторых демонов к этим IP-адресам.

Еще нужно иметь в виду, что если у вас так много IP-адресов, вы '

2
ответ дан 4 December 2019 в 13:11

Теги

Похожие вопросы