首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >基于VYOS的AWS区域间VPN

基于VYOS的AWS区域间VPN
EN

Stack Overflow用户
提问于 2015-12-23 17:10:53
回答 1查看 1.3K关注 0票数 12

我正在尝试在两个AWS区域(俄勒冈州和爱尔兰)之间建立一个VPN。在俄勒冈州,我使用了AWS服务,在爱尔兰,我使用了来自市场的vyos EC2实例。在俄勒冈州,我启动了一个实例,并为ICMP请求打开了它的安全组(测试为0.0.0.0/0)。我的Vyos实例的安全组也是打开的。

VPN在两边都有,但我有一个奇怪的问题。

Test1:

从EC2-俄勒冈州到EC2-Vyos的Ping :工作

Test2:

从EC2-Vyos到EC2-俄勒冈州的Ping :不工作

但是,如果我在EC2-俄勒冈州启动wireshark,我看到了ICMP请求,问题似乎就在ICMP的回复上:

代码语言:javascript
复制
11.609958 169.254.12.138 -> 10.10.2.45   ICMP 98 Echo (ping) request    id=0x2f3d, seq=1/256, ttl=63
11.929702   10.0.1.177 -> 10.10.2.45   ICMP 71 Time-to-live exceeded  (Time to live exceeded in transit)
12.610213 169.254.12.138 -> 10.10.2.45   ICMP 98 Echo (ping) request   id=0x2f3d, seq=2/512, ttl=63
12.929659   10.0.1.177 -> 10.10.2.45   ICMP 71 Time-to-live exceeded (Time to live exceeded in transit)
13.610111 169.254.12.138 -> 10.10.2.45   ICMP 98 Echo (ping) request  id=0x2f3d, seq=3/768, ttl=63
13.929952   10.0.1.177 -> 10.10.2.45   ICMP 71 Time-to-live exceeded (Time to live exceeded in transit)

IPs Informations:
10.0.1.177: EC2-Vyos
10.10.2.45: EC2-Oregon
169.254.12.138: The IP of my vti1 in the Vyos conf

Test3:

将Irlande中的另一个EC2实例平到EC2-俄勒冈州:不工作

但是在EC2-俄勒冈实例上,我再次看到了ICMP请求(10.2.10是我在爱尔兰的EC2实例):

代码语言:javascript
复制
  0.361551    10.0.2.10 -> 10.10.2.45   ICMP 98 Echo (ping) request  id=0x130d, seq=4/1024, ttl=62
  0.361569   10.10.2.45 -> 10.0.2.10    ICMP 98 Echo (ping) reply    id=0x130d, seq=4/1024, ttl=64
  0.627332   10.0.1.177 -> 10.10.2.45   ICMP 71 Time-to-live exceeded (Time to live exceeded in transit)
  1.369717    10.0.2.10 -> 10.10.2.45   ICMP 98 Echo (ping) request  id=0x130d, seq=5/1280, ttl=62

我不明白问题出在哪里。

我的vyos配置:

代码语言:javascript
复制
interfaces {
ethernet eth0 {
    address dhcp
    duplex auto
    hw-id 0a:14:25:f4:8f:e9
    smp_affinity auto
    speed auto
}
loopback lo {
}
vti vti0 {
    address 169.254.12.62/30
    description "VPC tunnel 1"
    mtu 1436
}
vti vti1 {
    address 169.254.12.138/30
    description "VPC tunnel 2"
    mtu 1436
}
}
protocols {
bgp 65000 {
    neighbor 169.254.12.61 {
        remote-as 7224
        soft-reconfiguration {
            inbound
        }
        timers {
            holdtime 30
            keepalive 30
        }
    }
    neighbor 169.254.12.137 {
        remote-as 7224
        soft-reconfiguration {
            inbound
        }
        timers {
            holdtime 30
            keepalive 30
        }
    }
    network 10.0.0.0/16 {
    }
}
static {
    route 10.0.0.0/16 {
        next-hop 10.0.1.1 {
        }
    }
}
}
service {
ssh {
    disable-password-authentication
    port 22
}
}
system {
config-management {
    commit-revisions 20
}
console {
    device ttyS0 {
        speed 9600
    }
}
host-name VyOS-AMI
login {
    user vyos {
        authentication {
            encrypted-password "*"
            public-keys aws_key-XXXXXX {
                key AAAAB3....
                type ssh-rsa
            }
        }
        level admin
    }
}
ntp {
    server 0.pool.ntp.org {
    }
    server 1.pool.ntp.org {
    }
    server 2.pool.ntp.org {
    }
}
package {
    auto-sync 1
    repository community {
        components main
        distribution helium
        password ""
        url http://packages.vyos.net/vyos
        username ""
    }
}
syslog {
    global {
        facility all {
            level notice
        }
        facility protocols {
            level debug
        }
    }
}
time-zone UTC
}
vpn {
ipsec {
    esp-group AWS {
        compression disable
        lifetime 3600
        mode tunnel
        pfs enable
        proposal 1 {
            encryption aes128
            hash sha1
        }
    }
    ike-group AWS {
        dead-peer-detection {
            action restart
            interval 15
            timeout 30
        }
        key-exchange ikev1
        lifetime 28800
        proposal 1 {
            dh-group 2
            encryption aes128
            hash sha1
        }
    }
    ipsec-interfaces {
        interface eth0
    }
    nat-traversal enable
    site-to-site {
        peer 52.XX.XXX.113 {
            authentication {
                id 52.XX.XXX.132
                mode pre-shared-secret
                pre-shared-secret 7bRiFaXXXXXX
                remote-id 52.XX.XXX.113
            }
            connection-type initiate
            description "VPC tunnel 1"
            ike-group AWS
            local-address 10.0.1.177
            vti {
                bind vti0
                esp-group AWS
            }
        }
        peer 54.186.XXX.33 {
            authentication {
                id 52.XX.XXX.132
                mode pre-shared-secret
                pre-shared-secret AT2Q4XXXXXXXXXX
                remote-id 54.XXX.XXX.33
            }
            connection-type initiate
            description "VPC tunnel 2"
            ike-group AWS
            local-address 10.0.1.177
            vti {
                bind vti1
                esp-group AWS
            }
        }
    }
}
}

更新:

问题解决了。

您可以在此回购https://github.com/mboret/aws-vyos上找到整个配置过程(工作)。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-12-30 09:32:31

最后,通过Vyos的升级,我的问题得到了解决。(这个问题最终是由VyOS错误引起的。( 三百五十八405,固定于1.1.2版.)

解决方案(在Vyos实例上而不是在“配置”模式下):

代码语言:javascript
复制
add system image http://packages.vyos.net/iso/release/1.1.5/vyos-1.1.5-amd64.iso
(Press Enter and answer Yes at each question).
reboot

现在我可以通过VPN连接进行ping和访问。唯一不起作用的是test2,Vyos实例不能通过VPN进行切换,但这对我来说并不重要,所有其他实例都可以通过它访问。

我创建了一个存储库,其中包含了设置AWS区域间虚拟专用网的过程:https://github.com/mboret/aws-vyos

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34440607

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档