본문 바로가기
Network

Vyos - Internet Routing

by PeterC 2021. 2. 24.

가상화 서버에서 라우터에 인터넷 연결하여 패키지를 가져오고 싶음.

맨날 패키지 업데이트한다고 여러대의 가상 자원에 외부 NIC 붙였다 떼기 번거로움

그냥 가상 자원(라우터)을 통해 인터넷으로 나가고 싶음.

 

# 아웃바운드 이더넷 카드 지정
set nat source rule 100 outbound-interface <eth(X)>

# 변환 대상 IP 대역 지정
set nat source rule 100 source address 192.168.11.0/24

# nat 소스 주소 부분 지정, 하나의 인터페이스에서 다른 인터페이스로 규칙을 지정.
# 예를 들어 트래픽이 지정된 규칙을 통해 eth(X)가 아닌 다른 인터페이스를 통해 나가길 원할때.
# 시나리오의 경우 소스 주소를 지정하지 않는 것이 좋은 방법이다.
# 시나리오의 경우 'masquerade' 옵션 사용 (외부 IP 주소로 변환)
set nat source rule 100 translation address <eth(X) IP>

모든 대역대 트래픽은 VM Network GateWay IP 주소로 라우팅 시킴
set protocols static route 0.0.0.0/0 next-hop <VM Network Gateway IP>

# 라우터의 네임서버 지정.
set system name-server <DNS Server IP>

 

내 로컬 PC에서 서버에 올라간 가상자원 대역에 접근하고 싶음

로컬 PC에서 라우팅 테이블을 지정해주면 접근 가능하였음

# 관리자 권한 CMD

# -p 옵션으로 재부팅 후 유지, <접근 IP> <net mask> <GateWay> <Interface Num>

route add -p 192.168.10.0 mask 255.255.255.0 192.168.11.253 IF<num>

 

특정 자원에만 포워딩 하고 싶을 경우

# 인바운드, 외부에서 내부로 들어올 이더넷 지정
set nat destination rule 10 inbound-interface eth1

# 위에서 지정한 eth1로 들어올 경우 포워딩 해줄 IP 주소, 포트 지정
set nat destination rule 10 translation address 192.168.10.20
set nat destination rule 10 translation port 80

# 프로토콜 지정
set nat destination rule 10 protocol tcp

# 접근할 때 사용될 IP 주소와 포트 지정
set nat destination rule 10 destination address 192.168.11.253
set nat destination rule 10 destination port 80

References

1. vyos forum - "Cannot route traffic to internet"

forum.vyos.io/t/cannot-route-traffic-to-internet/421

 

Cannot route traffic to internet

I’m frustrated and cannot figure this out – I spent a lot of time, maybe you can help me out: I’ve got 4 network interfaces on one VyOS Router in VirtualBox: eth0, 172.16.0.1/24 eth1, 10.0.0.1/24 eth2, 192.168.10.1/24 eth3, [see comments, 192.168.1.8

forum.vyos.io

2. 미스터 소스 - "Vyos 설치 및 설정"

mr-soso.tistory.com/32

 

Vyos 설치 및 설정

Vyos - 네트워크 운영체제로 라우터처럼 쓸수있는 OS라고 생각하면 될듯 하다. 분류를 네트워크로 해야될거 같긴한데 우선 server에.. http://wiki.vyos.net/wiki/Main_Page VyOS Wiki Welcome to the VyOS projec..

mr-soso.tistory.com

 

'Network' 카테고리의 다른 글

VRRP(Virtual Routing Redundancy Protocol)  (0) 2021.02.24
ARP(Address Resolution Protocol)  (0) 2021.02.23
ACL(Access Control List)  (0) 2021.02.23
OSI 7 Layer  (0) 2020.06.04