라우팅을 수행하는 방법

라우팅을 수행하는 방법

로컬 사무실의 라우터로 사용하고 싶은 Ubuntu 서버를 설정했습니다.

  1. 문제는 원격 지점에 2개의 VPN 연결을 만들고 VPN 연결 ppp0 및 ppp1을 통해 모든 트래픽을 이 두 지점의 서브넷으로 라우팅하고 나머지 트래픽을 eth0으로 라우팅하려는 것입니다.

어떻게 해야 하나요?

  1. 또한 지점에서 우리 IP를 기반으로 하는 일부 서비스 구독이 있기 때문에 인터넷 트래픽의 일부를 ppp0을 통해 라우팅하고 싶습니다. 따라서 인터넷 트래픽의 이 부분을 ppp0을 통해 라우팅해야 합니다.

질문 1과 동일하게 설정할 수 있나요?

---수정됨---

좋아요 이 페이지에서 답을 찾았습니다.http://pptpclient.sourceforge.net/routing.phtml#lan-to-lan-via-adsl

이것은 작동하는 것 같습니다:

route add -net 192.168.0.0 netmask 255.255.0.0 dev ppp0
iptables --insert OUTPUT 1 --source 0.0.0.0/0.0.0.0 --destination 192.168.0.0/16 --jump ACCEPT --out-interface ppp0
iptables --insert INPUT 1 --source 192.168.0.0/16 --destination 0.0.0.0/0.0.0.0 --jump ACCEPT --in-interface ppp0
iptables --insert FORWARD 1 --source 0.0.0.0/0.0.0.0 --destination 192.168.0.0/16 --jump ACCEPT --out-interface ppp0
iptables --insert FORWARD 1 --source 192.168.0.0/16 --destination 0.0.0.0/0.0.0.0 --jump ACCEPT
iptables --table nat --append POSTROUTING --out-interface ppp0 --jump MASQUERADE
iptables --append FORWARD --protocol tcp --tcp-flags SYN,RST SYN --jump TCPMSS --clamp-mss-to-pmtu

ベストアンサー1

OP 편집:

좋아요 이 페이지에서 답을 찾았습니다.http://pptpclient.sourceforge.net/routing.phtml#lan-to-lan-via-adsl

이것은 작동하는 것 같습니다:

route add -net 192.168.0.0 netmask 255.255.0.0 dev ppp0
iptables --insert OUTPUT 1 --source 0.0.0.0/0.0.0.0 --destination 192.168.0.0/16 --jump ACCEPT --out-interface ppp0
iptables --insert INPUT 1 --source 192.168.0.0/16 --destination 0.0.0.0/0.0.0.0 --jump ACCEPT --in-interface ppp0
iptables --insert FORWARD 1 --source 0.0.0.0/0.0.0.0 --destination 192.168.0.0/16 --jump ACCEPT --out-interface ppp0
iptables --insert FORWARD 1 --source 192.168.0.0/16 --destination 0.0.0.0/0.0.0.0 --jump ACCEPT
iptables --table nat --append POSTROUTING --out-interface ppp0 --jump MASQUERADE
iptables --append FORWARD --protocol tcp --tcp-flags SYN,RST SYN --jump TCPMSS --clamp-mss-to-pmtu

おすすめ記事