Dante SOCKS5 서버가 ppp 인터페이스를 통해 트래픽을 보내지 않습니다.

Dante SOCKS5 서버가 ppp 인터페이스를 통해 트래픽을 보내지 않습니다.

외부 전원 어댑터가 있는 USB 허브를 통해 RaspberryPI에 여러 개의 3G 모뎀을 설치했습니다. 목표는 이러한 모뎀을 통해 여러 ppp 연결을 만들고 ocks5 프록시(1개 캐리어 -> 1개 전용 포트)를 통해 인터넷을 공유하는 것입니다.

root@raspberrypi:/etc# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.88.81  netmask 255.255.255.0  broadcast 192.168.88.255
        inet6 fe80::be35:5f3a:e942:e39a  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:92:b1:0b  txqueuelen 1000  (Ethernet)
        RX packets 8747  bytes 702623 (686.1 KiB)
        RX errors 0  dropped 2448  overruns 0  frame 0
        TX packets 1452  bytes 183993 (179.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 4  bytes 156 (156.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4  bytes 156 (156.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ppp-kyivstar0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet 10.203.1.38  netmask 255.255.255.255  destination 10.64.64.64
        ppp  txqueuelen 3  (Point-to-Point Protocol)
        RX packets 16  bytes 382 (382.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 16  bytes 514 (514.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ppp-vodafone0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1440
        inet 100.87.250.240  netmask 255.255.255.255  destination 10.64.64.65
        ppp  txqueuelen 3  (Point-to-Point Protocol)
        RX packets 7  bytes 58 (58.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7  bytes 82 (82.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

dante-server의 구성 파일은 다음과 같습니다.

root@raspberrypi:/etc# grep -v "^#" /etc/danted-vodafone0.conf | grep -v "^$"
debug: 0
logoutput: stderr stdout
internal: 192.168.88.81 port = 50002
internal: 127.0.0.1 port = 50002
external: ppp-vodafone0
socksmethod: none
clientmethod: none
user.privileged: proxy
user.unprivileged: nobody
user.libwrap: nobody
client pass {
    from: 192.168.88.0/24 port 1-65535 to: 0.0.0.0/0
}
client pass {
    from: 127.0.0.0/8 port 1-65535 to: 0.0.0.0/0
}
client block {
    from: 0.0.0.0/0 to: 0.0.0.0/0
    log: connect error
}
socks block {
    from: 0.0.0.0/0 to: lo
    log: connect error
}
socks pass {
    from: 192.168.88.0/24 to: 0.0.0.0/0
    protocol: tcp udp
}
socks pass {
    from: 127.0.0.0/8 to: 0.0.0.0/0
    protocol: tcp udp
}
socks block {
    from: 0.0.0.0/0 to: 0.0.0.0/0
    log: connect error
}

컬로 테스트하려고 하면 아무 일도 일어나지 않습니다.

# curl -v --socks5 192.168.88.81:50002 http://ifconfig.co
* Rebuilt URL to: http://ifconfig.co/
*   Trying 192.168.88.81...
* TCP_NODELAY set
* SOCKS5 communication to ifconfig.co:80
* SOCKS5 connect to IPv4 104.27.140.78 (locally resolved)
* Can't complete SOCKS5 connection to 0.0.0.0:0. (6)
* Closing connection 0
curl: (7) Can't complete SOCKS5 connection to 0.0.0.0:0. (6)

다른 쪽에서는 컬을 매개변수로 전달하면 인터페이스를 통해 연결을 설정할 수 있습니다.

# curl -v --interface ppp-vodafone0 http://ifconfig.co
* Rebuilt URL to: http://ifconfig.co/
*   Trying 104.27.140.78...
* TCP_NODELAY set
* Local Interface ppp-vodafone0 is ip 100.120.201.176 using address family 2
* Local port: 0
* Connected to ifconfig.co (104.27.140.78) port 80 (#0)
> GET / HTTP/1.1
> Host: ifconfig.co
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Sat, 08 Sep 2018 00:20:50 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 14
< Connection: keep-alive
< Set-Cookie: __cfduid=df1da9ab56a621c1a8e3a1e75faac555c1536366050; expires=Sun, 08-Sep-19 00:20:50 GMT; path=/; domain=.ifconfig.co; HttpOnly
< Via: 1.1 vegur
< Server: cloudflare
< CF-RAY: 456d4066058483ee-KBP
<
46.133.227.38
* Curl_http_done: called premature == 0
* Connection #0 to host ifconfig.co left intact 

여기서 무엇이 잘못될 수 있나요?

답변1

문제를 발견했습니다. 첫째, ppp 세션 중에 나는 구체적으로 ppp 피어를 설정했습니다.아니요기본 라우팅 구성. 따라서 pppX 인터페이스에서 전송된 패킷은 라우팅 방법을 모릅니다. 이러한 상황은 소위 정책 기반 라우팅을 통해 해결됩니다.

먼저 NET에서 추가 라우팅 테이블을 미리 정의해야 합니다 /etc/iproute2/rt_tables. 내 파일은 다음과 같습니다.

# Ansible managed
#
# reserved values
#
255 local
254 main
253 default
0   unspec
#
# local
#
#1  inr.ruhep
103 kyivstar0
101 lifecell0
102 vodafone0

이 101..103은 PPP 인터페이스용 라우팅 테이블입니다. 그런 다음 정책을 설정해야 합니다. 다음과 같습니다.

ip rule add from 100.83.31.204 table vodafone0
ip route add 0.0.0.0/0 via 10.64.64.64 dev ppp-vodafone0 table vodafone0

어디:

  • 100.83.31.204- 로컬 PPP IP 주소
  • 10.64.64.64- 원격 PPP IP 주소
  • ppp-vodafone0- PPP 인터페이스의 이름
  • vodafone0- 미리 정의된 라우팅 테이블 이름/etc/iproute2/rt_tables

정책 기반 라우팅을 조정하면 모든 것이 예상대로 작동합니다.

관련 정보