[AWS] AWS Transit Gateway์™€ ๋‹ค์ค‘ Customer Gateway ๊ฐ„ Site-to-Site VPN ์—ฐ๊ฒฐ ์ด์ค‘ํ™” ๊ตฌ์„ฑ (BGP)

2023. 9. 7. 21:33ใ†AWS/troubleshooting

๐ŸŒŽ ํ™˜๊ฒฝ

์‹ ๊ทœ๋กœ ํ†ต์‹ ์ด ํ•„์š”ํ•œ ์™ธ๋ถ€ ๋„คํŠธ์›Œํฌ์™€ VPN์œผ๋กœ ์—ฐ๊ฒฐํ•˜๊ณ ์ž ํ•œ๋‹ค. Client Network ์ •์ฑ… ์ƒ ๋‘ ๊ฐœ์˜ vpn ip๋ฅผ ์ œ๊ณตํ•˜์—ฌ ๊ฐ๊ฐ์„ primary, secondary ํ„ฐ๋„๋กœ ์ด์šฉํ•œ๋‹ค.

AWS์—์„œ๋Š” Client์™€ Site-to-Site VPN์„ ์—ฐ๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ์ œ๊ณต๋ฐ›์€ IP๋กœ ๋‘ ๊ฐœ์˜ Customer Gateway๋ฅผ ์ƒ์„ฑํ•˜์˜€๊ณ  ๊ฐ CGW์— ๋Œ€ํ•ด์„œ Site-to-Site VPN connection์„ ์ƒ์„ฑํ•˜์˜€๋‹ค. Client๋Š” BGP๋ฅผ ์ง€์›ํ•˜์—ฌ AWS์˜ VPN Connection์€ dynamic ํƒ€์ž…์œผ๋กœ ์ƒ์„ฑํ•˜์˜€๊ณ  AWS ๋‚ด VPN ํƒ€๊ฒŸ ํƒ€์ž…์€ ๊ธฐ์กด ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋Š” Transit Gateway๋กœ ์ง€์ •ํ•˜์˜€๋‹ค. ๋งˆ์ง€๋ง‰์œผ๋กœ, ์ƒ์„ฑํ•œ VPN ์—ฐ๊ฒฐ์— ๋Œ€ํ•œ Transit Gateway Attachment๋ฅผ 2ea ์ƒ์„ฑํ•˜์˜€๋‹ค.

  • Customer Gateway : 2ea
  • Site-to-Site VPN Connection : 2ea
    • type: dynamic
    • target gateway type: transit gateway
  • Transit Gateway Attachment : 2ea

 

 

โ˜„๏ธ ๋ฌธ์ œ

์ƒ์„ฑํ•œ VPN ์—ฐ๊ฒฐ์€ 2๊ฐœ์ด์ง€๋งŒ ํ•œ ์—ฐ๊ฒฐ ๋‹น ํ•œ ํ„ฐ๋„๋งŒ up ์ƒํƒœ์ด๊ธฐ ๋•Œ๋ฌธ์— up์ธ ํ„ฐ๋„์— ๋Œ€ํ•ด์„œ ์žฅ์•  ๋ฐœ์ƒ ์‹œ ๋™์ผํ•œ ์—ฐ๊ฒฐ์— ์žˆ๋Š” ํ„ฐ๋„์ด up๋˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๊ณ , ๋‹ค๋ฅธ VPN ์—ฐ๊ฒฐ์ด ํ†ต์‹ ์— ์ด์šฉ๋˜์–ด์•ผ ํ•œ๋‹ค. ์ฆ‰, vpn-01์— tunnel-01(up), tunnel-02(down)๊ฐ€ ์žˆ๊ณ  vpn-02์— tunnel-03(up), tunnel-04(down)๊ฐ€ ์žˆ๋Š”๋ฐ ํ‰์†Œ ํ†ต์‹ ํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋˜ vpn-01์˜ tunnel-01์— ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธฐ๋ฉด vpn-02๋ฅผ ํ†ต์‹ ์— ์ด์šฉํ•ด์•ผ ํ•œ๋‹ค. ๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— transit gateway์˜ route table์—์„œ ์™ธ๋ถ€ ๋„คํŠธ์›Œํฌ ๋Œ€์—ญ์— ๋Œ€ํ•ด vpn-01๊ณผ ์—ฐ๊ฒฐํ•œ tgw attachment ๊ฐ€ vpn-02์™€ ์—ฐ๊ฒฐ๋œ tgw attachment๋กœ ์ž๋™์œผ๋กœ ๋ณ€๊ฒฝ๋˜์–ด์•ผ ํ•œ๋‹ค.

trangit gateway routing table์—์„œ๋Š” ๊ฐ™์€ CIDR ๋Œ€์—ญ์— ๋Œ€ํ•ด์„œ ๋‹ค๋ฅธ attachment๋กœ ๋ผ์šฐํŒ…์„ ์ถ”๊ฐ€ํ•  ์ˆ˜๊ฐ€ ์—†๋‹ค. route table์— ๋ช…์‹œ๋œ attachment(vpn-01)์— ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธฐ๋Š” ๊ฒฝ์šฐ, route table์€ BLACKHOLE์„ ๊ฐ€๋ฆฌํ‚ค๊ฒŒ ๋œ๋‹ค. ๋”ฐ๋ผ์„œ transit gateway route table์—์„œ ์ˆ˜๋™์œผ๋กœ ๋™์ผํ•œ CIDR ๋Œ€์—ญ์— ๋Œ€ํ•ด ๋‹ค๋ฅธ attachment(vpn-02)๋กœ ๋ณ€๊ฒฝํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค.

 


 

๐Ÿ”ซ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

Static Route๋ฅผ ์ด์šฉํ•˜์ง€ ์•Š๊ณ   attachment๋ฅผ ๋ชจ๋‘ propagation์œผ๋กœ ์ƒ์„ฑํ•œ๋‹ค.

propagation์„ ์ƒ์„ฑํ•˜๋ฉด ํ•ด๋‹น CIDR ๋Œ€์—ญ์— ๋Œ€ํ•ด propagted type์œผ๋กœ ๊ฒฝ๋กœ๊ฐ€ ํ•˜๋‚˜ ์ƒ์„ฑ๋œ๋‹ค. 

Fail-Over ํ…Œ์ŠคํŠธ ์‹œ ์™ธ๋ถ€์— ์žˆ๋Š” VPN ์žฅ๋น„์—์„œ ์ž„์˜๋กœ vpn-01 ํ„ฐ๋„์„ ๋‹ค์šด ์‹œํ‚ค๋ฉด transit gateway์˜ route table์—์„œ ์ž๋™์œผ๋กœ attachment๊ฐ€ ๋ณ€๊ฒฝ๋œ๋‹ค. ์ฆ‰ primary vpn connection์—์„œ secondary vpn connection์œผ๋กœ ๋ผ์šฐํŒ… ๊ฒฝ๋กœ๊ฐ€ ์ž๋™์œผ๋กœ ๋ณ€๊ฒฝ๋œ๋‹ค.

๐Ÿšจ ์ฃผ์˜ ๐Ÿšจ
CIDR ๋Œ€์—ญ์„ prefix list๋กœ ๊ด€๋ฆฌํ•˜์—ฌ Transit Gateway์— Prefix list references๋กœ ์ถ”๊ฐ€ํ•ด๋„ route type์ด propagated๋กœ ํ‘œ์‹œ๋œ๋‹ค. ํ•˜์ง€๋งŒ ์ด ๊ฒฝ์šฐ์—๋Š” vpn connection์ด ๋‹ค์šด๋˜์–ด๋„ ์ž๋™์œผ๋กœ attachment๋ฅผ ๋ณ€๊ฒฝํ•ด์ฃผ์ง€ ์•Š์œผ๋‹ˆ ์ฃผ์˜ํ•˜์ž.

๋™์  VPN์„ ์‚ฌ์šฉํ•˜๋ฉด ์—ฌ๋Ÿฌ VPN ์—ฐ๊ฒฐ์„ ๋™์ผํ•œ Transit Gateway ํƒ€๊ฒŸ์œผ๋กœ ๊ตฌ์„ฑํ•˜๊ณ  BGP ์†์„ฑ์— ๋”ฐ๋ผ Active/Passive๋กœ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์ค‘๋‹จ์ด ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š”๋‹ค. Dynamic์œผ๋กœ ๊ตฌ์„ฑ๋œ ์ค‘๋ณต VPN ํ„ฐ๋„์„ ํ†ตํ•ด ์™ธ๋ถ€๋ง์—์„œ advertise ๋˜๋Š” BGP ๊ฒฝ๋กœ๊ฐ€ ๋‹ค์Œ hop์„ 2๊ฐœ์˜ VPN ์—ฐ๊ฒฐ๋กœ ์‚ฌ์šฉํ•˜์—ฌ TGW๋กœ ์ž๋™์œผ๋กœ ์ „ํŒŒ๋œ๋‹ค.

 

AWS๋กœ VPN ์—ฐ๊ฒฐํ•˜๋Š” ์™ธ๋ถ€ ๋„คํŠธ์›Œํฌ์—์„œ๋Š” ์„ค์ • ๊ด€๋ จํ•˜์—ฌ ์•„๋ž˜์™€ ๊ฐ™์€ AWS Support ticket ๋‹ต๋ณ€์„ ๋ฐ›์•˜๋‹ค.

ํŠธ๋ž˜ํ”ฝ์— ์˜ํ–ฅ์„ ์ค„ ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•๊ณผ ๊ด€๋ จํ•˜์—ฌ AWS๋กœ์˜ ์•„์›ƒ๋ฐ”์šด๋“œ ํŠธ๋ž˜ํ”ฝ์„ ๊ทน๋Œ€ํ™”ํ•˜๊ธฐ ์œ„ํ•ด ์˜จํ”„๋ ˆ๋ฏธ์Šค ์ธก์—์„œ ๊ธฐ๋ณธ ํ„ฐ๋„์— ๋Œ€ํ•œ “High Local preference” BGP ์†์„ฑ์„ ์‚ฌ์šฉํ•˜๊ณ , AWS์—์„œ ์˜จํ”„๋ ˆ๋ฏธ์Šค๋กœ ๋ฐ˜ํ™˜๋˜๋Š” ํŠธ๋ž˜ํ”ฝ์ด ํ•ญ์ƒ ๊ธฐ๋ณธ (Primary) ํ„ฐ๋„ ๊ฒฝ๋กœ๋ฅผ ๋”ฐ๋ฅด๋„๋ก, ๋ณด์กฐ ํ„ฐ๋„ (Secondary)์— “AS path prepending” BGP ์†์„ฑ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋‘ VPN ์—ฐ๊ฒฐ ๋ชจ๋‘์— ๋™์ผํ•œ ๊ฒฝ๋กœ๋ฅผ ์•Œ๋ฆด ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

VPN-ABC (ํ„ฐ๋„ 1) - Local Preference: 500 | AS PATH : 65270

VPN-XYZ (ํ„ฐ๋„ 3) - Local Preference: 300 | AS PATH : 65270 65270 65270

 

AWS Site-to-Site VPN์€ ์—ฐ๊ฒฐ๋˜๋Š” ์™ธ๋ถ€์˜ VPN ์žฅ๋น„์˜ ์„ค์ •์„ ๋”ฐ๋ผ๊ฐ„๋‹ค๊ณ  ํ•˜๋‹ˆ ์ฐธ์กฐํ•ฉ์‹œ๋‹ค.

 

 


๐Ÿ”— ์ฐธ๊ณ  ๋งํฌ

  1. AWS Docs: AWS Transit Gateway์™€ VPN์˜ ์กฐํ•ฉ (์—์„œ ๋‘๋ฒˆ์งธ ๋‹ค์ด์•„๊ทธ๋žจ)
  2. AWS Docs: ์ „์†ก ๊ฒŒ์ดํŠธ์›จ์ด๋ฅผ ํ†ตํ•œ ๋‹ค์ค‘ Site-to-Site VPN ์—ฐ๊ฒฐ
  3. AWS Docs: AWS Transit Gateway + AWS Site-to-Site VPN