EdgeRouter - 목적지 포트를 위한 정책 기반 라우팅 ======================================================== download at 2017-02-07T01:05:45Z `origin `_ Overview -------- -------------- 이 문서는 목적지 포트 / 주소를 바탕으로 정책 기반 라우팅을 설정하는 방법에 대하여 서술합니다.   정책 기반 라우팅은 \ `라우팅 기반 Edge OS 정책 `__ 예제에서 시작지 주소 기반 정책이 라우팅 테이블을 패킷의 시작지 주소를 바탕으로 설정한다는 사실을 확인하였습니다. 이 문서에서는 PBR을 사용하여 목적지 포트로의 라우팅을 시도하도록 하겠습니다.   |PBR2.png| .. rubric:: 목적지에 따라서 PBR을 설정하는 네트워크 다이어그램 :name: sample-network-diagram-to-configure-pbr-according-to-destination.   위의 다이어글매에서 2개의 WAN 커넥션(ISP-1, ISP-2)이 존재합니다: #. ISP-1 on eth0 192.0.2.0/24 #. ISP-2 on eth1 203.0.113.0/24 LAN쪽 설정: #. eth2 172.16.0.0/24 이 예제에서는 목적지 포트 80, 443에서 ISP-1으로 트래픽을 전송하고 나머지 모든 트래픽은 ISP-2를 사용하도록 합니다. 라우팅 테이블 -------------- \ `정책기반 EdgeOS 라우팅 `__ 문서에서 사용한 동일한 라우팅 테이블 ("main" 라우팅 테이블이 ISP로의 경로를 포함하고 있음. / table 1은 ISP-1로의 경로, table 2는 ISP-2f로의 경로만 가지고 있음)을 사용합니다. :: ubnt@PBR# show protocols static route 0.0.0.0/0 { next-hop 192.0.2.1 { } next-hop 203.0.113.1 { } } table 1 { route 0.0.0.0/0 { next-hop 192.0.2.1 { } } } table 2 { route 0.0.0.0/0 { next-hop 203.0.113.1 { } } } 목적지 기반 정책 ------------------------ :: firewall { modify DEST_PORT_ROUTE { rule 1 { action modify description "use table 1 to route for ports 80 & 443" destination { port 80,443 } modify { table 1 } protocol tcp } rule 2 { action modify description "use table 2 to route for everything else" modify { table 2 } } } } 인터페이스에 적용하기 ------------------ :: ubnt@PBR# show interfaces ethernet eth2 address 172.16.0.1/24 duplex auto firewall { in { modify DEST_PORT_ROUTE } } speed auto [edit]   예제 환경설정 --------------------- .. raw:: html
.. raw:: html
.. raw:: html
:: firewall { modify DEST_PORT_ROUTE { rule 1 { action modify description "use table 1 to route for ports 80 & 443" destination { port 80,443 } modify { table 1 } protocol tcp } rule 2 { action modify description "use table 2 to route for everything else" modify { table 2 } } } } interfaces { ethernet eth0 { address 192.0.2.2/24 duplex auto speed auto } ethernet eth1 { address 203.0.113.2/24 duplex auto speed auto } ethernet eth2 { address 172.16.0.1/24 duplex auto firewall { in { modify DEST_PORT_ROUTE } } speed auto } loopback lo { } } protocols { static { route 0.0.0.0/0 { next-hop 192.0.2.1 { } next-hop 203.0.113.1 { } } table 1 { route 0.0.0.0/0 { next-hop 192.0.2.1 { } } } table 2 { route 0.0.0.0/0 { next-hop 203.0.113.1 { } } } } } service { dhcp-server { shared-network-name LAN { subnet 172.16.0.0/24 { default-router 172.16.0.1 dns-server 8.8.8.8 lease 86400 start 172.16.0.10 { stop 172.16.0.100 } } } } gui { https-port 443 } nat { rule 5000 { outbound-interface eth0 type masquerade } rule 6000 { outbound-interface eth1 type masquerade } } ssh { port 22 protocol-version v2 } } system { host-name PBR login { user ubnt { authentication { encrypted-password $1$zKNoUbAo$gomzUbYvgyUMcD436Wo66. } level admin } } name-server 8.8.8.8 ntp { server 0.ubnt.pool.ntp.org { } server 1.ubnt.pool.ntp.org { } server 2.ubnt.pool.ntp.org { } server 3.ubnt.pool.ntp.org { } } syslog { global { facility all { level notice } facility protocols { level debug } } } time-zone UTC } /* Warning: Do not remove the following line. */ /* === vyatta-config-version: "config-management@1:dhcp-relay@1:dhcp-server@4:firewall@4:ipsec@3:nat@3:qos@1:quagga@2:system@4:ubnt- pptp@1:vrrp@1:webgui@1:webproxy@1:zone-policy@1" === */ /* Release version: v1.1.0beta3.4539683.130226.1056 */ .. rubric:: 관련 문서 :name: related-articles :class: firstHeading gumax-firstHeading wysiwyg-text-align-left .. raw:: html
-------------- .. raw:: html
- `SSH로 커넥션을 생성하는 방법 `__    .. raw:: html
.. raw:: html
.. raw:: html
.. |PBR2.png| image:: http://community.ubnt.com/t5/image/serverpage/image-id/6883i58CFC81E466E7134/image-size/original?v=mpbl-1&px=-1 :width: 666px :height: 676px